root/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ft_to_sngss7_cfg_all
  2. ftmod_ss7_mtp1_gen_config
  3. ftmod_ss7_mtp2_gen_config
  4. ftmod_ss7_mtp3_gen_config
  5. ftmod_ss7_isup_gen_config
  6. ftmod_ss7_cc_gen_config
  7. ftmod_ss7_mtp1_psap_config
  8. ftmod_ss7_mtp2_dlsap_config
  9. ftmod_ss7_mtp3_dlsap_config
  10. ftmod_ss7_mtp3_nsap_config
  11. ftmod_ss7_mtp3_linkset_config
  12. ftmod_ss7_mtp3_route_config
  13. ftmod_ss7_isup_nsap_config
  14. ftmod_ss7_isup_intf_config
  15. ftmod_ss7_isup_ckt_config
  16. ftmod_ss7_isup_isap_config
  17. ftmod_ss7_cc_isap_config

   1 /*
   2  * Copyright (c) 2009|Konrad Hammel <konrad@sangoma.com>
   3  * All rights reserved.
   4  *
   5  * Redistribution and use in source and binary forms|with or without
   6  * modification|are permitted provided that the following conditions
   7  * are met:
   8  *
   9  * * Redistributions of source code must retain the above copyright
  10  * notice|this list of conditions and the following disclaimer.
  11  *
  12  * * Redistributions in binary form must reproduce the above copyright
  13  * notice|this list of conditions and the following disclaimer in the
  14  * documentation and/or other materials provided with the distribution.
  15  *
  16  * * Neither the name of the original author; nor the names of any contributors
  17  * may be used to endorse or promote products derived from this software
  18  * without specific prior written permission.
  19  *
  20  *
  21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES|INCLUDING|BUT NOT
  23  * LIMITED TO|THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER
  25  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT|INDIRECT|INCIDENTAL|SPECIAL,
  26  * EXEMPLARY|OR CONSEQUENTIAL DAMAGES (INCLUDING|BUT NOT LIMITED TO,
  27  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE|DATA|OR
  28  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  29  * LIABILITY|WHETHER IN CONTRACT|STRICT LIABILITY|OR TORT (INCLUDING
  30  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31  * SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32  */
  33 
  34 /* INCLUDE ********************************************************************/
  35 #include "ftmod_sangoma_ss7_main.h"
  36 /******************************************************************************/
  37 
  38 /* DEFINES ********************************************************************/
  39 /******************************************************************************/
  40 
  41 /* GLOBALS ********************************************************************/
  42 /******************************************************************************/
  43 
  44 /* PROTOTYPES *****************************************************************/
  45 int ft_to_sngss7_cfg_all(void);
  46 
  47 int ftmod_ss7_mtp1_gen_config(void);
  48 int ftmod_ss7_mtp2_gen_config(void);
  49 int ftmod_ss7_mtp3_gen_config(void);
  50 int ftmod_ss7_isup_gen_config(void);
  51 int ftmod_ss7_cc_gen_config(void);
  52 
  53 int ftmod_ss7_mtp1_psap_config(int id);
  54 
  55 int ftmod_ss7_mtp2_dlsap_config(int id);
  56 
  57 int ftmod_ss7_mtp3_dlsap_config(int id);
  58 int ftmod_ss7_mtp3_nsap_config(int id);
  59 int ftmod_ss7_mtp3_linkset_config(int id);
  60 int ftmod_ss7_mtp3_route_config(int id);
  61 
  62 int ftmod_ss7_isup_nsap_config(int id);
  63 int ftmod_ss7_isup_intf_config(int id);
  64 int ftmod_ss7_isup_ckt_config(int id);
  65 int ftmod_ss7_isup_isap_config(int id);
  66 
  67 int ftmod_ss7_cc_isap_config(int id);
  68 /******************************************************************************/
  69 
  70 /* FUNCTIONS ******************************************************************/
  71 int  ft_to_sngss7_cfg_all(void)
  72 {
  73         int x = 0;
  74 
  75         /* check if we have done gen_config already */
  76         if (!(g_ftdm_sngss7_data.gen_config)) {
  77 
  78                 if (sng_validate_license(g_ftdm_sngss7_data.cfg.license,
  79                                                                  g_ftdm_sngss7_data.cfg.signature,
  80                                                                  g_ftdm_sngss7_data.cfg.spc)) {
  81 
  82                         SS7_CRITICAL("License verification failed..ending!\n");
  83                         return 1;
  84                 }
  85 
  86                 if (ftmod_ss7_mtp1_gen_config()) {
  87                         SS7_CRITICAL("MTP1 General configuration FAILED!\n");
  88                         return 1;
  89                 } else {
  90                         SS7_INFO("MTP1 General configuration DONE\n");
  91                 }
  92 
  93                 if (ftmod_ss7_mtp2_gen_config()) {
  94                         SS7_CRITICAL("MTP2 General configuration FAILED!\n");
  95                         return 1;
  96                 } else {
  97                         SS7_INFO("MTP2 General configuration DONE\n");
  98                 }
  99 
 100                 if (ftmod_ss7_mtp3_gen_config()) {
 101                         SS7_CRITICAL("MTP3 General configuration FAILED!\n");
 102                         return 1;
 103                 } else {
 104                         SS7_INFO("MTP3 General configuration DONE\n");
 105                 }
 106 
 107                 if (ftmod_ss7_isup_gen_config()) {
 108                         SS7_CRITICAL("ISUP General configuration FAILED!\n");
 109                         return 1;
 110                 } else {
 111                         SS7_INFO("ISUP General configuration DONE\n");
 112                 }
 113 
 114                 if (ftmod_ss7_cc_gen_config()) {
 115                         SS7_CRITICAL("CC General configuration FAILED!\n");
 116                         return 1;
 117                 } else {
 118                         SS7_INFO("CC General configuration DONE\n");
 119                 }
 120 
 121                 /* update the global gen_config so we don't do it again */
 122                 g_ftdm_sngss7_data.gen_config = 1;
 123         }
 124 
 125 
 126         x = 1;
 127         while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {
 128                 /* check if this link has been configured already */
 129                 if (!(g_ftdm_sngss7_data.cfg.mtpLink[x].flags & CONFIGURED)) {
 130 
 131                         /* configure mtp1 */
 132                         if (ftmod_ss7_mtp1_psap_config(x)) {
 133                                 SS7_CRITICAL("MTP1 PSAP %d configuration FAILED!\n", x);
 134                                 return 1;;
 135                         } else {
 136                                 SS7_INFO("MTP1 PSAP %d configuration DONE!\n", x);
 137                         }
 138 
 139                         /* configure mtp2 */
 140                         if (ftmod_ss7_mtp2_dlsap_config(x)) {
 141                                 SS7_CRITICAL("MTP2 DLSAP %d configuration FAILED!\n",x);
 142                                 return 1;;
 143                         } else {
 144                                 SS7_INFO("MTP2 DLSAP %d configuration DONE!\n", x);
 145                         }
 146 
 147                         /* configure mtp3 */
 148                         if (ftmod_ss7_mtp3_dlsap_config(x)) {
 149                                 SS7_CRITICAL("MTP3 DLSAP %d configuration FAILED!\n", x);
 150                                 return 1;;
 151                         } else {
 152                                 SS7_INFO("MTP3 DLSAP %d configuration DONE!\n", x);
 153                         }
 154 
 155                         /* set the CONFIGURED flag */
 156                         g_ftdm_sngss7_data.cfg.mtpLink[x].flags |= CONFIGURED;
 157                 }
 158                 
 159                 x++;
 160         } /* while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) */
 161 
 162         x = 1;
 163         while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) {
 164                 /* check if this link has been configured already */
 165                 if (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & CONFIGURED)) {
 166 
 167                         if (ftmod_ss7_mtp3_nsap_config(x)) {
 168                                 SS7_CRITICAL("MTP3 NSAP %d configuration FAILED!\n", x);
 169                                 return 1;
 170                         } else {
 171                                 SS7_INFO("MTP3 NSAP %d configuration DONE!\n", x);
 172                         }
 173 
 174                         if (ftmod_ss7_isup_nsap_config(x)) {
 175                                 SS7_CRITICAL("ISUP NSAP %d configuration FAILED!\n", x);
 176                                 return 1;
 177                         } else {
 178                                 SS7_INFO("ISUP NSAP %d configuration DONE!\n", x);
 179                         }
 180 
 181                         /* set the CONFIGURED flag */
 182                         g_ftdm_sngss7_data.cfg.nsap[x].flags |= CONFIGURED;
 183                 } /* if !CONFIGURED */
 184                 
 185                 x++;
 186         } /* while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) */
 187 
 188         x = 1;
 189         while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) {
 190                 /* check if this link has been configured already */
 191                 if (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & CONFIGURED)) {
 192 
 193                         if (ftmod_ss7_mtp3_linkset_config(x)) {
 194                                 SS7_CRITICAL("MTP3 LINKSET %d configuration FAILED!\n", x);
 195                                 return 1;
 196                         } else {
 197                                 SS7_INFO("MTP3 LINKSET %d configuration DONE!\n", x);
 198                         }
 199 
 200                         /* set the CONFIGURED flag */
 201                         g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags |= CONFIGURED;
 202                 } /* if !CONFIGURED */
 203                 
 204                 x++;
 205         } /* while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) */
 206 
 207         x = 1;
 208         while ((g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0)) {
 209                 /* check if this link has been configured already */
 210                 if (!(g_ftdm_sngss7_data.cfg.mtpRoute[x].flags & CONFIGURED)) {
 211 
 212                         if (ftmod_ss7_mtp3_route_config(x)) {
 213                                 SS7_CRITICAL("MTP3 ROUTE %d configuration FAILED!\n", x);
 214                                 return 1;
 215                         } else {
 216                                 SS7_INFO("MTP3 ROUTE %d configuration DONE!\n",x);
 217                         }
 218 
 219                         /* set the CONFIGURED flag */
 220                         g_ftdm_sngss7_data.cfg.mtpRoute[x].flags |= CONFIGURED;
 221                 } /* if !CONFIGURED */
 222                 
 223                 x++;
 224         } /* while (g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0) */
 225 
 226         if (!(g_ftdm_sngss7_data.cfg.mtpRoute[0].flags & CONFIGURED)) {
 227 
 228                 if (ftmod_ss7_mtp3_route_config(0)) {
 229                         SS7_CRITICAL("MTP3 ROUTE 0 configuration FAILED!\n");
 230                         return 1;
 231                 } else {
 232                         SS7_INFO("MTP3 ROUTE 0 configuration DONE!\n");
 233                 }
 234 
 235                 /* set the CONFIGURED flag */
 236                 g_ftdm_sngss7_data.cfg.mtpRoute[0].flags |= CONFIGURED;
 237         } /* if !CONFIGURED */
 238 
 239 
 240         x = 1;
 241         while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) {
 242                 /* check if this link has been configured already */
 243                 if (!(g_ftdm_sngss7_data.cfg.isap[x].flags & CONFIGURED)) {
 244                         
 245                         if (ftmod_ss7_isup_isap_config(x)) {
 246                                 SS7_CRITICAL("ISUP ISAP %d configuration FAILED!\n", x);
 247                                 return 1;
 248                         } else {
 249                                 SS7_INFO("ISUP ISAP %d configuration DONE!\n", x);
 250                         }
 251 
 252                         if (ftmod_ss7_cc_isap_config(x)) {
 253                                 SS7_CRITICAL("CC ISAP %d configuration FAILED!\n", x);
 254                                 return 1;
 255                         } else {
 256                                 SS7_INFO("CC ISAP %d configuration DONE!\n", x);
 257                         }
 258 
 259                         /* set the CONFIGURED flag */
 260                         g_ftdm_sngss7_data.cfg.isap[x].flags |= CONFIGURED;
 261                 } /* if !CONFIGURED */
 262                 
 263                 x++;
 264         } /* while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) */
 265 
 266         x = 1;
 267         while (g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) {
 268                 /* check if this link has been configured already */
 269                 if (!(g_ftdm_sngss7_data.cfg.isupIntf[x].flags & CONFIGURED)) {
 270 
 271                         if (ftmod_ss7_isup_intf_config(x)) {
 272                                 SS7_CRITICAL("ISUP INTF %d configuration FAILED!\n", x);
 273                                 return 1;
 274                         } else {
 275                                 SS7_INFO("ISUP INTF %d configuration DONE!\n", x);
 276                                 /* set the interface to paused */
 277                                 sngss7_set_flag(&g_ftdm_sngss7_data.cfg.isupIntf[x], SNGSS7_PAUSED);
 278                         }
 279 
 280                         /* set the CONFIGURED flag */
 281                         g_ftdm_sngss7_data.cfg.isupIntf[x].flags |= CONFIGURED;
 282                 } /* if !CONFIGURED */
 283                 
 284                 x++;
 285         } /* while (g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) */
 286 
 287         x = 1;
 288         while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
 289                 /* check if this link has been configured already */
 290                 if (!(g_ftdm_sngss7_data.cfg.isupCkt[x].flags & CONFIGURED)) {
 291                         if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == 0) {
 292                                 if (ftmod_ss7_isup_ckt_config(x)) {
 293                                         SS7_CRITICAL("ISUP CKT %d configuration FAILED!\n", x);
 294                                         return 1;
 295                                 } else {
 296                                         SS7_INFO("ISUP CKT %d configuration DONE!\n", x);
 297                                 }
 298                         }
 299 
 300                         /* set the CONFIGURED flag */
 301                         g_ftdm_sngss7_data.cfg.isupCkt[x].flags |= CONFIGURED;
 302                 } /* if !CONFIGURED */
 303                 
 304                 x++;
 305         } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */
 306 
 307         return 0;
 308 }
 309 
 310 /******************************************************************************/
 311 int ftmod_ss7_mtp1_gen_config(void)
 312 {
 313         L1Mngmt cfg;    /*configuration structure*/
 314         Pst             pst;    /*post structure*/
 315         
 316         /* initalize the post structure */
 317         smPstInit(&pst);
 318         
 319         /* insert the destination Entity */
 320         pst.dstEnt = ENTL1;
 321         
 322         /* clear the configuration structure */
 323         memset(&cfg, 0x0, sizeof(L1Mngmt));
 324         
 325         /* fill in some general sections of the header */
 326         smHdrInit(&cfg.hdr);
 327 
 328         /* fill in the post structure */
 329         smPstInit( &cfg.t.cfg.s.l1Gen.sm );
 330         
 331         /*fill in the specific fields of the header */
 332         cfg.hdr.msgType                                 = TCFG;
 333         cfg.hdr.entId.ent                               = ENTL1;
 334         cfg.hdr.entId.inst                              = S_INST;
 335         cfg.hdr.elmId.elmnt                     = STGEN;
 336 
 337         cfg.t.cfg.s.l1Gen.sm.srcEnt             = ENTL1;
 338         cfg.t.cfg.s.l1Gen.sm.dstEnt             = ENTSM;
 339         
 340         cfg.t.cfg.s.l1Gen.nmbLnks               = MAX_L1_LINKS;
 341         cfg.t.cfg.s.l1Gen.poolTrUpper   = POOL_UP_TR;           /* upper pool threshold */
 342         cfg.t.cfg.s.l1Gen.poolTrLower   = POOL_LW_TR;           /* lower pool threshold */
 343 
 344         return(sng_cfg_mtp1(&pst, &cfg));
 345 }
 346 
 347 /******************************************************************************/
 348 int ftmod_ss7_mtp2_gen_config(void)
 349 {
 350         SdMngmt cfg;
 351         Pst             pst;
 352         
 353         /* initalize the post structure */
 354         smPstInit(&pst);
 355         
 356         /* insert the destination Entity */
 357         pst.dstEnt = ENTSD;
 358         
 359         /* clear the configuration structure */
 360         memset(&cfg, 0x0, sizeof(SdMngmt));
 361         
 362         /* fill in some general sections of the header */
 363         smHdrInit(&cfg.hdr);
 364 
 365         /* fill in the post structure */
 366         smPstInit( &cfg.t.cfg.s.sdGen.sm );
 367         
 368         /* fill in the specific fields of the header */
 369         cfg.hdr.msgType                                 = TCFG;
 370         cfg.hdr.entId.ent                               = ENTSD;
 371         cfg.hdr.entId.inst                              = S_INST;
 372         cfg.hdr.elmId.elmnt                             = STGEN;
 373         
 374         cfg.t.cfg.s.sdGen.sm.srcEnt             = ENTSD;
 375         cfg.t.cfg.s.sdGen.sm.dstEnt             = ENTSM;
 376         
 377         cfg.t.cfg.s.sdGen.nmbLnks               = MAX_SD_LINKS;
 378         cfg.t.cfg.s.sdGen.poolTrUpper   = POOL_UP_TR;
 379         cfg.t.cfg.s.sdGen.poolTrLower   = POOL_LW_TR;
 380 
 381         return(sng_cfg_mtp2(&pst, &cfg));
 382 }
 383 
 384 /******************************************************************************/
 385 int ftmod_ss7_mtp3_gen_config(void)
 386 {
 387         SnMngmt cfg;
 388         Pst             pst;
 389 
 390         /* initalize the post structure */
 391         smPstInit(&pst);
 392 
 393         /* insert the destination Entity */
 394         pst.dstEnt = ENTSN;
 395 
 396         /*clear the configuration structure*/
 397         memset(&cfg, 0x0, sizeof(SnMngmt));
 398 
 399         /*fill in some general sections of the header*/
 400         smHdrInit(&cfg.hdr);
 401 
 402         /* fill in the post structure */
 403         smPstInit(&cfg.t.cfg.s.snGen.sm);
 404 
 405         /*fill in the specific fields of the header*/
 406         cfg.hdr.msgType                                 = TCFG;
 407         cfg.hdr.entId.ent                               = ENTSN;
 408         cfg.hdr.entId.inst                              = S_INST;
 409         cfg.hdr.elmId.elmnt                     = STGEN;
 410 
 411         cfg.t.cfg.s.snGen.sm.srcEnt             = ENTSN;
 412         cfg.t.cfg.s.snGen.sm.dstEnt             = ENTSM;
 413 
 414 
 415         cfg.t.cfg.s.snGen.typeSP                = LSN_TYPE_SP;          /* type of signalling postatic int */
 416         cfg.t.cfg.s.snGen.spCode1               = g_ftdm_sngss7_data.cfg.spc;   /* our DPC for CCITT version */
 417 
 418 #if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || SS7_CHINA || defined(TDS_ROLL_UPGRADE_SUPPORT))
 419         cfg.t.cfg.s.snGen.spCode2               = g_ftdm_sngss7_data.cfg.spc;   /* our DPC for ANSI or CHINA version */
 420 #endif
 421 
 422         cfg.t.cfg.s.snGen.ssfValid              = TRUE;                         /* ssf validation required */
 423         cfg.t.cfg.s.snGen.nmbDLSap              = MAX_SN_LINKS;         /* number of MTP Data Link SAPs */
 424         cfg.t.cfg.s.snGen.nmbNSap               = MAX_SN_VARIANTS;      /* number of Upper Layer Saps */
 425         cfg.t.cfg.s.snGen.nmbRouts              = MAX_SN_ROUTES;        /* maximum number of routing entries */
 426         cfg.t.cfg.s.snGen.nmbLnkSets    = MAX_SN_LINKSETS;      /* number of link sets */
 427         cfg.t.cfg.s.snGen.nmbRteInst    = MAX_SN_ROUTES*16;     /* number of simultaneous Rte instances */
 428         cfg.t.cfg.s.snGen.cbTimeRes             = SN_CB_PERIOD;         /* link time resolution */
 429         cfg.t.cfg.s.snGen.spTimeRes             = SN_SP_PERIOD;         /* general time resolution */
 430         cfg.t.cfg.s.snGen.rteTimeRes    = SN_RTE_PERIOD;        /* route time resolution */
 431         cfg.t.cfg.s.snGen.extCmbndLnkst = FALSE;                        /* enbale extended combined linkset feature */
 432 
 433 #if (defined(LSNV3) || defined(SN_MULTIPLE_NETWORK_RESTART))
 434 
 435 #else
 436         cfg.t.cfg.s.snGen.rstReq                = LSN_NO_RST;           /* restarting procedure required */
 437         cfg.t.cfg.s.snGen.tfrReq                = FALSE;                        /* TFR procedure required or not */
 438         cfg.t.cfg.s.snGen.tmr.t15.enb   = TRUE;                         /* t15 - waiting to start route set congestion test */
 439         cfg.t.cfg.s.snGen.tmr.t15.val   = 30;
 440         cfg.t.cfg.s.snGen.tmr.t16.enb   = TRUE;                         /* t16 - waiting for route set congestion status update */
 441         cfg.t.cfg.s.snGen.tmr.t16.val   = 20;
 442         cfg.t.cfg.s.snGen.tmr.t18.enb   = TRUE;                         /* t18 - waiting for links to become available */
 443         cfg.t.cfg.s.snGen.tmr.t18.val   = 200;
 444         cfg.t.cfg.s.snGen.tmr.t19.enb   = TRUE;                         /* t19 - waiting to receive all traffic restart allowed */
 445         cfg.t.cfg.s.snGen.tmr.t19.val   = 690;
 446         cfg.t.cfg.s.snGen.tmr.t21.enb   = TRUE;                         /* t21 - waiting to restart traffic routed through adjacent SP */
 447         cfg.t.cfg.s.snGen.tmr.t21.val   = 650;
 448 # if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || defined(TDS_ROLL_UPGRADE_SUPPORT))
 449         cfg.t.cfg.s.snGen.tmr.t26.enb           = TRUE;                         /* t26 - waiting to repeat traffic restart waiting message for ANSI */
 450         cfg.t.cfg.s.snGen.tmr.t26.val           = 600;
 451 # endif
 452 #endif
 453 
 454 #if (SS7_ANS88 || SS7_ANS92 || SS7_ANS96)
 455         cfg.t.cfg.s.snGen.mopc                  = FALSE;
 456 #endif
 457 
 458         return(sng_cfg_mtp3(&pst, &cfg));
 459 }
 460 
 461 /******************************************************************************/
 462 int ftmod_ss7_isup_gen_config(void)
 463 {
 464         SiMngmt  cfg;
 465         Pst              pst;
 466 
 467         /* initalize the post structure */
 468         smPstInit(&pst);
 469 
 470         /* insert the destination Entity */
 471         pst.dstEnt = ENTSI;
 472 
 473         /* clear the configuration structure */
 474         memset(&cfg, 0x0, sizeof(SiMngmt));
 475 
 476         /* fill in some general sections of the header */
 477         smHdrInit(&cfg.hdr);
 478 
 479         /* fill in the post structure */
 480         smPstInit( &cfg.t.cfg.s.siGen.sm );
 481 
 482         /*fill in the specific fields of the header */
 483         cfg.hdr.msgType                                         = TCFG;
 484         cfg.hdr.entId.ent                                       = ENTSI;
 485         cfg.hdr.entId.inst                                      = S_INST;
 486         cfg.hdr.elmId.elmnt                             = STGEN;
 487 
 488         cfg.t.cfg.s.siGen.sm.srcEnt                     = ENTSI;
 489         cfg.t.cfg.s.siGen.sm.dstEnt                     = ENTSM;
 490 
 491         cfg.t.cfg.s.siGen.nmbSaps                       = MAX_CC_INTERFACE;             /* Number of ISUP Saps */
 492         cfg.t.cfg.s.siGen.nmbNSaps                      = MAX_SN_INTERFACE;             /* Number of Network Saps */
 493         cfg.t.cfg.s.siGen.nmbCir                        = MAX_SI_CIRCUITS;              /* Number of circuits */
 494         cfg.t.cfg.s.siGen.nmbIntf                       = MAX_SI_INTERFACES;    /* Number of interfaces */
 495         cfg.t.cfg.s.siGen.nmbCirGrp                     = MAX_SI_CIR_GRP;               /* Max number of circuit groups */
 496         cfg.t.cfg.s.siGen.nmbCalRef                     = MAX_SI_CALL_REF;              /* Number of Call References */
 497         cfg.t.cfg.s.siGen.timeRes                       = SI_PERIOD;                    /* time resolution */
 498         cfg.t.cfg.s.siGen.sccpSup                       = FALSE;                                /* SCCP support */
 499         cfg.t.cfg.s.siGen.handleTTBinCC         = FALSE;                                /* Flag used for controlling TTB feature */
 500         cfg.t.cfg.s.siGen.mapCPCandFCI          = TRUE;                                 /* Flag used for controlling TTB feature */
 501 #if (LSIV3 || LSIV4 || LSIV5)
 502         cfg.t.cfg.s.siGen.lnkSelOpt                     = SI_LINK_SELECTION;    /* link selector option */
 503 #endif  
 504         cfg.t.cfg.s.siGen.poolTrUpper           = POOL_UP_TR;                   /* upper pool threshold */
 505         cfg.t.cfg.s.siGen.poolTrLower           = POOL_LW_TR;                   /* lower pool threshold */
 506         cfg.t.cfg.s.siGen.cirGrTmr.t18.enb      = TRUE;                                 /* t18 timer - group blocking sent */
 507         cfg.t.cfg.s.siGen.cirGrTmr.t18.val      = 300;
 508         cfg.t.cfg.s.siGen.cirGrTmr.t19.enb      = TRUE;                                 /* t19 timer - initial group blocking sent */
 509         cfg.t.cfg.s.siGen.cirGrTmr.t19.val      = 3000;
 510         cfg.t.cfg.s.siGen.cirGrTmr.t20.enb      = TRUE;                                 /* t20 timer - group unblocking sent */
 511         cfg.t.cfg.s.siGen.cirGrTmr.t20.val      = 300;
 512         cfg.t.cfg.s.siGen.cirGrTmr.t21.enb      = TRUE;                                 /* t21 timer - initial grp unblocking sent */
 513         cfg.t.cfg.s.siGen.cirGrTmr.t21.val      = 3000;
 514         cfg.t.cfg.s.siGen.cirGrTmr.t22.enb      = TRUE;                                 /* t22 timer - group reset sent */
 515         cfg.t.cfg.s.siGen.cirGrTmr.t22.val      = 300;
 516         cfg.t.cfg.s.siGen.cirGrTmr.t23.enb      = TRUE;                                 /* t23 timer - initial group reset sent */
 517         cfg.t.cfg.s.siGen.cirGrTmr.t23.val      = 3000;
 518 #ifndef SS7_UK
 519         cfg.t.cfg.s.siGen.cirGrTmr.t28.enb      = TRUE;                                 /* t28 timer - circuit group query sent */
 520         cfg.t.cfg.s.siGen.cirGrTmr.t28.val      = 100;
 521 #endif
 522 #if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL)
 523         cfg.t.cfg.s.siGen.cirGrTmr.tFGR.enb = TRUE;                                     /* first group received timer */
 524         cfg.t.cfg.s.siGen.cirGrTmr.tFGR.val = 50;
 525 #endif
 526 #if CGPN_CHK
 527         cfg.t.cfg.s.siGen.cgPtyNumGenCfg        = TRUE;                                 /* Calling party number general config flag */
 528 #endif
 529 #ifdef SI_SUPPRESS_CFN
 530         cfg.t.cfg.s.siGen.suppressCfn           = TRUE;                                 /* Flag used for 'suppress CFN' feature */
 531 #endif
 532 
 533         return(sng_cfg_isup(&pst, &cfg));
 534 
 535 }
 536 
 537 /******************************************************************************/
 538 int ftmod_ss7_cc_gen_config(void)
 539 {
 540         CcMngmt cfg;
 541         Pst              pst;
 542 
 543         /* initalize the post structure */
 544         smPstInit(&pst);
 545 
 546         /* insert the destination Entity */
 547         pst.dstEnt = ENTCC;
 548 
 549         /*clear the configuration structure*/
 550         memset(&cfg, 0x0, sizeof(CcMngmt));
 551 
 552         /*fill in some general sections of the header*/
 553         smHdrInit(&cfg.hdr);
 554 
 555         /* fill in the post structure */
 556         smPstInit( &cfg.t.cfg.s.ccGen.sm );
 557 
 558         /*fill in the specific fields of the header*/
 559         cfg.hdr.msgType                                 = TCFG;
 560         cfg.hdr.entId.ent                               = ENTCC;
 561         cfg.hdr.entId.inst                              = S_INST;
 562         cfg.hdr.elmId.elmnt                     = STGEN;
 563 
 564         cfg.t.cfg.s.ccGen.sm.srcEnt             = ENTCC;
 565         cfg.t.cfg.s.ccGen.sm.dstEnt             = ENTSM;
 566 
 567         cfg.t.cfg.s.ccGen.poolTrUpper   = POOL_UP_TR;           /* upper pool threshold */
 568         cfg.t.cfg.s.ccGen.poolTrLower   = POOL_LW_TR;           /* lower pool threshold */
 569 
 570         return(sng_cfg_cc(&pst, &cfg));
 571 }
 572 
 573 /******************************************************************************/
 574 int ftmod_ss7_mtp1_psap_config(int id)
 575 {
 576         L1Mngmt                 cfg;
 577         Pst                             pst;
 578         sng_mtp_link_t  *k = &g_ftdm_sngss7_data.cfg.mtpLink[id];
 579         
 580         /* initalize the post structure */
 581         smPstInit(&pst);
 582         
 583         /* insert the destination Entity */
 584         pst.dstEnt = ENTL1;
 585         
 586         /*clear the configuration structure*/
 587         memset(&cfg, 0x0, sizeof(L1Mngmt));
 588         
 589         /*fill in some general sections of the header*/
 590         smHdrInit(&cfg.hdr);
 591         
 592         /*fill in the specific fields of the header*/
 593         cfg.hdr.msgType                         = TCFG;
 594         cfg.hdr.entId.ent                       = ENTL1;
 595         cfg.hdr.entId.inst                      = S_INST;
 596         cfg.hdr.elmId.elmnt             = STPSAP;
 597         
 598         cfg.hdr.elmId.elmntInst1        = k->id;
 599         
 600         cfg.t.cfg.s.l1PSAP.span         = k->mtp1.span;
 601         cfg.t.cfg.s.l1PSAP.chan         = k->mtp1.chan;
 602         cfg.t.cfg.s.l1PSAP.spId         = k->id;
 603 
 604         return(sng_cfg_mtp1(&pst, &cfg));
 605 }
 606 
 607 /******************************************************************************/
 608 int ftmod_ss7_mtp2_dlsap_config(int id)
 609 {
 610         SdMngmt cfg;
 611         Pst             pst;
 612         sng_mtp_link_t  *k = &g_ftdm_sngss7_data.cfg.mtpLink[id];
 613 
 614         /* initalize the post structure */
 615         smPstInit( &pst);
 616 
 617         /* insert the destination Entity */
 618         pst.dstEnt = ENTSD;
 619 
 620         /*clear the configuration structure*/
 621         memset(&cfg, 0x0, sizeof(SdMngmt));
 622 
 623         /*fill in some general sections of the header*/
 624         smHdrInit(&cfg.hdr);
 625 
 626         /*fill in the specific fields of the header*/
 627         cfg.hdr.msgType                                         = TCFG;
 628         cfg.hdr.entId.ent                                       = ENTSD;
 629         cfg.hdr.entId.inst                                      = S_INST;
 630         cfg.hdr.elmId.elmnt                             = STDLSAP;
 631 
 632         cfg.hdr.elmId.elmntInst1                        = k->id;
 633 
 634         cfg.t.cfg.s.sdDLSAP.mem.region          = S_REG;                                        /* memory region */
 635         cfg.t.cfg.s.sdDLSAP.mem.pool            = S_POOL;                                       /* memory pool */
 636         cfg.t.cfg.s.sdDLSAP.swtch                       = k->mtp2.linkType;                     /* protocol type */
 637         cfg.t.cfg.s.sdDLSAP.priorDl                     = PRIOR0;                                       /* priority for data link layer */
 638         cfg.t.cfg.s.sdDLSAP.routeDl                     = RTESPEC;                                      /* route for data link layer */
 639         cfg.t.cfg.s.sdDLSAP.selectorDl          = 0;                                            /* upper interface selector */
 640         cfg.t.cfg.s.sdDLSAP.dstProcId           = SFndProcId();                         /* the procid of MAC/L1/MTP1 */
 641         cfg.t.cfg.s.sdDLSAP.entMac                      = ENTL1;                                        /* entity for MAC */
 642         cfg.t.cfg.s.sdDLSAP.instMac                     = S_INST;                                       /* instance for MAC */
 643         cfg.t.cfg.s.sdDLSAP.priorMac            = PRIOR0;                                       /* priority for MAC layer */
 644         cfg.t.cfg.s.sdDLSAP.routeMac            = RTESPEC;                                      /* route for MAC layer */
 645         cfg.t.cfg.s.sdDLSAP.selectorMac         = 0;                                            /* lower interface selector */
 646         cfg.t.cfg.s.sdDLSAP.memMac.region       = S_REG;                                        /* memory region and pool id for MAC */
 647         cfg.t.cfg.s.sdDLSAP.memMac.pool         = S_POOL;
 648         cfg.t.cfg.s.sdDLSAP.maxOutsFrms         = MAX_SD_OUTSTANDING;           /* maximum outstanding frames */
 649         cfg.t.cfg.s.sdDLSAP.errType                     = k->mtp2.errorType;
 650         cfg.t.cfg.s.sdDLSAP.t1.enb                      = TRUE;                                         /* timer 1 - Alignment Ready Timer */
 651         cfg.t.cfg.s.sdDLSAP.t1.val                      = k->mtp2.t1;
 652         cfg.t.cfg.s.sdDLSAP.t2.enb                      = TRUE;                                         /* timer 2 - Not Aligned Timer */
 653         cfg.t.cfg.s.sdDLSAP.t2.val                      = k->mtp2.t2;
 654         cfg.t.cfg.s.sdDLSAP.t3.enb                      = TRUE;                                         /* timer 3 - Aligned Timer */
 655         cfg.t.cfg.s.sdDLSAP.t3.val                      = k->mtp2.t3;
 656         cfg.t.cfg.s.sdDLSAP.t5.enb                      = TRUE;                                         /* timer 5 - Sending SIB timer */
 657         cfg.t.cfg.s.sdDLSAP.t5.val                      = k->mtp2.t5;
 658         cfg.t.cfg.s.sdDLSAP.t6.enb                      = TRUE;                                         /* timer 6 - Remote Congestion Timer */
 659         cfg.t.cfg.s.sdDLSAP.t6.val                      = k->mtp2.t6;
 660         cfg.t.cfg.s.sdDLSAP.t7.enb                      = TRUE;                                         /* timer 7 - Excessive delay of acknowledgement timer */
 661         cfg.t.cfg.s.sdDLSAP.t7.val                      = k->mtp2.t7;
 662         cfg.t.cfg.s.sdDLSAP.provEmrgcy          = k->mtp2.t4e;                          /* emergency proving period */
 663         cfg.t.cfg.s.sdDLSAP.provNormal          = k->mtp2.t4n;                          /* normal proving period */
 664         cfg.t.cfg.s.sdDLSAP.lssuLen                     = k->mtp2.lssuLength;                   /* one or two byte LSSU length */
 665         cfg.t.cfg.s.sdDLSAP.maxFrmLen           = MAX_SD_FRAME_LEN;                     /* max frame length for MSU */
 666         cfg.t.cfg.s.sdDLSAP.congDisc            = FALSE;                                        /* congestion discard TRUE or FALSE */
 667         cfg.t.cfg.s.sdDLSAP.sdT                         = MAX_SD_SUERM;                         /* SUERM error rate threshold */
 668         cfg.t.cfg.s.sdDLSAP.sdTie                       = MAX_SD_AERM_EMERGENCY;        /* AERM emergency error rate threshold */
 669         cfg.t.cfg.s.sdDLSAP.sdTin                       = MAX_SD_AERM_NORMAL;           /* AERM normal error rate threshold */
 670         cfg.t.cfg.s.sdDLSAP.sdN1                        = MAX_SD_MSU_RETRANS;           /* maximum number of MSUs for retransmission */
 671         cfg.t.cfg.s.sdDLSAP.sdN2                        = MAX_SD_OCTETS_RETRANS;        /* maximum number of MSU octets for retrans */
 672         cfg.t.cfg.s.sdDLSAP.sdCp                        = MAX_SD_ALIGN_ATTEMPTS;        /* maximum number of alignment attempts */
 673         cfg.t.cfg.s.sdDLSAP.spIdSE                      = k->mtp2.mtp1Id;                               /* service provider id */
 674         cfg.t.cfg.s.sdDLSAP.sdtFlcStartTr       = 256;                                          /* SDT interface flow control start thresh */
 675         cfg.t.cfg.s.sdDLSAP.sdtFlcEndTr         = 512;                                          /* SDT interface flow control end thresh */
 676 
 677 #ifdef SD_HSL
 678         cfg.t.cfg.s.sdDLSAP.sapType                     =;                                                      /* Indcates whether link is HSL or LSL */
 679         cfg.t.cfg.s.sdDLSAP.sapFormat           =;                                                      /* The extened sequence no to be used or not */
 680         cfg.t.cfg.s.sdDLSAP.t8.enb                      =;                                                      /* timer 8 configuration structure */
 681         cfg.t.cfg.s.sdDLSAP.sdTe                        =;                                                      /* EIM threshold */
 682         cfg.t.cfg.s.sdDLSAP.sdUe                        =;                                                      /* increment constant */
 683         cfg.t.cfg.s.sdDLSAP.sdDe                        =;                                                      /* decrement constant */
 684 #endif /* HIGH_SPEED_SIGNALING_SUPPORT */
 685 
 686 #if (SS7_TTC || SS7_NTT)
 687         cfg.t.cfg.s.sdDLSAP.numRtb                      =;                                                      /* outstanding number of messages in RTB */
 688         cfg.t.cfg.s.sdDLSAP.tf                          =;                                                      /* FISU transmission interval */
 689         cfg.t.cfg.s.sdDLSAP.tfv                         =;                                                      /* FISU transmission interval during verification */
 690         cfg.t.cfg.s.sdDLSAP.to                          =;                                                      /* SIO transmission interval */
 691         cfg.t.cfg.s.sdDLSAP.ta                          =;                                                      /* SIE transmission interval */
 692         cfg.t.cfg.s.sdDLSAP.ts                          =;                                                      /* SIOS transmission interval */
 693         cfg.t.cfg.s.sdDLSAP.tso                         =;                                                      /* SIOS transmission duration when out of service */
 694         cfg.t.cfg.s.sdDLSAP.te                          =;                                                      /* SU normalization time */
 695 #endif /* (SS7_TTC || SS7_NTT) */
 696 
 697 #if (SS7_NTT)           /* NTTT - Q.703 */
 698         cfg.t.cfg.s.sdDLSAP.repMsuNack          =;                                                      /* Nack on receipt of repeated MSU */
 699         cfg.t.cfg.s.sdDLSAP.invFibIgnore        =;                                                      /* invalid FIB ignore or bring the link down */
 700         cfg.t.cfg.s.sdDLSAP.invBsnIgnore        =;                                                      /* invalid BSN ignore or bring the link down */
 701         cfg.t.cfg.s.sdDLSAP.congAbatOnNack      =;                                                      /* congestion abatement on nack or only on acks */
 702 #endif /* (SS7_NTT) */
 703 
 704 #ifdef TDS_ROLL_UPGRADE_SUPPORT 
 705         cfg.t.cfg.s.sdDLSAP.hlremIntfValid      = FALSE;                                        /* Upper Sap Version number valid ? */
 706         cfg.t.cfg.s.sdDLSAP.remIntfVer          = SDTIFVER;                                     /* remote version info */
 707 #endif /*RUG*/
 708 
 709         return(sng_cfg_mtp2(&pst, &cfg));
 710         return 0;
 711 }
 712 
 713 /******************************************************************************/
 714 int ftmod_ss7_mtp3_dlsap_config(int id)
 715 {
 716         Pst                             pst;
 717         SnMngmt                 cfg;
 718         sng_mtp_link_t  *k = &g_ftdm_sngss7_data.cfg.mtpLink[id];
 719 
 720 
 721         /* initalize the post structure */
 722         smPstInit(&pst);
 723 
 724         /* insert the destination Entity */
 725         pst.dstEnt = ENTSN;
 726 
 727         /*clear the configuration structure*/
 728         memset(&cfg, 0x0, sizeof(SnMngmt));
 729 
 730         /*fill in some general sections of the header*/
 731         smHdrInit(&cfg.hdr);
 732 
 733         /*fill in the specific fields of the header*/
 734         cfg.hdr.msgType                                         = TCFG;
 735         cfg.hdr.entId.ent                                       = ENTSN;
 736         cfg.hdr.entId.inst                                      = S_INST;
 737         cfg.hdr.elmId.elmnt                             = STDLSAP;
 738 
 739         cfg.hdr.elmId.elmntInst1                        = k->id;
 740 
 741         cfg.t.cfg.s.snDLSAP.lnkSetId            = k->mtp3.linkSetId;    /* link set ID */
 742         cfg.t.cfg.s.snDLSAP.opc                         = k->mtp3.spc;                  /* Originating Postatic int Code */
 743         cfg.t.cfg.s.snDLSAP.adjDpc                      = k->mtp3.apc;                  /* Adlacent Destination Postatic int Code */
 744         cfg.t.cfg.s.snDLSAP.lnkPrior            = 0;                                    /* link priority within the link set */
 745         cfg.t.cfg.s.snDLSAP.msgSize                     = MAX_SN_MSG_SIZE;              /* message length */
 746         cfg.t.cfg.s.snDLSAP.msgPrior            = 0;                                    /* management message priority */
 747         cfg.t.cfg.s.snDLSAP.lnkType                     = k->mtp3.linkType;             /* link type ANSI, ITU, BICI or CHINA */
 748         cfg.t.cfg.s.snDLSAP.upSwtch                     = k->mtp3.switchType;   /* user part switch type */
 749         cfg.t.cfg.s.snDLSAP.maxSLTtry           = MAX_SLTM_RETRIES;             /* maximun times to retry SLTM */
 750         cfg.t.cfg.s.snDLSAP.p0QLen                      = 32;                                   /* size of the priority 0 Q */
 751         cfg.t.cfg.s.snDLSAP.p1QLen                      = 32;                                   /* size of the priority 1 Q */
 752         cfg.t.cfg.s.snDLSAP.p2QLen                      = 32;                                   /* size of the priority 2 Q */
 753         cfg.t.cfg.s.snDLSAP.p3QLen                      = 32;                                   /* size of the priority 3 Q */
 754         cfg.t.cfg.s.snDLSAP.discPrior           = 0;                                    /* discard priority */
 755 #ifndef SDT2
 756         cfg.t.cfg.s.snDLSAP.maxCredit           = MAX_SN_CREDIT;                /* max credit */
 757 #endif /* SDT2 */
 758         cfg.t.cfg.s.snDLSAP.lnkId                       = 0;                                    /* signalling link allocation procedure identity */
 759         cfg.t.cfg.s.snDLSAP.lnkTstSLC           = k->mtp3.slc;                  /* link selection code for link test */
 760         cfg.t.cfg.s.snDLSAP.tstLen                      = 6;                                    /* link test pattern length */
 761         cfg.t.cfg.s.snDLSAP.tst[0]                      = 'K';                                  /* link test pattern */
 762         cfg.t.cfg.s.snDLSAP.tst[1]                      = 'O';                                  /* link test pattern */
 763         cfg.t.cfg.s.snDLSAP.tst[2]                      = 'N';                                  /* link test pattern */
 764         cfg.t.cfg.s.snDLSAP.tst[3]                      = 'R';                                  /* link test pattern */
 765         cfg.t.cfg.s.snDLSAP.tst[4]                      = 'A';                                  /* link test pattern */
 766         cfg.t.cfg.s.snDLSAP.tst[5]                      = 'D';                                  /* link test pattern */
 767         cfg.t.cfg.s.snDLSAP.ssf                         = k->mtp3.ssf;                  /* sub service field */ 
 768         cfg.t.cfg.s.snDLSAP.dstProcId           = SFndProcId();                 /* destination processor id */
 769         cfg.t.cfg.s.snDLSAP.dstEnt                      = ENTSD;                                /* entity */
 770         cfg.t.cfg.s.snDLSAP.dstInst                     = S_INST;                               /* instance */
 771         cfg.t.cfg.s.snDLSAP.prior                       = PRIOR0;                               /* priority */
 772         cfg.t.cfg.s.snDLSAP.route                       = RTESPEC;                              /* route */
 773         cfg.t.cfg.s.snDLSAP.selector            = 0;                                    /* lower layer selector */
 774         cfg.t.cfg.s.snDLSAP.mem.region          = S_REG;                                /* memory region id */
 775         cfg.t.cfg.s.snDLSAP.mem.pool            = S_POOL;                               /* memory pool id */
 776         cfg.t.cfg.s.snDLSAP.spId                        = k->mtp3.mtp2Id                ;/* service provider id */
 777 
 778         switch (k->mtp3.linkType) {
 779         /**************************************************************************/
 780         case (LSN_SW_ANS):
 781         case (LSN_SW_ANS96):
 782         case (LSN_SW_CHINA):
 783                 cfg.t.cfg.s.snDLSAP.dpcLen              = DPC24;                                /* dpc length 24 bits */
 784                 cfg.t.cfg.s.snDLSAP.l2Type              = LSN_MTP2_56KBPS;              /* layer 2 type - 56kbps MTP2 link, 1.536Mbps MTP2 link or QSAAL link */
 785                 cfg.t.cfg.s.snDLSAP.isCLink             = FALSE;                                /* identifies if the link is a C type link.Required to check if sls has to be rotated.*/
 786                 break;
 787         /**************************************************************************/
 788         case (LSN_SW_ITU):
 789                 cfg.t.cfg.s.snDLSAP.dpcLen              = DPC14;                                /* dpc length 14 bits */
 790                 break;
 791         /**************************************************************************/
 792         default:
 793                 cfg.t.cfg.s.snDLSAP.dpcLen              = DPC14;                                /* dpc length 14 bits */
 794                 break;
 795         /**************************************************************************/
 796         } /* switch (k->mtp3.linkType) */
 797 
 798         switch (k->mtp3.linkType) {
 799         /**************************************************************************/
 800         case (LSN_SW_ANS):
 801         case (LSN_SW_ANS96):
 802                 cfg.t.cfg.s.snDLSAP.flushContFlag       = TRUE;                 /* flush continue handling */
 803                 break;
 804         /**************************************************************************/
 805         case (LSN_SW_ITU):
 806         case (LSN_SW_CHINA):
 807                 cfg.t.cfg.s.snDLSAP.flushContFlag       = FALSE;                        /* flush continue handling */
 808                 break;
 809         /**************************************************************************/
 810         default:
 811                 cfg.t.cfg.s.snDLSAP.flushContFlag       = FALSE;                        /* flush continue handling */
 812                 break;
 813         /**************************************************************************/
 814         } /* switch (k->mtp3.linkType) */
 815 
 816         cfg.t.cfg.s.snDLSAP.tmr.t1.enb          = TRUE;                                 /* t1 - delay to avoid missequencing on changeover */
 817         cfg.t.cfg.s.snDLSAP.tmr.t1.val          = k->mtp3.t1;
 818         cfg.t.cfg.s.snDLSAP.tmr.t2.enb          = TRUE;                                 /* t2 - waiting for changeover ack */
 819         cfg.t.cfg.s.snDLSAP.tmr.t2.val          = k->mtp3.t2;
 820         cfg.t.cfg.s.snDLSAP.tmr.t3.enb          = TRUE;                                 /* t3 - delay to avoid missequencing on changeback */
 821         cfg.t.cfg.s.snDLSAP.tmr.t3.val          = k->mtp3.t3;
 822         cfg.t.cfg.s.snDLSAP.tmr.t4.enb          = TRUE;                                 /* t4 - waiting for first changeback ack */
 823         cfg.t.cfg.s.snDLSAP.tmr.t4.val          = k->mtp3.t4;
 824         cfg.t.cfg.s.snDLSAP.tmr.t5.enb          = TRUE;                                 /* t5 - waiting for second changeback ack */
 825         cfg.t.cfg.s.snDLSAP.tmr.t5.val          = k->mtp3.t5;
 826         cfg.t.cfg.s.snDLSAP.tmr.t7.enb          = TRUE;                                 /* t7 - waiting for link connection ack */
 827         cfg.t.cfg.s.snDLSAP.tmr.t7.val          = k->mtp3.t7;
 828         cfg.t.cfg.s.snDLSAP.tmr.t12.enb         = TRUE;                                 /* t12 - waiting for uninhibit ack */
 829         cfg.t.cfg.s.snDLSAP.tmr.t12.val         = k->mtp3.t12;
 830         cfg.t.cfg.s.snDLSAP.tmr.t13.enb         = TRUE;                                 /* t13 - waiting for forced uninhibit */
 831         cfg.t.cfg.s.snDLSAP.tmr.t13.val         = k->mtp3.t13;
 832         cfg.t.cfg.s.snDLSAP.tmr.t14.enb         = TRUE;                                 /* t14 - waiting for inhibition ack */
 833         cfg.t.cfg.s.snDLSAP.tmr.t14.val         = k->mtp3.t14;
 834         cfg.t.cfg.s.snDLSAP.tmr.t17.enb         = TRUE;                                 /* t17 - delay to avoid oscillation of initial alignment failure */
 835         cfg.t.cfg.s.snDLSAP.tmr.t17.val         = k->mtp3.t17;
 836         cfg.t.cfg.s.snDLSAP.tmr.t22.enb         = TRUE;                                 /* t22 - local inhibit test timer */
 837         cfg.t.cfg.s.snDLSAP.tmr.t22.val         = k->mtp3.t22;
 838         cfg.t.cfg.s.snDLSAP.tmr.t23.enb         = TRUE;                                 /* t23 - remote inhibit test timer */
 839         cfg.t.cfg.s.snDLSAP.tmr.t23.val         = k->mtp3.t23;
 840         cfg.t.cfg.s.snDLSAP.tmr.t24.enb         = TRUE;                                 /* t24 - stabilizing timer */
 841         cfg.t.cfg.s.snDLSAP.tmr.t24.val         = k->mtp3.t24;
 842         cfg.t.cfg.s.snDLSAP.tmr.t31.enb         = TRUE;                                 /* t31 - BSN requested timer */
 843         cfg.t.cfg.s.snDLSAP.tmr.t31.val         = k->mtp3.t31;
 844         cfg.t.cfg.s.snDLSAP.tmr.t32.enb         = TRUE;                                 /* t32 - SLT timer */
 845         cfg.t.cfg.s.snDLSAP.tmr.t32.val         = k->mtp3.t32;
 846         cfg.t.cfg.s.snDLSAP.tmr.t33.enb         = TRUE;                                 /* t33 - connecting timer */
 847         cfg.t.cfg.s.snDLSAP.tmr.t33.val         = k->mtp3.t33;
 848         cfg.t.cfg.s.snDLSAP.tmr.t34.enb         = TRUE;                                 /* t34 - periodic signalling link test timer */
 849         cfg.t.cfg.s.snDLSAP.tmr.t34.val         = k->mtp3.t34;
 850 #if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || defined(TDS_ROLL_UPGRADE_SUPPORT))
 851         cfg.t.cfg.s.snDLSAP.tmr.t35.enb         = TRUE;                                 /* t35 - false link congestion timer, same as t31 of ANSI'96*/
 852         cfg.t.cfg.s.snDLSAP.tmr.t35.val         = k->mtp3.t35;
 853         cfg.t.cfg.s.snDLSAP.tmr.t36.enb         = TRUE;                                 /* t36 - false link congestion timer, same as t33 of ANSI'96*/
 854         cfg.t.cfg.s.snDLSAP.tmr.t36.val         = k->mtp3.t36;  
 855         cfg.t.cfg.s.snDLSAP.tmr.t37.enb         = TRUE;                                 /* t37 - false link congestion timer, same as t34 of ANSI'96*/
 856         cfg.t.cfg.s.snDLSAP.tmr.t37.val         = k->mtp3.t37;
 857         cfg.t.cfg.s.snDLSAP.tmr.tCraft.enb      = TRUE;                                 /* link referral craft timer - T19 in ANSI */
 858         cfg.t.cfg.s.snDLSAP.tmr.tCraft.val      = k->mtp3.tcraft;
 859 #endif
 860 #ifdef SDT2
 861         cfg.t.cfg.s.snDLSAP.tmr.tFlc.enb        = TRUE;                                 /* flow control timer */
 862         cfg.t.cfg.s.snDLSAP.tmr.tFlc.val        = 300;
 863         cfg.t.cfg.s.snDLSAP.tmr.tBnd.enb        = TRUE;                                 /* bind request timer */
 864         cfg.t.cfg.s.snDLSAP.tmr.tBnd.val        = 20;
 865 #endif /* SDT2 */
 866 #ifdef TDS_ROLL_UPGRADE_SUPPORT
 867         cfg.t.cfg.s.snDLSAP.remIntfValid        = FALSE;                                /* remote interface version is valid */
 868         cfg.t.cfg.s.snDLSAP.remIntfVer          = SNTIFVER;                             /* remote interface version */
 869 #endif
 870 
 871         return(sng_cfg_mtp3(&pst, &cfg));
 872 }
 873 
 874 /******************************************************************************/
 875 int ftmod_ss7_mtp3_nsap_config(int id)
 876 {
 877         Pst                     pst;
 878         SnMngmt         cfg;
 879         sng_nsap_t      *k = &g_ftdm_sngss7_data.cfg.nsap[id];
 880 
 881         /* initalize the post structure */
 882         smPstInit(&pst);
 883 
 884         /* insert the destination Entity */
 885         pst.dstEnt = ENTSN;
 886 
 887         /*clear the configuration structure*/
 888         memset(&cfg, 0x0, sizeof(SnMngmt));
 889 
 890         /*fill in some general sections of the header*/
 891         smHdrInit(&cfg.hdr);
 892 
 893         /*fill in the specific fields of the header*/
 894         cfg.hdr.msgType                                 = TCFG;
 895         cfg.hdr.entId.ent                               = ENTSN;
 896         cfg.hdr.entId.inst                              = S_INST;
 897         cfg.hdr.elmId.elmnt                     = STNSAP;
 898 
 899         cfg.hdr.elmId.elmntInst1                = k->spId;
 900 
 901         cfg.t.cfg.s.snNSAP.ssf                  = k->ssf;                       /* sub service field */
 902         cfg.t.cfg.s.snNSAP.lnkType              = k->linkType;          /* link type -ANSI, ITU, CHINA or BICI */
 903         cfg.t.cfg.s.snNSAP.upSwtch              = k->switchType;        /* user part switch type */
 904         cfg.t.cfg.s.snNSAP.selector             = 0;                            /* upper layer selector */
 905         cfg.t.cfg.s.snNSAP.mem.region   = S_REG;                        /* memory region id */
 906         cfg.t.cfg.s.snNSAP.mem.pool             = S_POOL;                       /* memory pool id */
 907         cfg.t.cfg.s.snNSAP.prior                = PRIOR0;                       /* priority */
 908         cfg.t.cfg.s.snNSAP.route                = RTESPEC;                      /* route */
 909 #if( SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || SS7_CHINA )
 910         cfg.t.cfg.s.snNSAP.dpcLen               = DPC24;                        /* dpc length 14 or 24 bits */
 911 #else
 912         cfg.t.cfg.s.snNSAP.dpcLen               = DPC14;                        /* dpc length 14 or 24 bits */
 913 #endif
 914 #if (defined(SN_SG) || defined(TDS_ROLL_UPGRADE_SUPPORT))
 915         cfg.t.cfg.s.snNSAP.usrParts             = ;                                     /* user parts configured on self postatic int code on IP side */ 
 916 #endif
 917 #ifdef TDS_ROLL_UPGRADE_SUPPORT
 918         cfg.t.cfg.s.snNSAP.remIntfValid = FALSE;                        /* remote interface version is valid */
 919         cfg.t.cfg.s.snNSAP.remIntfVer   = SNTIFVER;                     /* remote interface version */
 920 #endif
 921 
 922         return(sng_cfg_mtp3(&pst, &cfg));
 923 }
 924 
 925 /******************************************************************************/
 926 int ftmod_ss7_mtp3_linkset_config(int id)
 927 {
 928         Pst                             pst;
 929         SnMngmt                 cfg;
 930         int                             c;
 931         sng_link_set_t  *k = &g_ftdm_sngss7_data.cfg.mtpLinkSet[id];
 932 
 933         /* initalize the post structure */
 934         smPstInit(&pst);
 935 
 936         /* insert the destination Entity */
 937         pst.dstEnt = ENTSN;
 938 
 939         /*clear the configuration structure*/
 940         memset(&cfg, 0x0, sizeof(SnMngmt));
 941 
 942         /*fill in some general sections of the header*/
 943         smHdrInit(&cfg.hdr);
 944 
 945         /*fill in the specific fields of the header*/
 946         cfg.hdr.msgType                                         = TCFG;
 947         cfg.hdr.entId.ent                                       = ENTSN;
 948         cfg.hdr.entId.inst                                      = S_INST;
 949         cfg.hdr.elmId.elmnt                             = STLNKSET;              /* link set */
 950 
 951         cfg.hdr.elmId.elmntInst1                        = k->id;
 952 
 953         cfg.t.cfg.s.snLnkSet.lnkSetId           = k->id;                        /* link set ID */
 954         cfg.t.cfg.s.snLnkSet.lnkSetType         = k->linkType;          /* link type */
 955         cfg.t.cfg.s.snLnkSet.adjDpc                     = k->apc;                       /* adjacent DPC */
 956         cfg.t.cfg.s.snLnkSet.nmbActLnkReqd      = k->minActive;         /* minimum number of active links */
 957         cfg.t.cfg.s.snLnkSet.nmbCmbLnkSet       = k->numLinks;                          /* number of combined link sets */
 958         for(c = 0; c < k->numLinks;c++) {
 959                 cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].cmbLnkSetId = k->links[c];
 960                 cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].lnkSetPrior = 0;
 961         }
 962 
 963 
 964         return(sng_cfg_mtp3(&pst, &cfg));
 965 }
 966 
 967 /******************************************************************************/
 968 int ftmod_ss7_mtp3_route_config(int id)
 969 {
 970         Pst                     pst;
 971         SnMngmt         cfg;
 972         sng_route_t     *k = &g_ftdm_sngss7_data.cfg.mtpRoute[id];
 973 
 974         /* initalize the post structure */
 975         smPstInit(&pst);
 976 
 977         /* insert the destination Entity */
 978         pst.dstEnt = ENTSN;
 979 
 980         /*clear the configuration structure*/
 981         memset(&cfg, 0x0, sizeof(SnMngmt));
 982 
 983         /*fill in some general sections of the header*/
 984         smHdrInit(&cfg.hdr);
 985 
 986         /*fill in the specific fields of the header*/
 987         cfg.hdr.msgType                                         = TCFG;
 988         cfg.hdr.entId.ent                                       = ENTSN;
 989         cfg.hdr.entId.inst                                      = S_INST;
 990         cfg.hdr.elmId.elmnt                             = STROUT;
 991 
 992         cfg.hdr.elmId.elmntInst1                        = k->id;
 993 
 994         cfg.t.cfg.s.snRout.dpc                          = k->dpc;                                       /* destination postatic int code */
 995         cfg.t.cfg.s.snRout.spType                       = LSN_TYPE_SP;                          /* signalling postatic int type */
 996         cfg.t.cfg.s.snRout.swtchType            = k->linkType;                          /* switch type */
 997         cfg.t.cfg.s.snRout.upSwtch                      = k->switchType;                        /* user part switch type */
 998         cfg.t.cfg.s.snRout.cmbLnkSetId          = k->cmbLinkSetId;                      /* combined link set ID */
 999         if (k->id == 0) {
1000                 cfg.t.cfg.s.snRout.dir                          = LSN_RTE_UP;                           /* direction */
1001         } else {
1002                 cfg.t.cfg.s.snRout.dir                          = LSN_RTE_DN;                           /* direction */
1003         }
1004         cfg.t.cfg.s.snRout.rteToAdjSp           = 0;                                            /* flag indicating this route to adjacent SP */ 
1005         cfg.t.cfg.s.snRout.ssf                          = k->ssf;                                       /* sub service field */
1006         cfg.t.cfg.s.snRout.brdcastFlg           = TRUE;                                         /* flag indicating to have TFP broadcast */
1007         if (cfg.t.cfg.s.snRout.swtchType == LSN_SW_ITU) {
1008                 cfg.t.cfg.s.snRout.rstReq               = LSN_ITU92_RST;                        /* Restart type supported by the node */
1009         } else if ((cfg.t.cfg.s.snRout.swtchType == LSN_SW_ANS) ||
1010                            (cfg.t.cfg.s.snRout.swtchType == LSN_SW_ANS96)) {
1011                 cfg.t.cfg.s.snRout.rstReq               = LSN_ANS_RST;                  /* Restart type supported by the node */
1012         } else {
1013                 cfg.t.cfg.s.snRout.rstReq               = LSN_NO_RST;                   /* Restart type supported by the node */
1014         }
1015         if ((cfg.t.cfg.s.snRout.swtchType == LSN_SW_ITU) || 
1016                 (cfg.t.cfg.s.snRout.swtchType == LSN_SW_CHINA) || 
1017                 (cfg.t.cfg.s.snRout.swtchType == LSN_SW_BICI)) {
1018                 cfg.t.cfg.s.snRout.slsRange             = LSN_ITU_SLS_RANGE;            /* max value of SLS for this DPC */
1019         } else {
1020                 cfg.t.cfg.s.snRout.slsRange             = LSN_ANSI_5BIT_SLS_RANGE;      /* max value of SLS for this DPC */
1021         }
1022         cfg.t.cfg.s.snRout.lsetSel                      = 0x1;                                          /* linkset selection bit in SLS for STP */
1023         cfg.t.cfg.s.snRout.multiMsgPrior        = FALSE;                                        /* TRUE if multiple cong priorities of messages */
1024         cfg.t.cfg.s.snRout.rctReq                       = TRUE;                                         /* route set congestion test required or not */
1025         cfg.t.cfg.s.snRout.slsLnk                       = FALSE;
1026 #ifdef LSNV2
1027 # if (SS7_NTT || defined(TDS_ROLL_UPGRADE_SUPPORT))
1028         cfg.t.cfg.s.snRout.destSpec                     =;                                                      /* destination specfication A or B*/ 
1029 # endif  
1030 #endif  
1031 #if (defined(LSNV3) || defined(SN_MULTIPLE_NETWORK_RESTART))
1032         cfg.t.cfg.s.snRout.tfrReq                       =;                                                      /* TFR procedure required or not */
1033 #endif
1034         cfg.t.cfg.s.snRout.tmr.t6.enb           = TRUE;
1035         cfg.t.cfg.s.snRout.tmr.t6.val           = k->t6;
1036         cfg.t.cfg.s.snRout.tmr.t8.enb           = TRUE;                                         /* t8 - transfer prohibited inhibition timer */
1037         cfg.t.cfg.s.snRout.tmr.t8.val           = k->t8;
1038         cfg.t.cfg.s.snRout.tmr.t10.enb          = TRUE;                                         /* t10 - waiting to repeat route set test */
1039         cfg.t.cfg.s.snRout.tmr.t10.val          = k->t10;
1040         cfg.t.cfg.s.snRout.tmr.t11.enb          = TRUE;                                         /* t11 - transfer restrict timer */
1041         cfg.t.cfg.s.snRout.tmr.t11.val          = k->t11;
1042         cfg.t.cfg.s.snRout.tmr.t19.enb          = TRUE;                                         /* t19 - TRA sent timer */
1043         cfg.t.cfg.s.snRout.tmr.t19.val          = k->t19;
1044         cfg.t.cfg.s.snRout.tmr.t21.enb          = TRUE;                                         /* t21 - waiting to restart traffic routed through adjacent SP */
1045         cfg.t.cfg.s.snRout.tmr.t21.val          = k->t21;
1046 
1047 #if (defined(LSNV3) || defined(SN_MULTIPLE_NETWORK_RESTART))
1048         cfg.t.cfg.s.snRout.tmr.t15.enb          = TRUE;                                         /* t15 - waiting to start route set congestion test */
1049         cfg.t.cfg.s.snRout.tmr.t15.val          = k->t15;
1050         cfg.t.cfg.s.snRout.tmr.t16.enb          = TRUE;                                         /* t16 - waiting for route set congestion status update */
1051         cfg.t.cfg.s.snRout.tmr.t16.val          = k->t16;
1052         cfg.t.cfg.s.snRout.tmr.t18.enb          = TRUE;                                         /* t18 - transfer prohibited inhibition timer */
1053         cfg.t.cfg.s.snRout.tmr.t18.val          = k->t18;
1054 # if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || defined(TDS_ROLL_UPGRADE_SUPPORT))
1055         cfg.t.cfg.s.snRout.tmr.t25.enb          = TRUE;                                         /* t25 - waiting to traffic resatrt allowed message for ANSI */
1056         cfg.t.cfg.s.snRout.tmr.t25.val          = k->t25;
1057         cfg.t.cfg.s.snRout.tmr.t26.enb          = TRUE;                                         /* t26 - waiting to repeat traffic restart waiting message for ANSI */
1058         cfg.t.cfg.s.snRout.tmr.t26.val          = k->t26;
1059 # endif
1060 #endif
1061 #if (SS7_TTC || SS7_NTT || defined(TDS_ROLL_UPGRADE_SUPPORT))
1062         cfg.t.cfg.s.snRout.tmr.tc.enb           = TRUE;                                         /* tc - Waiting for congestion abatement */
1063         cfg.t.cfg.s.snRout.tmr.tc.val           = k->tc;
1064 #endif
1065 #if (defined(SN_SG) || defined(TDS_ROLL_UPGRADE_SUPPORT))
1066         cfg.t.cfg.s.snRout.tmr.tQry.enb         = TRUE;                                         /* Periodic query timer over the NIF */
1067         cfg.t.cfg.s.snRout.tmr.tQry.val         = k->tqry;
1068 #endif
1069 
1070         return(sng_cfg_mtp3(&pst, &cfg));
1071 }
1072 
1073 /******************************************************************************/
1074 int ftmod_ss7_isup_nsap_config(int id)
1075 {
1076         SiMngmt  cfg;
1077         Pst              pst;
1078         sng_nsap_t      *k = &g_ftdm_sngss7_data.cfg.nsap[id];
1079 
1080         /* initalize the post structure */
1081         smPstInit(&pst);
1082 
1083         /* insert the destination Entity */
1084         pst.dstEnt = ENTSI;
1085 
1086         /*clear the configuration structure*/
1087         memset(&cfg, 0x0, sizeof(SiMngmt));
1088 
1089         /*fill in some general sections of the header*/
1090         smHdrInit(&cfg.hdr);
1091 
1092         /*fill in the specific fields of the header*/
1093         cfg.hdr.msgType                                 = TCFG;
1094         cfg.hdr.entId.ent                               = ENTSI;
1095         cfg.hdr.entId.inst                              = S_INST;
1096         cfg.hdr.elmId.elmnt                     = STNSAP;
1097 
1098         cfg.hdr.elmId.elmntInst1                = k->id;
1099 
1100 #if (SI_LMINT3 || SMSI_LMINT3)
1101         cfg.t.cfg.s.siNSap.nsapId               = k->id;                        /* Id of the NSAP being configured */
1102 #endif
1103         cfg.t.cfg.s.siNSap.nwId                 = k->nwId;                      /* Network Id */
1104         cfg.t.cfg.s.siNSap.spId                 = k->spId;                      /* service providor id */
1105         cfg.t.cfg.s.siNSap.ssf                  = k->ssf;                       /* sub service field */
1106         cfg.t.cfg.s.siNSap.dstEnt               = ENTSN;                        /* entity */
1107         cfg.t.cfg.s.siNSap.dstInst              = S_INST;                       /* instance */
1108         cfg.t.cfg.s.siNSap.prior                = PRIOR0;                       /* priority */
1109         cfg.t.cfg.s.siNSap.route                = RTESPEC;                      /* route */
1110         cfg.t.cfg.s.siNSap.dstProcId    = SFndProcId();         /* destination processor id */
1111         cfg.t.cfg.s.siNSap.sapType              = SAP_MTP;                      /* sap type */
1112         cfg.t.cfg.s.siNSap.selector             = 0;                            /* selector */
1113         cfg.t.cfg.s.siNSap.tINT.enb             = TRUE;                         /* interface (Bind Confirm) timer */
1114         cfg.t.cfg.s.siNSap.tINT.val             = 50;
1115         cfg.t.cfg.s.siNSap.mem.region   = S_REG;                        /* memory region & pool id */
1116         cfg.t.cfg.s.siNSap.mem.pool             = S_POOL;
1117 
1118 #ifdef TDS_ROLL_UPGRADE_SUPPORT
1119         cfg.t.cfg.s.siNSap.remIntfValid = FALSE;        /* remote interface version is valid */
1120         cfg.t.cfg.s.siNSap.remIntfVer;                   /* remote interface version */
1121 #endif
1122 
1123         return(sng_cfg_isup(&pst, &cfg));
1124 }
1125 
1126 /******************************************************************************/
1127 int ftmod_ss7_isup_intf_config(int id)
1128 {
1129         SiMngmt  cfg;
1130         Pst              pst;
1131         sng_isup_inf_t *k = &g_ftdm_sngss7_data.cfg.isupIntf[id];
1132 
1133         /* initalize the post structure */
1134         smPstInit(&pst);
1135 
1136         /* insert the destination Entity */
1137         pst.dstEnt = ENTSI;
1138 
1139         /*clear the configuration structure*/
1140         memset(&cfg, 0x0, sizeof(SiMngmt));
1141 
1142         /*fill in some general sections of the header*/
1143         smHdrInit(&cfg.hdr);
1144 
1145         /*fill in the specific fields of the header*/
1146         cfg.hdr.msgType                                                         = TCFG;
1147         cfg.hdr.entId.ent                                                       = ENTSI;
1148         cfg.hdr.entId.inst                                                      = S_INST;
1149         cfg.hdr.elmId.elmnt                                             = SI_STINTF;
1150 
1151         cfg.hdr.elmId.elmntInst1                                        = k->id;
1152 
1153         cfg.t.cfg.s.siIntfCb.intfId                                     = k->id;                                /* Interface id */
1154         cfg.t.cfg.s.siIntfCb.nwId                                       = k->nwId;                              /* Network Id */
1155         cfg.t.cfg.s.siIntfCb.sapId                                      = k->isap;                              /* Id of the Upper ISUP SAP */
1156         cfg.t.cfg.s.siIntfCb.opc                                        = k->spc;                               /* physical originating postatic int code */
1157         cfg.t.cfg.s.siIntfCb.phyDpc                                     = k->dpc;                               /* physical destination postatic int code */
1158         cfg.t.cfg.s.siIntfCb.swtch                                      = k->switchType;                /* Protocol Switch */
1159         cfg.t.cfg.s.siIntfCb.ssf                                        = k->ssf;                               /* subsystem service information */
1160         cfg.t.cfg.s.siIntfCb.pauseActn                          = SI_PAUSE_CLRTRAN;             /* call clearing behavior upon rx. PAUSE */
1161         cfg.t.cfg.s.siIntfCb.dpcCbTmr.t4.enb            = TRUE;                                 /* t4 timer - user part test sent */
1162         cfg.t.cfg.s.siIntfCb.dpcCbTmr.t4.val            = k->t4;
1163         cfg.t.cfg.s.siIntfCb.dpcCbTmr.tPAUSE.enb        = TRUE;                                 /* waiting for PAUSE to be effective */
1164         cfg.t.cfg.s.siIntfCb.dpcCbTmr.tPAUSE.val        = k->tpause;
1165         cfg.t.cfg.s.siIntfCb.dpcCbTmr.tSTAENQ.enb       = TRUE;                                 /* status enquiry timer */
1166         cfg.t.cfg.s.siIntfCb.dpcCbTmr.tSTAENQ.val       = k->tstaenq;
1167 #if SS7_ANS95
1168         cfg.t.cfg.s.siIntfCb.availTest                          = FALSE;                                /* circuit validation test */
1169 #endif
1170 #if (SS7_ITU97 || SS7_ETSIV3 || SS7_UK || SS7_NZL || SS7_ITU2000 || SS7_KZ)
1171         cfg.t.cfg.s.siIntfCb.checkTable                         = LSI_CHKTBLE_MRATE;    /* Validation flag for Table 3 p1/p2 Q.763 */
1172 #endif
1173 #if (SS7_ANS95 || SS7_ITU97 || SS7_ETSIV3 || SS7_UK || SS7_NZL || SS7_ITU2000 || SS7_KZ)
1174         switch (k->switchType) {
1175         case LSI_SW_TST:
1176         case LSI_SW_ITU:
1177         case LSI_SW_ITU97:
1178         case LSI_SW_ITU2000:
1179         case LSI_SW_ETSI:
1180         case LSI_SW_ETSIV3:
1181         case LSI_SW_RUSSIA:
1182         case LSI_SW_RUSS2000:
1183         case LSI_SW_INDIA:
1184         case LSI_SW_CHINA:
1185                 cfg.t.cfg.s.siIntfCb.trunkType                  = TRUE;                                 /* truck type E1(TRUE)/T1(FALSE) at intf */
1186                 break;
1187         case LSI_SW_ANS88:
1188         case LSI_SW_ANS92:
1189         case LSI_SW_ANS95:
1190         case LSI_SW_BELL:
1191                 cfg.t.cfg.s.siIntfCb.trunkType                  = FALSE;                                /* truck type E1(TRUE)/T1(FALSE) at intf */
1192                 break;
1193         }
1194 
1195 #endif
1196 #if (LSIV4 || LSIV5)
1197         cfg.t.cfg.s.siIntfCb.lnkSelOpt                          = LSI_LINSEK_CIC;               /* link select option */
1198 # if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL)
1199         cfg.t.cfg.s.siIntfCb.lnkSelBits                         = LSI_LNKSEL_8BITS;             /* number of bits for link selection */
1200 # endif
1201 #endif
1202 
1203         return(sng_cfg_isup(&pst, &cfg));
1204 }
1205 
1206 /******************************************************************************/
1207 int ftmod_ss7_isup_ckt_config(int id)
1208 {
1209         SiMngmt                  cfg;
1210         Pst                              pst;
1211         U32                              tmp_flag;
1212         sng_isup_ckt_t  *k = &g_ftdm_sngss7_data.cfg.isupCkt[id];
1213 
1214         /* initalize the post structure */
1215         smPstInit(&pst);
1216 
1217         /* insert the destination Entity */
1218         pst.dstEnt = ENTSI;
1219 
1220         /*clear the configuration structure*/
1221         memset(&cfg, 0x0, sizeof(SiMngmt));
1222 
1223         /*fill in some general sections of the header*/
1224         smHdrInit(&cfg.hdr);
1225 
1226         /*fill in the specific fields of the header*/
1227         cfg.hdr.msgType                                         = TCFG;
1228         cfg.hdr.entId.ent                                       = ENTSI;
1229         cfg.hdr.entId.inst                                      = S_INST;
1230         cfg.hdr.elmId.elmnt                                     = STICIR;
1231 
1232         cfg.hdr.elmId.elmntInst1                        = k->id;
1233 
1234         cfg.t.cfg.s.siCir.cirId                         = k->id;                        /* circuit id code                                               */
1235         cfg.t.cfg.s.siCir.cic                           = k->cic;                       /* cic                                                                   */
1236         cfg.t.cfg.s.siCir.intfId                        = k->infId;                     /* interface id                                                  */
1237         cfg.t.cfg.s.siCir.typeCntrl                     = k->typeCntrl;         /* type of control                                               */
1238         cfg.t.cfg.s.siCir.contReq                       = FALSE;                        /* continuity check required                            */
1239 #if (SI_218_COMP || SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL)
1240         cfg.t.cfg.s.siCir.firstCic                      = 1;                                    /* First cic in the circuit group                 */
1241         cfg.t.cfg.s.siCir.numCir                        = 24;                                   /* Number of circuits in the circuit group */
1242         cfg.t.cfg.s.siCir.nonSS7Con                     = TRUE;                         /* connecting to non SS7 network                        */
1243         cfg.t.cfg.s.siCir.outTrkGrpN.length     = 0;                                    /* outgoing trunk group number (For EXM)        */
1244         cfg.t.cfg.s.siCir.cvrTrkClli.length     = 0;                                    /* Trunk Group number (For CVR validation) */
1245         cfg.t.cfg.s.siCir.clli.length           = 0;                                    /* common language location identifier   */
1246 #endif
1247         cfg.t.cfg.s.siCir.cirTmr.t3.enb         = TRUE;                         /* t3 timer - overload received                 */
1248         cfg.t.cfg.s.siCir.cirTmr.t3.val         = k->t3;
1249         cfg.t.cfg.s.siCir.cirTmr.t12.enb        = TRUE;                         /* t12 timer - blocking sent                            */
1250         cfg.t.cfg.s.siCir.cirTmr.t12.val        = k->t12;
1251         cfg.t.cfg.s.siCir.cirTmr.t13.enb        = TRUE;                         /* t13 timer - initial blocking sent            */
1252         cfg.t.cfg.s.siCir.cirTmr.t13.val        = k->t13;
1253         cfg.t.cfg.s.siCir.cirTmr.t14.enb        = TRUE;                         /* t14 timer - unblocking sent                   */
1254         cfg.t.cfg.s.siCir.cirTmr.t14.val        = k->t14;
1255         cfg.t.cfg.s.siCir.cirTmr.t15.enb        = TRUE;                         /* t15 timer - initial unblocking sent   */
1256         cfg.t.cfg.s.siCir.cirTmr.t15.val        = k->t15;
1257         cfg.t.cfg.s.siCir.cirTmr.t16.enb        = TRUE;                         /* t16 timer - reset sent                                 */
1258         cfg.t.cfg.s.siCir.cirTmr.t16.val        = k->t16;
1259         cfg.t.cfg.s.siCir.cirTmr.t17.enb        = TRUE;                         /* t17 timer - initial reset sent                 */
1260         cfg.t.cfg.s.siCir.cirTmr.t17.val        = k->t17;
1261 #if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL)
1262         cfg.t.cfg.s.siCir.cirTmr.tVal.enb       = TRUE;                         /* circuit validation timer                              */
1263         cfg.t.cfg.s.siCir.cirTmr.tVal.val       = k->tval;
1264 #endif
1265 #if (SS7_ANS95 || SS7_ITU97 || SS7_ETSIV3 || SS7_UK)
1266         tmp_flag = 0x0;
1267         /* bit 0 - 4 is the timeslot on the span for this circuit */
1268         tmp_flag = ( 1 );
1269 
1270         /* bit 5 -> can this timeslot be used for contigous M-rate call */
1271         tmp_flag |= !(0x20);
1272 
1273         /* bit 6 -> does this timeslot support contigous M-rate call */
1274         tmp_flag |= !(0x40);
1275 
1276         cfg.t.cfg.s.siCir.slotId                = tmp_flag ;             /* physical slot id bit wise flag                */
1277         cfg.t.cfg.s.siCir.ctrlMult              = 0;                            /* Controller for multirate calls                 */
1278 #endif
1279 
1280         tmp_flag = 0x0;
1281         /* bit 0 -> ANSI international support or national support */
1282         tmp_flag = k->ssf;
1283 
1284         /* bit 1 -> confusion message on */
1285         tmp_flag |= LSI_CIRFLG_CFN_ON;
1286 
1287         /*bit 2-3 -> circuit group carrier information */
1288         tmp_flag |= LSI_CFCI_ANALDIG;
1289 
1290         /*bit 4-5 -> alarm carrier */
1291         tmp_flag |= LSI_CFAC_UNKNOWN;
1292 
1293         /*bit 6-7 -> continuity check requirement*/
1294         tmp_flag |= LSI_CFCO_NONE;
1295 
1296         cfg.t.cfg.s.siCir.cirFlg                = tmp_flag;              /* Flag indicating diff cfg options for ckt */
1297 
1298         return(sng_cfg_isup(&pst, &cfg));
1299 }
1300 
1301 /******************************************************************************/
1302 int ftmod_ss7_isup_isap_config(int id)
1303 {
1304         SiMngmt          cfg;
1305         Pst                      pst;
1306         sng_isap_t      *k = &g_ftdm_sngss7_data.cfg.isap[id];
1307 
1308         /* initalize the post structure */
1309         smPstInit(&pst);
1310 
1311         /* insert the destination Entity */
1312         pst.dstEnt = ENTSI;
1313 
1314         /*clear the configuration structure*/
1315         memset(&cfg, 0x0, sizeof(SiMngmt));
1316 
1317         /*fill in some general sections of the header*/
1318         smHdrInit(&cfg.hdr);
1319 
1320         /*fill in the specific fields of the header*/
1321         cfg.hdr.msgType                                                 = TCFG;
1322         cfg.hdr.entId.ent                                               = ENTSI;
1323         cfg.hdr.entId.inst                                              = S_INST;
1324         cfg.hdr.elmId.elmnt                                     = STISAP;
1325 
1326         cfg.hdr.elmId.elmntInst1                                = k->id;
1327 
1328 #if (SI_LMINT3 || SMSI_LMINT3)
1329         cfg.t.cfg.s.siSap.sapId                                 = k->id;                                        /* Id of the SAP being configured */
1330 #endif
1331         cfg.t.cfg.s.siSap.swtch                                 = k->switchType;                        /* Protocol Switch */
1332         cfg.t.cfg.s.siSap.ssf                                   = k->ssf;                                       /* Sub service field */
1333         cfg.t.cfg.s.siSap.sidIns                                = FALSE;                                        /* SID insertion Flag */
1334         cfg.t.cfg.s.siSap.sidVer                                = FALSE;                                        /* SID verification Flag */
1335         if ( cfg.t.cfg.s.siSap.sidIns == TRUE ) {                                                       /* SID */
1336                 #if 0
1337                 cfg.t.cfg.s.siSap.sid                           =;
1338                 cfg.t.cfg.s.siSap.natAddrInd            =;                                                      /* SID Nature of Addres Indicator */
1339                 cfg.t.cfg.s.siSap.sidNPlan                      =;                                                      /* SID Numbering Plan */
1340                 cfg.t.cfg.s.siSap.sidPresInd            =;                                                      /* default presentation indicator */
1341                 cfg.t.cfg.s.siSap.incSidPresRes         =;                                                      /* Presentation Restriction of incoming SID */
1342                 cfg.t.cfg.s.siSap.sidPresRes            =;                                                      /* Presentation Restriction */
1343                 #endif
1344         } else {
1345                 cfg.t.cfg.s.siSap.sid.length    = 0;
1346                 /*cfg.t.cfg.s.siSap.sid.strg[0]  =*/
1347                 cfg.t.cfg.s.siSap.natAddrInd            = ADDR_NOTPRSNT;                        /* SID Nature of Addres Indicator */
1348                 cfg.t.cfg.s.siSap.sidNPlan                      = NP_ISDN;                                      /* SID Numbering Plan */
1349                 cfg.t.cfg.s.siSap.sidPresInd            = FALSE;                                        /* default presentation indicator */
1350                 cfg.t.cfg.s.siSap.incSidPresRes         = TRUE;                                         /* Presentation Restriction of incoming SID */
1351                 cfg.t.cfg.s.siSap.sidPresRes            = 0;                                            /* Presentation Restriction */
1352         }
1353         cfg.t.cfg.s.siSap.reqOpt                                = FALSE;                                        /* Request option */
1354         cfg.t.cfg.s.siSap.allCallMod                    = TRUE;                                         /* call modification allowed flag */
1355         cfg.t.cfg.s.siSap.maxLenU2U                             = MAX_SI_USER_2_USER_LEN;       /* Max length of user to user messages */
1356         cfg.t.cfg.s.siSap.passOnFlag                    = TRUE;                                         /* flag for passing unknown par/msg */
1357         cfg.t.cfg.s.siSap.relLocation                   = ILOC_PRIVNETLU;                       /* release location indicator in cause val */
1358         cfg.t.cfg.s.siSap.prior                                 = PRIOR0;                                       /* priority */
1359         cfg.t.cfg.s.siSap.route                                 = RTESPEC;                                      /* route */
1360         cfg.t.cfg.s.siSap.selector                              = 0;                                            /* selector */
1361         cfg.t.cfg.s.siSap.mem.region                    = S_REG;                                        /* memory region & pool id */
1362         cfg.t.cfg.s.siSap.mem.pool                              = S_POOL;                                       /* memory region & pool id */
1363 
1364         cfg.t.cfg.s.siSap.tmr.t1.enb                    = TRUE;                                         /* t1 timer - release sent                               */
1365         cfg.t.cfg.s.siSap.tmr.t1.val                    = k->t1;
1366         cfg.t.cfg.s.siSap.tmr.t2.enb                    = TRUE;                                         /* t2 timer - suspend received                   */
1367         cfg.t.cfg.s.siSap.tmr.t2.val                    = k->t2;
1368         cfg.t.cfg.s.siSap.tmr.t5.enb                    = TRUE;                                         /* t5 timer - initial release sent               */
1369         cfg.t.cfg.s.siSap.tmr.t5.val                    = k->t5;
1370         cfg.t.cfg.s.siSap.tmr.t6.enb                    = TRUE;                                         /* t6 timer - suspend received                   */
1371         cfg.t.cfg.s.siSap.tmr.t6.val                    = k->t6;
1372         cfg.t.cfg.s.siSap.tmr.t7.enb                    = TRUE;                                         /* t7 timer - latest address sent                 */
1373         cfg.t.cfg.s.siSap.tmr.t7.val                    = k->t7;
1374         cfg.t.cfg.s.siSap.tmr.t8.enb                    = TRUE;                                         /* t8 timer - initial address received   */
1375         cfg.t.cfg.s.siSap.tmr.t8.val                    = k->t8;
1376         cfg.t.cfg.s.siSap.tmr.t9.enb                    = TRUE;                                         /* t9 timer - latest address sent after ACM */
1377         cfg.t.cfg.s.siSap.tmr.t9.val                    = k->t9;
1378         cfg.t.cfg.s.siSap.tmr.t27.enb                   = TRUE;                                         /* t27 timer - wait. for continuity recheck */
1379         cfg.t.cfg.s.siSap.tmr.t27.val                   = k->t27;
1380         cfg.t.cfg.s.siSap.tmr.t31.enb                   = TRUE;                                         /* t31 timer - call reference frozen period */
1381         cfg.t.cfg.s.siSap.tmr.t31.val                   = k->t31;
1382         cfg.t.cfg.s.siSap.tmr.t33.enb                   = TRUE;                                         /* t33 timer - INR sent                                  */
1383         cfg.t.cfg.s.siSap.tmr.t33.val                   = k->t33;
1384         cfg.t.cfg.s.siSap.tmr.t34.enb                   = TRUE;                                         /* t34 timer - wait. for continuity after recheck */
1385         cfg.t.cfg.s.siSap.tmr.t34.val                   = k->t34;
1386         cfg.t.cfg.s.siSap.tmr.t36.enb                   = TRUE;                                         /* waiting SGM                                                   */
1387         cfg.t.cfg.s.siSap.tmr.t36.val                   = k->t36;
1388         cfg.t.cfg.s.siSap.tmr.tCCR.enb                  = TRUE;                                         /* tCCR timer - continuity recheck timer        */
1389         cfg.t.cfg.s.siSap.tmr.tCCR.val                  = k->tccr;
1390         cfg.t.cfg.s.siSap.tmr.tRELRSP.enb               = TRUE;                                         /* waiting for release response                  */
1391         cfg.t.cfg.s.siSap.tmr.tRELRSP.val               = k->trelrsp;
1392         cfg.t.cfg.s.siSap.tmr.tFNLRELRSP.enb    = TRUE;                                         /* waiting for final release response     */
1393         cfg.t.cfg.s.siSap.tmr.tFNLRELRSP.val    = k->tfnlrelrsp;
1394 #if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL)
1395         cfg.t.cfg.s.siSap.tmr.tEx.enb                   = TRUE;                                         /* tEx timer - Exit to be sent                   */
1396         cfg.t.cfg.s.siSap.tmr.tEx.val                   = k->tex;
1397         cfg.t.cfg.s.siSap.tmr.tCCRt.enb                 = TRUE;                                         /* tCCR timer (o/g side) - continuity recheck timer */
1398         cfg.t.cfg.s.siSap.tmr.tCCRt.val                 = k->tccrt;
1399 #endif
1400 #if (SS7_ANS92 || SS7_ANS95 || SS7_BELL)
1401         cfg.t.cfg.s.siSap.tmr.tCRM.enb                  = TRUE;                                         /* circuit reservation message timer            */
1402         cfg.t.cfg.s.siSap.tmr.tCRM.val                  = k->tcrm;
1403         cfg.t.cfg.s.siSap.tmr.tCRA.enb                  = TRUE;                                         /* circuit reservation ack. timer                */
1404         cfg.t.cfg.s.siSap.tmr.tCRA.val                  = k->tcra;
1405 #endif
1406 #if (SS7_ETSI || SS7_ITU97 || SS7_ETSIV3 || SS7_UK || SS7_NZL || SS7_KZ)
1407         cfg.t.cfg.s.siSap.tmr.tECT.enb                  = TRUE;                                         /* Explicit Call Transfer - waiting for loop prvnt rsp */
1408         cfg.t.cfg.s.siSap.tmr.tECT.val                  = k->tect;
1409 #endif
1410 
1411 #ifdef TDS_ROLL_UPGRADE_SUPPORT
1412         cfg.t.cfg.s.siSap.remIntfValid                  = FALSE;                                        /* remote interface version is valid */
1413         cfg.t.cfg.s.siSap.remIntfVer                    =;                                                      /* remote interface version */
1414 #endif
1415 
1416         return(sng_cfg_isup(&pst, &cfg));
1417 }
1418 
1419 /******************************************************************************/
1420 int ftmod_ss7_cc_isap_config(int id)
1421 {
1422         CcMngmt  cfg;
1423         Pst              pst;
1424         sng_isap_t      *k = &g_ftdm_sngss7_data.cfg.isap[id];
1425 
1426         /* initalize the post structure */
1427         smPstInit(&pst);
1428 
1429         /* insert the destination Entity */
1430         pst.dstEnt = ENTCC;
1431 
1432         /*clear the configuration structure*/
1433         memset(&cfg, 0x0, sizeof(CcMngmt));
1434 
1435         /*fill in some general sections of the header*/
1436         smHdrInit(&cfg.hdr);
1437 
1438         /*fill in the specific fields of the header*/
1439         cfg.hdr.msgType                                         = TCFG;
1440         cfg.hdr.entId.ent                                       = ENTCC;
1441         cfg.hdr.entId.inst                                      = S_INST;
1442         cfg.hdr.elmId.elmnt                                     = STISAP;
1443 
1444         cfg.hdr.elmId.elmntInst1                        = k->id;
1445 
1446         cfg.t.cfg.s.ccISAP.suId                         = k->suId;
1447         cfg.t.cfg.s.ccISAP.spId                         = k->spId;
1448         cfg.t.cfg.s.ccISAP.pst.dstProcId        = SFndProcId();
1449         cfg.t.cfg.s.ccISAP.pst.dstEnt           = ENTSI;
1450         cfg.t.cfg.s.ccISAP.pst.dstInst          = S_INST;
1451         cfg.t.cfg.s.ccISAP.pst.srcProcId        = SFndProcId();
1452         cfg.t.cfg.s.ccISAP.pst.srcEnt           = ENTCC;
1453         cfg.t.cfg.s.ccISAP.pst.srcInst          = S_INST;
1454         cfg.t.cfg.s.ccISAP.pst.prior            = PRIOR0;
1455         cfg.t.cfg.s.ccISAP.pst.route            = RTESPEC;
1456         cfg.t.cfg.s.ccISAP.pst.region           = S_REG;
1457         cfg.t.cfg.s.ccISAP.pst.pool                     = S_POOL;
1458         cfg.t.cfg.s.ccISAP.pst.selector         = 0;
1459 
1460         return(sng_cfg_cc(&pst, &cfg));
1461 }
1462 
1463 /******************************************************************************/
1464 
1465 /******************************************************************************/
1466 /* For Emacs:
1467  * Local Variables:
1468  * mode:c
1469  * indent-tabs-mode:t
1470  * tab-width:4
1471  * c-basic-offset:4
1472  * End:
1473  * For VIM:
1474  * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
1475  */
1476 /******************************************************************************/

/* [<][>][^][v][top][bottom][index][help] */