Navigation


Changeset 120:d7acdc46134d in freeDiameter


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

Files:
2 edited
15 moved

Legend:

Unmodified
Added
Removed
  • extensions/CMakeLists.txt

    r118 r120  
    5757
    5858####
    59 # Debug / development extensions
     59# Debug / test extensions
    6060
    6161OPTION(BUILD_SAMPLE "Build sample.fdx? (Simple extension to demonstrate extension mechanism, for developpers only)" OFF)
     
    6464        ENDIF (BUILD_SAMPLE)
    6565
    66 OPTION(BUILD_MONITOR "Build monitor.fdx? (display periodical debug information on the console)" OFF)
    67         IF (BUILD_MONITOR)
     66OPTION(BUILD_DBG_MONITOR "Build dbg_monitor.fdx? (display periodical debug information on the console)" OFF)
     67        IF (BUILD_DBG_MONITOR)
    6868           SUBDIRS(dbg_monitor)
    69         ENDIF (BUILD_MONITOR)
     69        ENDIF (BUILD_DBG_MONITOR)
    7070
    71 OPTION(BUILD_RT_ANY "Build rt_any? (Routing extension randomly sending message to any peer available, for testing purpose only)" OFF)
    72         IF (BUILD_RT_ANY)
    73            SUBDIRS(rt_any)
    74         ENDIF (BUILD_RT_ANY)
     71OPTION(BUILD_DBG_RT "Build dbg_rt.fdx? (Routing extension for debugging the routing module)" OFF)
     72        IF (BUILD_DBG_RT)
     73           SUBDIRS(dbg_rt)
     74        ENDIF (BUILD_DBG_RT)
    7575
    76 OPTION(BUILD_RT_DEBUG "Build rt_debug? (Routing extension for debugging the routing module)" OFF)
    77         IF (BUILD_RT_DEBUG)
    78            SUBDIRS(rt_debug)
    79         ENDIF (BUILD_RT_DEBUG)
     76OPTION(BUILD_TEST_APP "Build test_app.fdx? (Testing application to send dummy message to another peer, for testing purpose only)" OFF)
     77        IF (BUILD_TEST_APP)
     78           SUBDIRS(test_app)
     79        ENDIF (BUILD_TEST_APP)
    8080
    81 OPTION(BUILD_APP_TEST "Build app_test? (Testing application to send dummy message to another peer, for testing purpose only)" OFF)
    82         IF (BUILD_APP_TEST)
    83            SUBDIRS(app_test)
    84         ENDIF (BUILD_APP_TEST)
     81OPTION(BUILD_TEST_RT_ANY "Build test_rt_any.fdx? (Routing extension randomly sending message to any peer available, for testing purpose only)" OFF)
     82        IF (BUILD_TEST_RT_ANY)
     83           SUBDIRS(test_rt_any)
     84        ENDIF (BUILD_TEST_RT_ANY)
  • extensions/dbg_monitor/CMakeLists.txt

    r10 r120  
    11# Monitoring extension
    22PROJECT("Monitor extension" C)
    3 FD_ADD_EXTENSION(dbg_monitor monitor.c)
     3FD_ADD_EXTENSION(dbg_monitor dbg_monitor.c)
  • extensions/dbg_monitor/dbg_monitor.c

    r97 r120  
    4848static int       monitor_main(char * conffile);
    4949
    50 EXTENSION_ENTRY("monitor", monitor_main);
     50EXTENSION_ENTRY("dbg_monitor", monitor_main);
    5151
    5252/* Function called on receipt of SIGUSR1 */
    5353static void got_sig(int signal)
    5454{
     55        fd_log_debug("[dbg_monitor] Dumping extra information\n");
    5556        CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_DICT, 0, NULL), /* continue */);
    5657        CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_CONFIG, 0, NULL), /* continue */);
     
    8081                sleep(3600); /* 1 hour */
    8182                #endif /* DEBUG */
    82                 TRACE_DEBUG(NONE, "Monitor information");
     83                fd_log_debug("[dbg_monitor] Dumping current information\n");
    8384                CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_QUEUES, 0, NULL), /* continue */);
    8485                CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_SERV, 0, NULL), /* continue */);
  • extensions/dbg_rt/CMakeLists.txt

    r117 r120  
    33
    44# Compile as a module
    5 FD_ADD_EXTENSION(rt_debug rt_debug.c)
     5FD_ADD_EXTENSION(dbg_rt dbg_rt.c)
  • extensions/dbg_rt/dbg_rt.c

    r117 r120  
    4444
    4545/* Proxying debug callback */
    46 static int rtdebug_fwd_cb(void * cbdata, struct msg ** msg)
     46static int dbgrt_fwd_cb(void * cbdata, struct msg ** msg)
    4747{
    4848        TRACE_ENTRY("%p %p", cbdata, msg);
    4949       
    50         fd_log_debug("[rt_debug] FWD routing message: %p\n", msg ? *msg : NULL);
     50        fd_log_debug("[dbg_rt] FWD routing message: %p\n", msg ? *msg : NULL);
    5151        if (msg)
    5252                fd_msg_dump_walk(INFO, *msg);
     
    5656
    5757/* Path selection debug callback */
    58 static int rtdebug_out_cb(void * cbdata, struct msg * msg, struct fd_list * candidates)
     58static int dbgrt_out_cb(void * cbdata, struct msg * msg, struct fd_list * candidates)
    5959{
    6060        struct fd_list * li;
     
    6262        TRACE_ENTRY("%p %p %p", cbdata, msg, candidates);
    6363       
    64         fd_log_debug("[rt_debug] OUT routing message: %p\n", msg);
     64        fd_log_debug("[dbg_rt] OUT routing message: %p\n", msg);
    6565        fd_msg_dump_walk(INFO, msg);
    66         fd_log_debug("[rt_debug] Current list of candidates (%p)\n", msg);
     66        fd_log_debug("[dbg_rt] Current list of candidates (%p)\n", msg);
    6767       
    6868        for (li = candidates->next; li != candidates; li = li->next) {
    6969                struct rtd_candidate *c = (struct rtd_candidate *) li;
    70                 fd_log_debug("[rt_debug]   - %d\t%s\n", c->score, c->diamid);
     70                fd_log_debug("[dbg_rt]   - %d\t%s\n", c->score, c->diamid);
    7171        }
    7272       
     
    7575
    7676/* Register the callbacks to the daemon */
    77 static int rtdebug_main(char * conffile)
     77static int dbgrt_main(char * conffile)
    7878{
    7979        TRACE_ENTRY("%p", conffile);
    8080       
    81         CHECK_FCT( fd_rt_fwd_register ( rtdebug_fwd_cb, NULL, RT_FWD_ALL, &fwd_hdl ) );
    82         CHECK_FCT( fd_rt_out_register ( rtdebug_out_cb, NULL, -1 /* so that it is called late */, &out_hdl ) );
     81        CHECK_FCT( fd_rt_fwd_register ( dbgrt_fwd_cb, NULL, RT_FWD_ALL, &fwd_hdl ) );
     82        CHECK_FCT( fd_rt_out_register ( dbgrt_out_cb, NULL, -1 /* so that it is called late */, &out_hdl ) );
    8383
    8484        return 0;
     
    9898
    9999/* Define the entry point function */
    100 EXTENSION_ENTRY("rt_debug", rtdebug_main);
     100EXTENSION_ENTRY("dbg_rt", dbgrt_main);
  • extensions/test_app/CMakeLists.txt

    r93 r120  
    33
    44# Parser files
    5 BISON_FILE(atst_conf.y)
    6 FLEX_FILE(atst_conf.l)
    7 SET_SOURCE_FILES_PROPERTIES(lex.atst_conf.c atst_conf.tab.c PROPERTIES COMPILE_FLAGS "-I ${CMAKE_CURRENT_SOURCE_DIR}")
     5BISON_FILE(ta_conf.y)
     6FLEX_FILE(ta_conf.l)
     7SET_SOURCE_FILES_PROPERTIES(lex.ta_conf.c ta_conf.tab.c PROPERTIES COMPILE_FLAGS "-I ${CMAKE_CURRENT_SOURCE_DIR}")
    88
    99# List of source files
    1010SET( APP_TEST_SRC
    11         app_test.c
    12         app_test.h
    13         lex.atst_conf.c
    14         atst_conf.tab.c
    15         atst_conf.tab.h
    16         atst_sig.c
    17         atst_dict.c
    18         atst_serv.c
    19         atst_cli.c
     11        test_app.h
     12        test_app.c
     13        lex.ta_conf.c
     14        ta_conf.tab.c
     15        ta_conf.tab.h
     16        ta_sig.c
     17        ta_dict.c
     18        ta_cli.c
     19        ta_serv.c
    2020)
    2121
    2222# Compile as a module
    23 FD_ADD_EXTENSION(app_test ${APP_TEST_SRC})
     23FD_ADD_EXTENSION(test_app ${APP_TEST_SRC})
  • extensions/test_app/ta_cli.c

    r99 r120  
    4040 */
    4141
    42 #include "app_test.h"
     42#include "test_app.h"
    4343
    4444#include <stdio.h>
    4545
    46 static struct session_handler * atst_cli_reg = NULL;
    47 
    48 struct atst_mess_info {
     46static struct session_handler * ta_cli_reg = NULL;
     47
     48struct ta_mess_info {
    4949        int32_t         randval;        /* a random value to store in Test-AVP */
    5050        struct timespec ts;             /* Time of sending the message */
     
    5252
    5353/* Cb called when an answer is received */
    54 static void atst_cb_ans(void * data, struct msg ** msg)
    55 {
    56         struct atst_mess_info * mi = NULL;
     54static void ta_cb_ans(void * data, struct msg ** msg)
     55{
     56        struct ta_mess_info * mi = NULL;
    5757        struct timespec ts;
    5858        struct session * sess;
     
    6868                ASSERT( new == 0 );
    6969               
    70                 CHECK_FCT_DO( fd_sess_state_retrieve( atst_cli_reg, sess, &mi ), return );
     70                CHECK_FCT_DO( fd_sess_state_retrieve( ta_cli_reg, sess, &mi ), return );
    7171                TRACE_DEBUG( INFO, "%p %p", mi, data);
    7272                ASSERT( (void *)mi == data );
     
    7777       
    7878        /* Value of Test-AVP */
    79         CHECK_FCT_DO( fd_msg_search_avp ( *msg, atst_avp, &avp), return );
     79        CHECK_FCT_DO( fd_msg_search_avp ( *msg, ta_avp, &avp), return );
    8080        if (avp) {
    8181                CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
     
    8686       
    8787        /* Value of Result Code */
    88         CHECK_FCT_DO( fd_msg_search_avp ( *msg, atst_res_code, &avp), return );
     88        CHECK_FCT_DO( fd_msg_search_avp ( *msg, ta_res_code, &avp), return );
    8989        if (avp) {
    9090                CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
     
    9595       
    9696        /* Value of Origin-Host */
    97         CHECK_FCT_DO( fd_msg_search_avp ( *msg, atst_origin_host, &avp), return );
     97        CHECK_FCT_DO( fd_msg_search_avp ( *msg, ta_origin_host, &avp), return );
    9898        if (avp) {
    9999                CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
     
    104104       
    105105        /* Value of Origin-Realm */
    106         CHECK_FCT_DO( fd_msg_search_avp ( *msg, atst_origin_realm, &avp), return );
     106        CHECK_FCT_DO( fd_msg_search_avp ( *msg, ta_origin_realm, &avp), return );
    107107        if (avp) {
    108108                CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
     
    136136
    137137/* Create a test message */
    138 static void atst_cli_test_message(void)
     138static void ta_cli_test_message(void)
    139139{
    140140        struct msg * req = NULL;
    141141        struct avp * avp;
    142142        union avp_value val;
    143         struct atst_mess_info * mi = NULL, *svg;
     143        struct ta_mess_info * mi = NULL, *svg;
    144144        struct session *sess = NULL;
    145145       
     
    147147       
    148148        /* Create the request from template */
    149         CHECK_FCT_DO( fd_msg_new( atst_cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out );
     149        CHECK_FCT_DO( fd_msg_new( ta_cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out );
    150150       
    151151        /* Create a new session */
     
    153153       
    154154        /* Create the random value to store with the session */
    155         mi = malloc(sizeof(struct atst_mess_info));
     155        mi = malloc(sizeof(struct ta_mess_info));
    156156        if (mi == NULL) {
    157157                fd_log_debug("malloc failed: %s", strerror(errno));
     
    167167                char * sid;
    168168                CHECK_FCT_DO( fd_sess_getsid ( sess, &sid ), goto out );
    169                 CHECK_FCT_DO( fd_msg_avp_new ( atst_sess_id, 0, &avp ), goto out );
     169                CHECK_FCT_DO( fd_msg_avp_new ( ta_sess_id, 0, &avp ), goto out );
    170170                val.os.data = sid;
    171171                val.os.len  = strlen(sid);
     
    177177        /* Set the Destination-Realm AVP */
    178178        {
    179                 CHECK_FCT_DO( fd_msg_avp_new ( atst_dest_realm, 0, &avp ), goto out  );
    180                 val.os.data = (unsigned char *)(atst_conf->dest_realm);
    181                 val.os.len  = strlen(atst_conf->dest_realm);
     179                CHECK_FCT_DO( fd_msg_avp_new ( ta_dest_realm, 0, &avp ), goto out  );
     180                val.os.data = (unsigned char *)(ta_conf->dest_realm);
     181                val.os.len  = strlen(ta_conf->dest_realm);
    182182                CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out  );
    183183                CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out  );
     
    185185       
    186186        /* Set the Destination-Host AVP if needed*/
    187         if (atst_conf->dest_host) {
    188                 CHECK_FCT_DO( fd_msg_avp_new ( atst_dest_host, 0, &avp ), goto out  );
    189                 val.os.data = (unsigned char *)(atst_conf->dest_host);
    190                 val.os.len  = strlen(atst_conf->dest_host);
     187        if (ta_conf->dest_host) {
     188                CHECK_FCT_DO( fd_msg_avp_new ( ta_dest_host, 0, &avp ), goto out  );
     189                val.os.data = (unsigned char *)(ta_conf->dest_host);
     190                val.os.len  = strlen(ta_conf->dest_host);
    191191                CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out  );
    192192                CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out  );
     
    199199        /* Set the Test-AVP AVP */
    200200        {
    201                 CHECK_FCT_DO( fd_msg_avp_new ( atst_avp, 0, &avp ), goto out  );
     201                CHECK_FCT_DO( fd_msg_avp_new ( ta_avp, 0, &avp ), goto out  );
    202202                val.i32 = mi->randval;
    203203                CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out  );
     
    211211       
    212212        /* Store this value in the session */
    213         CHECK_FCT_DO( fd_sess_state_store ( atst_cli_reg, sess, &mi ), goto out );
     213        CHECK_FCT_DO( fd_sess_state_store ( ta_cli_reg, sess, &mi ), goto out );
    214214       
    215215        /* Log sending the message */
    216         fprintf(stderr, "SEND %x to '%s' (%s)\n", svg->randval, atst_conf->dest_realm, atst_conf->dest_host?:"-" );
     216        fprintf(stderr, "SEND %x to '%s' (%s)\n", svg->randval, ta_conf->dest_realm, ta_conf->dest_host?:"-" );
    217217        fflush(stderr);
    218218       
    219219        /* Send the request */
    220         CHECK_FCT_DO( fd_msg_send( &req, atst_cb_ans, svg ), goto out );
     220        CHECK_FCT_DO( fd_msg_send( &req, ta_cb_ans, svg ), goto out );
    221221
    222222out:
     
    225225}
    226226
    227 int atst_cli_init(void)
    228 {
    229         CHECK_FCT( fd_sess_handler_create(&atst_cli_reg, free) );
    230        
    231         CHECK_FCT( atst_sig_init(atst_cli_test_message) );
     227int ta_cli_init(void)
     228{
     229        CHECK_FCT( fd_sess_handler_create(&ta_cli_reg, free) );
     230       
     231        CHECK_FCT( ta_sig_init(ta_cli_test_message) );
    232232       
    233233        return 0;
    234234}
    235235
    236 void atst_cli_fini(void)
    237 {
    238         (void) fd_sess_handler_destroy(&atst_cli_reg);
    239        
    240         atst_sig_fini();
     236void ta_cli_fini(void)
     237{
     238        (void) fd_sess_handler_destroy(&ta_cli_reg);
     239       
     240        ta_sig_fini();
    241241       
    242242        return;
  • extensions/test_app/ta_conf.l

    r93 r120  
    4141
    4242%{
    43 #include "app_test.h"
     43#include "test_app.h"
    4444/* Include yacc tokens definitions */
    45 #include "atst_conf.tab.h"
     45#include "ta_conf.tab.h"
    4646
    4747/* Update the column information */
  • extensions/test_app/ta_conf.y

    r93 r120  
    5050
    5151%{
    52 #include "app_test.h"
    53 #include "atst_conf.tab.h"      /* bison is not smart enough to define the YYLTYPE before including this code, so... */
     52#include "test_app.h"
     53#include "ta_conf.tab.h"        /* bison is not smart enough to define the YYLTYPE before including this code, so... */
    5454
    5555#include <string.h>
     
    6060
    6161/* Parse the configuration file */
    62 int atst_conf_handle(char * conffile)
     62int ta_conf_handle(char * conffile)
    6363{
    64         extern FILE * atst_confin;
     64        extern FILE * ta_confin;
    6565        int ret;
    6666       
     
    6969        TRACE_DEBUG (FULL, "Parsing configuration file: %s...", conffile);
    7070       
    71         atst_confin = fopen(conffile, "r");
    72         if (atst_confin == NULL) {
     71        ta_confin = fopen(conffile, "r");
     72        if (ta_confin == NULL) {
    7373                ret = errno;
    7474                fd_log_debug("Unable to open extension configuration file %s for reading: %s\n", conffile, strerror(ret));
     
    7979        ret = yyparse(conffile);
    8080
    81         fclose(atst_confin);
     81        fclose(ta_confin);
    8282
    8383        if (ret != 0) {
     
    9090
    9191/* The Lex parser prototype */
    92 int atst_conflex(YYSTYPE *lvalp, YYLTYPE *llocp);
     92int ta_conflex(YYSTYPE *lvalp, YYLTYPE *llocp);
    9393
    9494/* Function to report the errors */
     
    152152vendor:                 VENDOR_ID '=' INTEGER ';'
    153153                        {
    154                                 atst_conf->vendor_id = $3;
     154                                ta_conf->vendor_id = $3;
    155155                        }
    156156                        ;
     
    158158appli:                  APPLI_ID '=' INTEGER ';'
    159159                        {
    160                                 atst_conf->appli_id = $3;
     160                                ta_conf->appli_id = $3;
    161161                        }
    162162                        ;
     
    164164cmd:                    CMD_ID '=' INTEGER ';'
    165165                        {
    166                                 atst_conf->cmd_id = $3;
     166                                ta_conf->cmd_id = $3;
    167167                        }
    168168                        ;
     
    170170avp:                    AVP_ID '=' INTEGER ';'
    171171                        {
    172                                 atst_conf->avp_id = $3;
     172                                ta_conf->avp_id = $3;
    173173                        }
    174174                        ;
     
    176176mode:                   MODE '=' INTEGER ';'
    177177                        {
    178                                 atst_conf->mode = $3;
     178                                ta_conf->mode = $3;
    179179                        }
    180180                        ;
     
    182182dstrealm:               DEST_REALM '=' QSTRING ';'
    183183                        {
    184                                 free(atst_conf->dest_realm);
    185                                 atst_conf->dest_realm = $3;
     184                                free(ta_conf->dest_realm);
     185                                ta_conf->dest_realm = $3;
    186186                        }
    187187                        ;
     
    189189dsthost:                DEST_HOST '=' QSTRING ';'
    190190                        {
    191                                 free(atst_conf->dest_host);
    192                                 atst_conf->dest_host = $3;
     191                                free(ta_conf->dest_host);
     192                                ta_conf->dest_host = $3;
    193193                        }
    194194                        ;
     
    196196signal:                 SIGNAL '=' INTEGER ';'
    197197                        {
    198                                 atst_conf->signal = $3;
    199                         }
    200                         ;
     198                                ta_conf->signal = $3;
     199                        }
     200                        ;
  • extensions/test_app/ta_dict.c

    r93 r120  
    3636/* Install the dictionary objects */
    3737
    38 #include "app_test.h"
     38#include "test_app.h"
    3939
    40 struct dict_object * atst_vendor = NULL;
    41 struct dict_object * atst_appli = NULL;
    42 struct dict_object * atst_cmd_r = NULL;
    43 struct dict_object * atst_cmd_a = NULL;
    44 struct dict_object * atst_avp = NULL;
     40struct dict_object * ta_vendor = NULL;
     41struct dict_object * ta_appli = NULL;
     42struct dict_object * ta_cmd_r = NULL;
     43struct dict_object * ta_cmd_a = NULL;
     44struct dict_object * ta_avp = NULL;
    4545
    46 struct dict_object * atst_sess_id = NULL;
    47 struct dict_object * atst_origin_host = NULL;
    48 struct dict_object * atst_origin_realm = NULL;
    49 struct dict_object * atst_dest_host = NULL;
    50 struct dict_object * atst_dest_realm = NULL;
    51 struct dict_object * atst_res_code = NULL;
     46struct dict_object * ta_sess_id = NULL;
     47struct dict_object * ta_origin_host = NULL;
     48struct dict_object * ta_origin_realm = NULL;
     49struct dict_object * ta_dest_host = NULL;
     50struct dict_object * ta_dest_realm = NULL;
     51struct dict_object * ta_res_code = NULL;
    5252
    53 int atst_dict_init(void)
     53int ta_dict_init(void)
    5454{
    5555        TRACE_DEBUG(FULL, "Initializing the dictionary for test");
     
    5858        {
    5959                struct dict_vendor_data data;
    60                 data.vendor_id = atst_conf->vendor_id;
     60                data.vendor_id = ta_conf->vendor_id;
    6161                data.vendor_name = "app_test vendor";
    62                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_VENDOR, &data, NULL, &atst_vendor));
     62                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_VENDOR, &data, NULL, &ta_vendor));
    6363        }
    6464       
     
    6666        {
    6767                struct dict_application_data data;
    68                 data.application_id = atst_conf->appli_id;
     68                data.application_id = ta_conf->appli_id;
    6969                data.application_name = "app_test application";
    70                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_APPLICATION, &data, atst_vendor, &atst_appli));
     70                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_APPLICATION, &data, ta_vendor, &ta_appli));
    7171        }
    7272       
     
    7474        {
    7575                struct dict_cmd_data data;
    76                 data.cmd_code = atst_conf->cmd_id;
     76                data.cmd_code = ta_conf->cmd_id;
    7777                data.cmd_name = "Test-Request";
    7878                data.cmd_flag_mask = CMD_FLAG_PROXIABLE | CMD_FLAG_REQUEST;
    7979                data.cmd_flag_val  = CMD_FLAG_PROXIABLE | CMD_FLAG_REQUEST;
    80                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_COMMAND, &data, atst_appli, &atst_cmd_r));
     80                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_COMMAND, &data, ta_appli, &ta_cmd_r));
    8181                data.cmd_name = "Test-Answer";
    8282                data.cmd_flag_val  = CMD_FLAG_PROXIABLE;
    83                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_COMMAND, &data, atst_appli, &atst_cmd_a));
     83                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_COMMAND, &data, ta_appli, &ta_cmd_a));
    8484        }
    8585       
     
    8787        {
    8888                struct dict_avp_data data;
    89                 data.avp_code = atst_conf->avp_id;
    90                 data.avp_vendor = atst_conf->vendor_id;
     89                data.avp_code = ta_conf->avp_id;
     90                data.avp_vendor = ta_conf->vendor_id;
    9191                data.avp_name = "Test-AVP";
    9292                data.avp_flag_mask = AVP_FLAG_VENDOR;
    9393                data.avp_flag_val = AVP_FLAG_VENDOR;
    9494                data.avp_basetype = AVP_TYPE_INTEGER32;
    95                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_AVP, &data, NULL, &atst_avp));
     95                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_AVP, &data, NULL, &ta_avp));
    9696        }
    9797       
    9898        /* Now resolve some other useful AVPs */
    99         CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Session-Id", &atst_sess_id, ENOENT) );
    100         CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Host", &atst_origin_host, ENOENT) );
    101         CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Realm", &atst_origin_realm, ENOENT) );
    102         CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Host", &atst_dest_host, ENOENT) );
    103         CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Realm", &atst_dest_realm, ENOENT) );
    104         CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Result-Code", &atst_res_code, ENOENT) );
     99        CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Session-Id", &ta_sess_id, ENOENT) );
     100        CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Host", &ta_origin_host, ENOENT) );
     101        CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Realm", &ta_origin_realm, ENOENT) );
     102        CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Host", &ta_dest_host, ENOENT) );
     103        CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Realm", &ta_dest_realm, ENOENT) );
     104        CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Result-Code", &ta_res_code, ENOENT) );
    105105       
    106106        /* Create the rules for Test-Request and Test-Answer */
     
    111111               
    112112                /* Session-Id is in first position */
    113                 data.rule_avp = atst_sess_id;
     113                data.rule_avp = ta_sess_id;
    114114                data.rule_position = RULE_FIXED_HEAD;
    115115                data.rule_order = 1;
    116                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_r, NULL));
    117                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_a, NULL));
     116                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL));
     117                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL));
    118118               
    119119                data.rule_position = RULE_REQUIRED;
    120120                /* Test-AVP is mandatory */
    121                 data.rule_avp = atst_avp;
    122                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_r, NULL));
    123                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_a, NULL));
     121                data.rule_avp = ta_avp;
     122                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL));
     123                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL));
    124124               
    125125                /* idem for Origin Host and Realm */
    126                 data.rule_avp = atst_origin_host;
    127                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_r, NULL));
    128                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_a, NULL));
     126                data.rule_avp = ta_origin_host;
     127                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL));
     128                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL));
    129129               
    130                 data.rule_avp = atst_origin_realm;
    131                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_r, NULL));
    132                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_a, NULL));
     130                data.rule_avp = ta_origin_realm;
     131                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL));
     132                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL));
    133133               
    134134                /* And Result-Code is mandatory for answers only */
    135                 data.rule_avp = atst_res_code;
    136                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_a, NULL));
     135                data.rule_avp = ta_res_code;
     136                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL));
    137137               
    138138                /* And Destination-Realm for requests only */
    139                 data.rule_avp = atst_dest_realm;
    140                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_r, NULL));
     139                data.rule_avp = ta_dest_realm;
     140                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL));
    141141               
    142142                /* And Destination-Host optional for requests only */
    143143                data.rule_position = RULE_OPTIONAL;
    144144                data.rule_min = 0;
    145                 data.rule_avp = atst_dest_host;
    146                 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_r, NULL));
     145                data.rule_avp = ta_dest_host;
     146                CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL));
    147147               
    148148        }
  • extensions/test_app/ta_serv.c

    r112 r120  
    3636/* Install the dispatch callbacks */
    3737
    38 #include "app_test.h"
     38#include "test_app.h"
    3939
    40 static struct disp_hdl * atst_hdl_fb = NULL; /* handler for fallback cb */
    41 static struct disp_hdl * atst_hdl_tr = NULL; /* handler for Test-Request req cb */
     40static struct disp_hdl * ta_hdl_fb = NULL; /* handler for fallback cb */
     41static struct disp_hdl * ta_hdl_tr = NULL; /* handler for Test-Request req cb */
    4242
    4343/* Default callback for the application. */
    44 static int atst_fb_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)
     44static int ta_fb_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)
    4545{
    4646        /* This CB should never be called */
     
    5353
    5454/* Callback for incoming Test-Request messages */
    55 static int atst_tr_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)
     55static int ta_tr_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)
    5656{
    5757        struct msg *ans, *qry;
     
    7373                struct avp_hdr * hdr = NULL;
    7474               
    75                 CHECK_FCT( fd_msg_search_avp ( qry, atst_avp, &src) );
     75                CHECK_FCT( fd_msg_search_avp ( qry, ta_avp, &src) );
    7676                CHECK_FCT( fd_msg_avp_hdr( src, &hdr )  );
    7777               
    78                 CHECK_FCT( fd_msg_avp_new ( atst_avp, 0, &avp ) );
     78                CHECK_FCT( fd_msg_avp_new ( ta_avp, 0, &avp ) );
    7979                CHECK_FCT( fd_msg_avp_setvalue( avp, hdr->avp_value ) );
    8080                CHECK_FCT( fd_msg_avp_add( ans, MSG_BRW_LAST_CHILD, avp ) );
     
    9090}
    9191
    92 int atst_serv_init(void)
     92int ta_serv_init(void)
    9393{
    9494        struct disp_when data;
     
    9797       
    9898        memset(&data, 0, sizeof(data));
    99         data.app = atst_appli;
    100         data.command = atst_cmd_r;
     99        data.app = ta_appli;
     100        data.command = ta_cmd_r;
    101101       
    102102        /* fallback CB if command != Test-Request received */
    103         CHECK_FCT( fd_disp_register( atst_fb_cb, DISP_HOW_APPID, &data, &atst_hdl_fb ) );
     103        CHECK_FCT( fd_disp_register( ta_fb_cb, DISP_HOW_APPID, &data, &ta_hdl_fb ) );
    104104       
    105105        /* Now specific handler for Test-Request */
    106         CHECK_FCT( fd_disp_register( atst_tr_cb, DISP_HOW_CC, &data, &atst_hdl_tr ) );
     106        CHECK_FCT( fd_disp_register( ta_tr_cb, DISP_HOW_CC, &data, &ta_hdl_tr ) );
    107107       
    108108        return 0;
    109109}
    110110
    111 void atst_serv_fini(void)
     111void ta_serv_fini(void)
    112112{
    113         if (atst_hdl_fb) {
    114                 (void) fd_disp_unregister(&atst_hdl_fb);
     113        if (ta_hdl_fb) {
     114                (void) fd_disp_unregister(&ta_hdl_fb);
    115115        }
    116         if (atst_hdl_tr) {
    117                 (void) fd_disp_unregister(&atst_hdl_tr);
     116        if (ta_hdl_tr) {
     117                (void) fd_disp_unregister(&ta_hdl_tr);
    118118        }
    119119       
  • extensions/test_app/ta_sig.c

    r98 r120  
    3636/* Install the signal handler */
    3737
    38 #include "app_test.h"
     38#include "test_app.h"
    3939
    4040static pthread_t th = (pthread_t) NULL;
    4141
    42 static void * atst_sig_th(void * arg)
     42static void * ta_sig_th(void * arg)
    4343{
    4444        int sig;
     
    5050       
    5151        sigemptyset(&ss);
    52         sigaddset(&ss, atst_conf->signal);
     52        sigaddset(&ss, ta_conf->signal);
    5353       
    5454        while (1) {
     
    6969}
    7070
    71 int atst_sig_init(void (*cb)(void))
     71int ta_sig_init(void (*cb)(void))
    7272{
    73         return pthread_create( &th, NULL, atst_sig_th, (void *)cb );
     73        return pthread_create( &th, NULL, ta_sig_th, (void *)cb );
    7474}
    7575
    76 void atst_sig_fini(void)
     76void ta_sig_fini(void)
    7777{
    7878        void * th_ret = NULL;
  • 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);
  • extensions/test_app/test_app.h

    r97 r120  
    4343#include <freeDiameter/extension.h>
    4444
    45 #ifndef APP_TEST_DEFAULT_SIGNAL
    46 #define APP_TEST_DEFAULT_SIGNAL SIGUSR1
    47 #endif /* APP_TEST_DEFAULT_SIGNAL */
     45#ifndef TEST_APP_DEFAULT_SIGNAL
     46#define TEST_APP_DEFAULT_SIGNAL SIGUSR1
     47#endif /* TEST_APP_DEFAULT_SIGNAL */
    4848
    4949
     
    5353
    5454/* The module configuration */
    55 struct atst_conf {
     55struct ta_conf {
    5656        uint32_t        vendor_id;      /* default 999999 */
    5757        uint32_t        appli_id;       /* default 123456 */
     
    6161        char    *       dest_realm;     /* default local realm */
    6262        char    *       dest_host;      /* default NULL */
    63         int             signal;         /* default APP_TEST_DEFAULT_SIGNAL */
     63        int             signal;         /* default TEST_APP_DEFAULT_SIGNAL */
    6464};
    65 extern struct atst_conf * atst_conf;
     65extern struct ta_conf * ta_conf;
    6666
    6767/* Parse the configuration file */
    68 int atst_conf_handle(char * conffile);
     68int ta_conf_handle(char * conffile);
    6969
    7070/* Start or stop the signal handler */
    71 int atst_sig_init(void (*cb)(void));
    72 void atst_sig_fini(void);
     71int ta_sig_init(void (*cb)(void));
     72void ta_sig_fini(void);
    7373
    7474/* Handle incoming messages (server) */
    75 int atst_serv_init(void);
    76 void atst_serv_fini(void);
     75int ta_serv_init(void);
     76void ta_serv_fini(void);
    7777
    7878/* Create outgoing message (client) */
    79 int atst_cli_init(void);
    80 void atst_cli_fini(void);
     79int ta_cli_init(void);
     80void ta_cli_fini(void);
    8181
    8282/* Initialize dictionary definitions */
    83 int atst_dict_init(void);
     83int ta_dict_init(void);
    8484
    8585
    8686/* Some global variables for dictionary */
    87 extern struct dict_object * atst_vendor;
    88 extern struct dict_object * atst_appli;
    89 extern struct dict_object * atst_cmd_r;
    90 extern struct dict_object * atst_cmd_a;
    91 extern struct dict_object * atst_avp;
     87extern struct dict_object * ta_vendor;
     88extern struct dict_object * ta_appli;
     89extern struct dict_object * ta_cmd_r;
     90extern struct dict_object * ta_cmd_a;
     91extern struct dict_object * ta_avp;
    9292
    93 extern struct dict_object * atst_sess_id;
    94 extern struct dict_object * atst_origin_host;
    95 extern struct dict_object * atst_origin_realm;
    96 extern struct dict_object * atst_dest_host;
    97 extern struct dict_object * atst_dest_realm;
    98 extern struct dict_object * atst_res_code;
     93extern struct dict_object * ta_sess_id;
     94extern struct dict_object * ta_origin_host;
     95extern struct dict_object * ta_origin_realm;
     96extern struct dict_object * ta_dest_host;
     97extern struct dict_object * ta_dest_realm;
     98extern struct dict_object * ta_res_code;
  • extensions/test_rt_any/CMakeLists.txt

    r118 r120  
    33
    44# Compile as a module
    5 FD_ADD_EXTENSION(rt_any rt_any.c)
     5FD_ADD_EXTENSION(test_rt_any test_rt_any.c)
  • extensions/test_rt_any/test_rt_any.c

    r118 r120  
    4141
    4242/* The callback */
    43 static int rtany_out_cb(void * cbdata, struct msg * msg, struct fd_list * candidates)
     43static int tra_out_cb(void * cbdata, struct msg * msg, struct fd_list * candidates)
    4444{
    4545        struct fd_list * li;
     
    5858
    5959/* Register the callbacks to the daemon */
    60 static int rtany_main(char * conffile)
     60static int tra_main(char * conffile)
    6161{
    6262        TRACE_ENTRY("%p", conffile);
    63         CHECK_FCT( fd_rt_out_register ( rtany_out_cb, NULL, 0 /* we call it late so that it replaces previous scores */, &out_hdl ) );
     63        CHECK_FCT( fd_rt_out_register ( tra_out_cb, NULL, 0 /* we call it late so that it replaces previous scores */, &out_hdl ) );
    6464        return 0;
    6565}
     
    7474
    7575/* Define the entry point function */
    76 EXTENSION_ENTRY("rt_any", rtany_main);
     76EXTENSION_ENTRY("test_rt_any", tra_main);
Note: See TracChangeset for help on using the changeset viewer.