Navigation


Changeset 120:d7acdc46134d in freeDiameter for extensions/test_app/test_app.c


Ignore:
Timestamp:
Dec 9, 2009, 5:36:38 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Renamed several extensions

File:
1 moved

Legend:

Unmodified
Added
Removed
  • extensions/test_app/test_app.c

    r108 r120  
    3838 */
    3939
    40 #include "app_test.h"
     40#include "test_app.h"
    4141#include <signal.h>
    4242
    4343/* Initialize the configuration */
    44 struct atst_conf * atst_conf = NULL;
    45 static struct atst_conf _conf;
     44struct ta_conf * ta_conf = NULL;
     45static struct ta_conf _conf;
    4646
    47 static int atst_conf_init(void)
     47static int ta_conf_init(void)
    4848{
    49         atst_conf = &_conf;
    50         memset(atst_conf, 0, sizeof(struct atst_conf));
     49        ta_conf = &_conf;
     50        memset(ta_conf, 0, sizeof(struct ta_conf));
    5151       
    5252        /* Set the default values */
    53         atst_conf->vendor_id  = 999999;         /* Dummy value */
    54         atst_conf->appli_id   = 0xffffff;       /* dummy value */
    55         atst_conf->cmd_id     = 0xfffffe;       /* Experimental */
    56         atst_conf->avp_id     = 0xffffff;       /* dummy value */
    57         atst_conf->mode       = MODE_SERV | MODE_CLI;
    58         atst_conf->dest_realm = strdup(fd_g_config->cnf_diamrlm);
    59         atst_conf->dest_host  = NULL;
    60         atst_conf->signal     = APP_TEST_DEFAULT_SIGNAL;
     53        ta_conf->vendor_id  = 999999;           /* Dummy value */
     54        ta_conf->appli_id   = 0xffffff; /* dummy value */
     55        ta_conf->cmd_id     = 0xfffffe; /* Experimental */
     56        ta_conf->avp_id     = 0xffffff; /* dummy value */
     57        ta_conf->mode       = MODE_SERV | MODE_CLI;
     58        ta_conf->dest_realm = strdup(fd_g_config->cnf_diamrlm);
     59        ta_conf->dest_host  = NULL;
     60        ta_conf->signal     = TEST_APP_DEFAULT_SIGNAL;
    6161       
    6262        return 0;
    6363}
    6464
    65 static void atst_conf_dump(void)
     65static void ta_conf_dump(void)
    6666{
    6767        if (!TRACE_BOOL(INFO))
    6868                return;
    6969        fd_log_debug( "------- app_test configuration dump: ---------\n");
    70         fd_log_debug( " Vendor Id .......... : %u\n", atst_conf->vendor_id);
    71         fd_log_debug( " Application Id ..... : %u\n", atst_conf->appli_id);
    72         fd_log_debug( " Command Id ......... : %u\n", atst_conf->cmd_id);
    73         fd_log_debug( " AVP Id ............. : %u\n", atst_conf->avp_id);
    74         fd_log_debug( " Mode ............... : %s%s\n", atst_conf->mode & MODE_SERV ? "Serv" : "", atst_conf->mode & MODE_CLI ? "Cli" : "" );
    75         fd_log_debug( " Destination Realm .. : %s\n", atst_conf->dest_realm ?: "- none -");
    76         fd_log_debug( " Destination Host ... : %s\n", atst_conf->dest_host ?: "- none -");
    77         fd_log_debug( " Signal ............. : %i\n", atst_conf->signal);
     70        fd_log_debug( " Vendor Id .......... : %u\n", ta_conf->vendor_id);
     71        fd_log_debug( " Application Id ..... : %u\n", ta_conf->appli_id);
     72        fd_log_debug( " Command Id ......... : %u\n", ta_conf->cmd_id);
     73        fd_log_debug( " AVP Id ............. : %u\n", ta_conf->avp_id);
     74        fd_log_debug( " Mode ............... : %s%s\n", ta_conf->mode & MODE_SERV ? "Serv" : "", ta_conf->mode & MODE_CLI ? "Cli" : "" );
     75        fd_log_debug( " Destination Realm .. : %s\n", ta_conf->dest_realm ?: "- none -");
     76        fd_log_debug( " Destination Host ... : %s\n", ta_conf->dest_host ?: "- none -");
     77        fd_log_debug( " Signal ............. : %i\n", ta_conf->signal);
    7878        fd_log_debug( "------- /app_test configuration dump ---------\n");
    7979}
    8080
    8181/* entry point */
    82 static int atst_entry(char * conffile)
     82static int ta_entry(char * conffile)
    8383{
    8484        TRACE_ENTRY("%p", conffile);
    8585       
    8686        /* Initialize configuration */
    87         CHECK_FCT( atst_conf_init() );
     87        CHECK_FCT( ta_conf_init() );
    8888       
    8989        /* Parse configuration file */
    9090        if (conffile != NULL) {
    91                 CHECK_FCT( atst_conf_handle(conffile) );
     91                CHECK_FCT( ta_conf_handle(conffile) );
    9292        }
    9393       
    94         TRACE_DEBUG(INFO, "Extension APP/Test initialized with configuration: '%s'", conffile);
    95         atst_conf_dump();
     94        TRACE_DEBUG(INFO, "Extension Test_App initialized with configuration: '%s'", conffile);
     95        ta_conf_dump();
    9696       
    9797        /* Install objects definitions for this test application */
    98         CHECK_FCT( atst_dict_init() );
     98        CHECK_FCT( ta_dict_init() );
    9999       
    100100        /* Install the handlers for incoming messages */
    101         if (atst_conf->mode & MODE_SERV) {
    102                 CHECK_FCT( atst_serv_init() );
     101        if (ta_conf->mode & MODE_SERV) {
     102                CHECK_FCT( ta_serv_init() );
    103103        }
    104104       
    105105        /* Start the signal handler thread */
    106         if (atst_conf->mode & MODE_CLI) {
    107                 CHECK_FCT( atst_cli_init() );
     106        if (ta_conf->mode & MODE_CLI) {
     107                CHECK_FCT( ta_cli_init() );
    108108        }
    109109       
    110110        /* Advertise the support for the test application in the peer */
    111         CHECK_FCT( fd_disp_app_support ( atst_appli, atst_vendor, 1, 0 ) );
     111        CHECK_FCT( fd_disp_app_support ( ta_appli, ta_vendor, 1, 0 ) );
    112112       
    113113        return 0;
     
    117117void fd_ext_fini(void)
    118118{
    119         if (atst_conf->mode & MODE_CLI)
    120                 atst_cli_fini();
    121         if (atst_conf->mode & MODE_SERV)
    122                 atst_serv_fini();
     119        if (ta_conf->mode & MODE_CLI)
     120                ta_cli_fini();
     121        if (ta_conf->mode & MODE_SERV)
     122                ta_serv_fini();
    123123}
    124124
    125 EXTENSION_ENTRY("app_test", atst_entry);
     125EXTENSION_ENTRY("test_app", ta_entry);
Note: See TracChangeset for help on using the changeset viewer.