Navigation


Changeset 37:cc3c59fe98fe in freeDiameter for freeDiameter/fdd.y


Ignore:
Timestamp:
Nov 5, 2009, 2:28:46 PM (15 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Lot of cleanups in peer structure management

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/fdd.y

    r36 r37  
    316316connpeer:               {
    317317                                memset(&fddpi, 0, sizeof(fddpi));
     318                                fddpi.config.pic_flags.persist = PI_PRST_ALWAYS;
    318319                                fd_list_init( &fddpi.pi_endpoints, NULL );
    319                                 fd_list_init( &fddpi.pi_apps, NULL );
    320                                 fddpi.pi_flags.persist = PI_PRST_ALWAYS;
    321320                        }
    322321                        CONNPEER '=' QSTRING peerinfo ';'
     
    328327                                /* Now destroy any content in the structure */
    329328                                free(fddpi.pi_diamid);
    330                                 free(fddpi.pi_sec_data.priority);
     329                                free(fddpi.config.pic_realm);
     330                                free(fddpi.config.pic_priority);
    331331                                while (!FD_IS_LIST_EMPTY(&fddpi.pi_endpoints)) {
    332332                                        struct fd_list * li = fddpi.pi_endpoints.next;
     
    344344                        | peerparams NOIP ';'
    345345                        {
    346                                 if ((conf->cnf_flags.no_ip6) || (fddpi.pi_flags.pro3 == PI_P3_IP)) {
     346                                if ((conf->cnf_flags.no_ip6) || (fddpi.config.pic_flags.pro3 == PI_P3_IP)) {
    347347                                        yyerror (&yylloc, conf, "No_IP conflicts with a No_IPv6 directive.");
    348348                                        YYERROR;
    349349                                }
    350350                                got_peer_noip++;
    351                                 fddpi.pi_flags.pro3 = PI_P3_IPv6;
     351                                fddpi.config.pic_flags.pro3 = PI_P3_IPv6;
    352352                        }
    353353                        | peerparams NOIP6 ';'
    354354                        {
    355                                 if ((conf->cnf_flags.no_ip4) || (fddpi.pi_flags.pro3 == PI_P3_IPv6)) {
     355                                if ((conf->cnf_flags.no_ip4) || (fddpi.config.pic_flags.pro3 == PI_P3_IPv6)) {
    356356                                        yyerror (&yylloc, conf, "No_IPv6 conflicts with a No_IP directive.");
    357357                                        YYERROR;
    358358                                }
    359359                                got_peer_noipv6++;
    360                                 fddpi.pi_flags.pro3 = PI_P3_IP;
     360                                fddpi.config.pic_flags.pro3 = PI_P3_IP;
    361361                        }
    362362                        | peerparams NOTCP ';'
     
    366366                                        YYERROR;
    367367                                #endif
    368                                 if ((conf->cnf_flags.no_sctp) || (fddpi.pi_flags.pro4 == PI_P4_TCP)) {
     368                                if ((conf->cnf_flags.no_sctp) || (fddpi.config.pic_flags.pro4 == PI_P4_TCP)) {
    369369                                        yyerror (&yylloc, conf, "No_TCP conflicts with a No_SCTP directive.");
    370370                                        YYERROR;
    371371                                }
    372372                                got_peer_notcp++;
    373                                 fddpi.pi_flags.pro4 = PI_P4_SCTP;
     373                                fddpi.config.pic_flags.pro4 = PI_P4_SCTP;
    374374                        }
    375375                        | peerparams NOSCTP ';'
    376376                        {
    377                                 if ((conf->cnf_flags.no_tcp) || (fddpi.pi_flags.pro4 == PI_P4_SCTP)) {
     377                                if ((conf->cnf_flags.no_tcp) || (fddpi.config.pic_flags.pro4 == PI_P4_SCTP)) {
    378378                                        yyerror (&yylloc, conf, "No_SCTP conflicts with a No_TCP directive.");
    379379                                        YYERROR;
    380380                                }
    381381                                got_peer_nosctp++;
    382                                 fddpi.pi_flags.pro4 = PI_P4_TCP;
     382                                fddpi.config.pic_flags.pro4 = PI_P4_TCP;
    383383                        }
    384384                        | peerparams PREFERTCP ';'
    385385                        {
    386                                 fddpi.pi_flags.alg = PI_ALGPREF_TCP;
     386                                fddpi.config.pic_flags.alg = PI_ALGPREF_TCP;
    387387                        }
    388388                        | peerparams OLDTLS ';'
    389389                        {
    390                                 if (fddpi.pi_flags.sec == PI_SEC_NONE) {
    391                                         yyerror (&yylloc, conf, "ConnectPeer: TLS_old_method conflicts with No_TLS.");
    392                                         YYERROR;
    393                                 }
    394                                 fddpi.pi_flags.sec = PI_SEC_TLS_OLD;
     390                                fddpi.config.pic_flags.sec |= PI_SEC_TLS_OLD;
    395391                        }
    396392                        | peerparams NOTLS ';'
    397393                        {
    398                                 if (fddpi.pi_flags.sec == PI_SEC_TLS_OLD) {
    399                                         yyerror (&yylloc, conf, "ConnectPeer: No_TLS conflicts with TLS_old_method.");
    400                                         YYERROR;
    401                                 }
    402                                 fddpi.pi_flags.sec = PI_SEC_NONE;
     394                                fddpi.config.pic_flags.sec |= PI_SEC_NONE;
     395                        }
     396                        | peerparams REALM '=' QSTRING ';'
     397                        {
     398                                fddpi.config.pic_realm = $4;
    403399                        }
    404400                        | peerparams PORT '=' INTEGER ';'
    405401                        {
    406402                                CHECK_PARAMS_DO( ($4 > 0) && ($4 < 1<<16),
    407                                         { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
    408                                 fddpi.pi_port = (uint16_t)$4;
     403                                        { yyerror (&yylloc, conf, "Invalid port value"); YYERROR; } );
     404                                fddpi.config.pic_port = (uint16_t)$4;
    409405                        }
    410406                        | peerparams TCTIMER '=' INTEGER ';'
    411407                        {
    412                                 fddpi.pi_tctimer = $4;
     408                                fddpi.config.pic_tctimer = $4;
     409                        }
     410                        | peerparams TWTIMER '=' INTEGER ';'
     411                        {
     412                                fddpi.config.pic_twtimer = $4;
    413413                        }
    414414                        | peerparams TLS_PRIO '=' QSTRING ';'
    415415                        {
    416                                 fddpi.pi_sec_data.priority = $4;
    417                         }
    418                         | peerparams TWTIMER '=' INTEGER ';'
    419                         {
    420                                 fddpi.pi_twtimer = $4;
     416                                fddpi.config.pic_priority = $4;
    421417                        }
    422418                        | peerparams CONNTO '=' QSTRING ';'
Note: See TracChangeset for help on using the changeset viewer.