Navigation


Changeset 304:ad3c46016584 in freeDiameter


Ignore:
Timestamp:
May 14, 2010, 5:26:53 PM (12 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Added install directives for cmake; also allow default directory to seek for extensions and configuration files

Files:
31 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r301 r304  
    4848SUBDIRS(freeDiameter)
    4949
    50 # Do we build the extensions?
    51 OPTION(IGNORE_ALL_EXTENSIONS "Ignore the extensions completly?")
    52 IF(NOT IGNORE_ALL_EXTENSIONS)
    53         SUBDIRS(extensions)
    54 ENDIF(NOT IGNORE_ALL_EXTENSIONS)
     50# Extensions (there is no point in freeDiameter without any extension)
     51SUBDIRS(extensions)
    5552
    56 # The documentation to install
     53
     54####
     55## INSTALL section ##
     56
    5757INSTALL(FILES README LICENSE doc/freediameter.conf.sample
    5858        DESTINATION doc
  • INSTALL

    r300 r304  
    33
    44Building in a separate directory is recommended:
    5 mkdir build
    6 cd build
    7 cmake ../
    8 make
     5# mkdir build
     6# cd build
     7# cmake ../
     8# make
     9
     10Note: instead of passing options on the command line, you can use a CMake front-end (for example ccmake or cmake-gui)
     11or edit the CCmakeCache.txt file directly. If your cmake installation is recent, you can also do:
     12# mkdir build
     13# cd build
     14# cmake ../
     15# make edit_cache
     16# make
     17
    918
    1019You can enable the unary tests by doing:
    11 cmake -DSKIP_TESTS:BOOL=OFF ../
    12 make
    13 make tests
    14 
    15 Note: instead of passing options on the command line, you can use a CMake front-end (for example ccmake or cmake-gui)
    16 or edit the CCmakeCache.txt file directly.
     20# cmake -DSKIP_TESTS:BOOL=OFF ../
     21# make
     22# make tests
    1723
    1824Note that there are dependencies on external tools that may not be enforced by the configure script.
  • INSTALL.Ubuntu

    r298 r304  
    5353# make test
    5454
     55
     56
  • cmake/Modules/CMakeUserUseBison.cmake

    r0 r304  
    2626   MESSAGE(STATUS "Looking for bison -- ${BISON_EXECUTABLE}")
    2727 ENDIF(BISON_EXECUTABLE)
     28 MARK_AS_ADVANCED(BISON_EXECUTABLE)
    2829ENDIF(NOT BISON_EXECUTABLE)
    2930
  • cmake/Modules/CMakeUserUseFlex.cmake

    r0 r304  
    1616    MESSAGE(STATUS "Looking for flex -- ${FLEX_EXECUTABLE}")
    1717  ENDIF(FLEX_EXECUTABLE)
     18 MARK_AS_ADVANCED(FLEX_EXECUTABLE)
    1819ENDIF(NOT FLEX_EXECUTABLE)
    1920
  • cmake/Modules/FindGnuTLS.cmake

    r284 r304  
    3535# Lastly make it so that the GNUTLS_LIBRARY and GNUTLS_INCLUDE_DIR variables
    3636# only show up under the advanced options in the gui cmake applications.
    37 MARK_AS_ADVANCED( GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIRS )
     37MARK_AS_ADVANCED( GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR )
  • cmake/Modules/FindPostgreSQL.cmake

    r284 r304  
    3434# Lastly make it so that the POSTGRESQL_LIBRARY and POSTGRESQL_INCLUDE_DIR variables
    3535# only show up under the advanced options in the gui cmake applications.
    36 MARK_AS_ADVANCED( POSTGRESQL_LIBRARIES POSTGRESQL_INCLUDE_DIR )
     36MARK_AS_ADVANCED( POSTGRESQL_LIBRARY POSTGRESQL_INCLUDE_DIR )
  • extensions/CMakeLists.txt

    r283 r304  
    2020        MESSAGE(SEND_ERROR "Unable to find gcrypt.h, please install libgcrypt-dev or equivalent")
    2121Endif ( NOT GCRYPT_INCLUDE_DIR )
     22MARK_AS_ADVANCED(GCRYPT_INCLUDE_DIR)
    2223INCLUDE_DIRECTORIES(${GCRYPT_INCLUDE_DIR})
    2324
     
    7778# Debug & test extensions
    7879
    79 OPTION(BUILD_SAMPLE "Build sample.fdx? (Simple extension to demonstrate extension mechanism, for developpers only)" OFF)
    80         IF (BUILD_SAMPLE)
    81            SUBDIRS(_sample)
    82         ENDIF (BUILD_SAMPLE)
    83 
    8480OPTION(BUILD_DBG_MONITOR "Build dbg_monitor.fdx? (display periodical debug information on the console)" OFF)
    8581        IF (BUILD_DBG_MONITOR)
     
    9288        ENDIF (BUILD_DBG_RT)
    9389
    94 OPTION(BUILD_TEST_ACCT "Build test_acct.fdx? (Receive Accounting-Requests and display the data, but no storage)" OFF)
    95         IF (BUILD_TEST_ACCT)
    96            SUBDIRS(test_acct)
    97         ENDIF (BUILD_TEST_ACCT)
    98 
    9990OPTION(BUILD_TEST_APP "Build test_app.fdx? (Testing application to send dummy message to another peer, for testing purpose only)" OFF)
    10091        IF (BUILD_TEST_APP)
     
    10293        ENDIF (BUILD_TEST_APP)
    10394
    104 OPTION(BUILD_TEST_RT_ANY "Build test_rt_any.fdx? (Routing extension randomly sending message to any peer available, for testing purpose only)" OFF)
    105         IF (BUILD_TEST_RT_ANY)
    106            SUBDIRS(test_rt_any)
    107         ENDIF (BUILD_TEST_RT_ANY)
     95# The following extension have very little use except for specific tests, so we disable them except in Debug configurations.
     96IF (CMAKE_BUILD_TYPE MATCHES "Debug")
     97        OPTION(BUILD_SAMPLE "Build sample.fdx? (Simple extension to demonstrate extension mechanism, for developpers only)" OFF)
     98                IF (BUILD_SAMPLE)
     99                   SUBDIRS(_sample)
     100                ENDIF (BUILD_SAMPLE)
     101
     102        OPTION(BUILD_TEST_ACCT "Build test_acct.fdx? (Receive Accounting-Requests and display the data, but no storage)" OFF)
     103                IF (BUILD_TEST_ACCT)
     104                   SUBDIRS(test_acct)
     105                ENDIF (BUILD_TEST_ACCT)
     106               
     107        OPTION(BUILD_TEST_RT_ANY "Build test_rt_any.fdx? (Routing extension randomly sending message to any peer available, for testing purpose only)" OFF)
     108                IF (BUILD_TEST_RT_ANY)
     109                   SUBDIRS(test_rt_any)
     110                ENDIF (BUILD_TEST_RT_ANY)
     111ENDIF (CMAKE_BUILD_TYPE MATCHES "Debug")
     112
  • extensions/_sample/CMakeLists.txt

    r170 r304  
    33
    44# Overwrite the debug level for the extension code if configured
    5 OPTION(DEBUG_LEVEL__SAMPLE "Overwrite debug level for the extension _sample if defined" OFF)
     5OPTION(DEBUG_LEVEL__SAMPLE "Overwrite debug level for the extension _sample if defined (valid values: FULL, ANNOYING, CALL...)" OFF)
    66IF (DEBUG_LEVEL__SAMPLE)
    77     ADD_DEFINITIONS(-DTRACE_LEVEL=${DEBUG_LEVEL__SAMPLE})
    88ENDIF (DEBUG_LEVEL__SAMPLE)
     9IF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
     10  MARK_AS_ADVANCED(DEBUG_LEVEL__SAMPLE)
     11ENDIF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
    912
    1013# Compile as a module
    1114FD_ADD_EXTENSION(dbg_sample sample.c fini.c)
     15
     16
     17####
     18## INSTALL section ##
     19
     20INSTALL(TARGETS dbg_sample
     21        LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
     22        COMPONENT freeDiameter-debug-tools)
  • extensions/acl_wl/CMakeLists.txt

    r170 r304  
    1818
    1919# Overwrite the debug level for the extension code if configured
    20 OPTION(DEBUG_LEVEL_ACL_WL "Overwrite debug level for the extension acl_wl if defined" OFF)
     20OPTION(DEBUG_LEVEL_ACL_WL "Overwrite debug level for the extension acl_wl if defined (valid values: FULL, ANNOYING, CALL...)" OFF)
    2121IF (DEBUG_LEVEL_ACL_WL)
    2222     ADD_DEFINITIONS(-DTRACE_LEVEL=${DEBUG_LEVEL_ACL_WL})
    2323ENDIF (DEBUG_LEVEL_ACL_WL)
     24IF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
     25  MARK_AS_ADVANCED(DEBUG_LEVEL_ACL_WL)
     26ENDIF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
    2427
    2528# Compile as a module
    2629FD_ADD_EXTENSION(acl_wl ${ACL_WL_SRC})
     30
     31
     32####
     33## INSTALL section ##
     34
     35# We install with the daemon component because it is a base feature.
     36INSTALL(TARGETS acl_wl
     37        LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
     38        COMPONENT freeDiameter-daemon)
  • extensions/app_acct/CMakeLists.txt

    r289 r304  
    2929FD_ADD_EXTENSION(app_acct ${APP_ACCT_SRC} ${APP_ACCT_SRC_GEN})
    3030TARGET_LINK_LIBRARIES(app_acct ${POSTGRESQL_LIBRARIES})
     31
     32
     33####
     34## INSTALL section ##
     35
     36INSTALL(TARGETS app_acct
     37        LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
     38        COMPONENT freeDiameter-accounting-server)
     39
  • extensions/app_radgw/CMakeLists.txt

    r268 r304  
    44
    55# Overwrite the debug level for the extension code if configured
    6 OPTION(DEBUG_LEVEL_APP_RADGW "Overwrite debug level for the extension app_radgw if defined" OFF)
     6OPTION(DEBUG_LEVEL_APP_RADGW "Overwrite debug level for the extension app_radgw if defined (valid values: FULL, ANNOYING, CALL...)" OFF)
    77IF (DEBUG_LEVEL_APP_RADGW)
    88     ADD_DEFINITIONS(-DTRACE_LEVEL=${DEBUG_LEVEL_APP_RADGW})
    99ENDIF (DEBUG_LEVEL_APP_RADGW)
     10IF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
     11  MARK_AS_ADVANCED(DEBUG_LEVEL_APP_RADGW)
     12ENDIF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
    1013
    1114
     
    6568  SET_TARGET_PROPERTIES(${PLGNAME} PROPERTIES SUFFIX ".rgwx" )
    6669  TARGET_LINK_LIBRARIES(${PLGNAME} rgw_common)
     70  INSTALL(TARGETS ${PLGNAME}
     71        LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
     72        COMPONENT freeDiameter-radius-gateway)
    6773ENDMACRO(RGWX_ADD_PLUGIN)
    6874
     
    103109           RGWX_ADD_PLUGIN(echodrop ${RG_COMMON_HEADER} rgwx_echodrop.h rgwx_echodrop.c lex.rgwx_echodrop.c rgwx_echodrop.tab.c rgwx_echodrop.tab.h )
    104110        ENDIF (BUILD_RGWX_ECHODROP)
     111       
     112       
     113####
     114## INSTALL section ##
     115
     116INSTALL(TARGETS app_radgw
     117        LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
     118        COMPONENT freeDiameter-radius-gateway)
     119
     120# Note that all compiled plugins are added by the RGWX_ADD_PLUGIN macro in the component freeDiameter-radius-gateway as well.
  • extensions/app_radgw/rgw_conf.y

    r258 r304  
    5353#include "rgw_conf.tab.h"       /* bison is not smart enough to define the YYLTYPE before including this code, so... */
    5454
    55 #include <sys/stat.h>
    5655#include <sys/socket.h>
    5756#include <arpa/inet.h>
     
    9796        else
    9897                fd_log_debug("%s:%d.%d : %s\n", conffile, ploc->first_line, ploc->first_column, s);
    99 }
    100 
    101 /* This function checks a string value is a valid filename */
    102 static int is_valid_file( char * candidate )
    103 {
    104         int ret;
    105         struct stat buffer;
    106        
    107         ret = stat(candidate, &buffer);
    108         if (ret != 0) {
    109                 fd_log_debug("Error on file '%s': %s.\n", candidate, strerror(errno));
    110                 return 0;
    111         }
    112 
    113         /* Ok this candidate is valid */
    114         return 1;
    11598}
    11699
     
    161144%token <ss>     IP
    162145
    163 %type <string>  FILENAME
     146%type <string>  FINDFILEEXT
    164147
    165148/* simple tokens */
     
    197180                               
    198181/* -------------------------------------- */
    199 FILENAME:               QSTRING
    200                         {
    201                                 /* Verify this is a valid file */
    202                                 if (!is_valid_file($1)) {
    203                                         yyerror (&yylloc, conffile, "Error on file name, aborting...");
    204                                         YYERROR;
    205                                 }
    206                                 $$ = $1;
     182FINDFILEEXT:            QSTRING
     183                        {
     184                                char * fname = $1;
     185                                FILE * fd;
     186                               
     187                                /* First, check if the file exists */
     188                                fd = fopen(fname, "r");
     189                                if ((fd == NULL) && (*fname != '/')) {
     190                                        char * bkp = fname;
     191                                        CHECK_MALLOC_DO( fname = malloc( strlen(bkp) + strlen(DEFAULT_EXTENSIONS_PATH) + 2 ),
     192                                                { yyerror (&yylloc, conffile, "Not enough memory"); YYERROR; } );
     193                                        sprintf(fname, DEFAULT_EXTENSIONS_PATH "/%s", bkp);
     194                                        free(bkp);
     195                                        fd = fopen(fname, "r");
     196                                }
     197                                if (fd == NULL) {
     198                                        int ret = errno;
     199                                        TRACE_DEBUG(INFO, "Unable to open file %s for reading: %s\n", fname, strerror(ret));
     200                                        yyerror (&yylloc, conffile, "Error adding plugin");
     201                                        YYERROR;
     202                                }
     203                                fclose(fd);
     204                               
     205                                $$ = fname;
    207206                        }
    208207                        ;
     
    214213                                free(plgconffile); plgconffile = NULL;
    215214                        }
    216                         PLG_PREFIX '=' FILENAME plg_attributes ';'
     215                        PLG_PREFIX '=' FINDFILEEXT plg_attributes ';'
    217216                        {
    218217                                /* Add this extension in the list */
  • extensions/dbg_monitor/CMakeLists.txt

    r120 r304  
    22PROJECT("Monitor extension" C)
    33FD_ADD_EXTENSION(dbg_monitor dbg_monitor.c)
     4
     5
     6####
     7## INSTALL section ##
     8
     9INSTALL(TARGETS dbg_monitor
     10        LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
     11        COMPONENT freeDiameter-debug-tools)
     12
  • extensions/dbg_rt/CMakeLists.txt

    r120 r304  
    44# Compile as a module
    55FD_ADD_EXTENSION(dbg_rt dbg_rt.c)
     6
     7
     8####
     9## INSTALL section ##
     10
     11INSTALL(TARGETS dbg_rt
     12        LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
     13        COMPONENT freeDiameter-debug-tools)
  • extensions/dict_eap/CMakeLists.txt

    r10 r304  
    44# Compile as a module
    55FD_ADD_EXTENSION(dict_eap dict_eap.c)
     6
     7
     8####
     9## INSTALL section ##
     10
     11INSTALL(TARGETS dict_eap
     12        LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
     13        COMPONENT freeDiameter-dictionary-RFC4072)
  • extensions/dict_nasreq/CMakeLists.txt

    r10 r304  
    44# Compile as a module
    55FD_ADD_EXTENSION(dict_nasreq dict_nasreq.c)
     6
     7
     8####
     9## INSTALL section ##
     10
     11INSTALL(TARGETS dict_nasreq
     12        LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
     13        COMPONENT freeDiameter-dictionary-RFC4005)
  • extensions/rt_default/CMakeLists.txt

    r170 r304  
    3232
    3333# Overwrite the debug level for the extension code if configured, example: cmake -DDEBUG_LEVEL_RT_DEFAULT:STATIC=CALL ...
    34 OPTION(DEBUG_LEVEL_RT_DEFAULT "Overwrite debug level for the extension rt_default if defined" OFF)
     34OPTION(DEBUG_LEVEL_RT_DEFAULT "Overwrite debug level for the extension rt_default if defined (valid values: FULL, ANNOYING, CALL...)" OFF)
    3535IF (DEBUG_LEVEL_RT_DEFAULT)
    3636     ADD_DEFINITIONS(-DTRACE_LEVEL=${DEBUG_LEVEL_RT_DEFAULT})
    3737ENDIF (DEBUG_LEVEL_RT_DEFAULT)
     38IF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
     39  MARK_AS_ADVANCED(DEBUG_LEVEL_RT_DEFAULT)
     40ENDIF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
    3841
    3942# Compile these files as a freeDiameter extension
    4043FD_ADD_EXTENSION(rt_default ${RT_DEFAULT_SRC})
     44
     45
     46####
     47## INSTALL section ##
     48
     49# We install with the daemon component because it is a base feature.
     50INSTALL(TARGETS rt_default
     51        LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
     52        COMPONENT freeDiameter-daemon)
     53
  • extensions/test_acct/CMakeLists.txt

    r279 r304  
    33
    44FD_ADD_EXTENSION(test_acct test_acct.c)
     5
     6
     7####
     8## INSTALL section ##
     9
     10INSTALL(TARGETS test_acct
     11        LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
     12        COMPONENT freeDiameter-debug-tools)
     13
  • extensions/test_app/CMakeLists.txt

    r235 r304  
    2121# Compile as a module
    2222FD_ADD_EXTENSION(test_app ${APP_TEST_SRC})
     23
     24
     25####
     26## INSTALL section ##
     27
     28INSTALL(TARGETS test_app
     29        LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
     30        COMPONENT freeDiameter-debug-tools)
     31
  • extensions/test_rt_any/CMakeLists.txt

    r120 r304  
    44# Compile as a module
    55FD_ADD_EXTENSION(test_rt_any test_rt_any.c)
     6
     7
     8####
     9## INSTALL section ##
     10
     11INSTALL(TARGETS test_rt_any
     12        LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH}
     13        COMPONENT freeDiameter-debug-tools)
  • freeDiameter/CMakeLists.txt

    r300 r304  
    5252        MESSAGE(SEND_ERROR "Unable to find gcrypt.h, please install libgcrypt-dev or equivalent")
    5353Endif ( NOT GCRYPT_INCLUDE_DIR )
     54MARK_AS_ADVANCED(GCRYPT_INCLUDE_DIR)
    5455INCLUDE_DIRECTORIES(${GCRYPT_INCLUDE_DIR})
    5556
     
    6465TARGET_LINK_LIBRARIES(freeDiameterd libfreeDiameter ${FD_LIBS})
    6566
    66 # The daemon is to be installed as part of the freeDiameter-daemon component.
    67 INSTALL(TARGETS freeDiameterd
    68         RUNTIME DESTINATION bin
    69         COMPONENT freeDiameter-daemon)
    70 
    7167# Save the list of files, if needed
    7268SET(FD_COMMON_SRC ${FD_COMMON_SRC} PARENT_SCOPE)
     
    7470
    7571# The unary tests directory
    76 OPTION(SKIP_TESTS "Skip compilation of the tests?" OFF)
     72OPTION(SKIP_TESTS "Skip compilation of the tests?" ON)
    7773IF ( NOT SKIP_TESTS )
    7874        SUBDIRS(tests)
    7975ENDIF ( NOT SKIP_TESTS )
     76IF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
     77  MARK_AS_ADVANCED(SKIP_TESTS)
     78ENDIF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
     79
     80
     81####
     82## INSTALL section ##
     83
     84INSTALL(TARGETS freeDiameterd
     85        RUNTIME DESTINATION bin
     86        COMPONENT freeDiameter-daemon)
  • freeDiameter/config.c

    r258 r304  
    3535
    3636#include "fD.h"
     37#include <sys/stat.h>
    3738
    3839/* Configuration management */
     
    5152       
    5253        fd_g_config->cnf_eyec = EYEC_CONFIG;
    53         fd_g_config->cnf_file = DEFAULT_CONF_FILE;
    5454       
    5555        fd_g_config->cnf_timer_tc = 30;
     
    145145        extern FILE * fddin;
    146146       
    147         TRACE_DEBUG (FULL, "Parsing configuration file: %s", fd_g_config->cnf_file);
     147        /* Attempt to find the configuration file */
     148        if (!fd_g_config->cnf_file)
     149                fd_g_config->cnf_file = FD_DEFAULT_CONF_FILENAME;
    148150       
    149151        fddin = fopen(fd_g_config->cnf_file, "r");
     152        if ((fddin == NULL) && (*fd_g_config->cnf_file != '/')) {
     153                /* We got a relative path, attempt to add the default directory prefix */
     154                char * bkp = fd_g_config->cnf_file;
     155                CHECK_MALLOC( fd_g_config->cnf_file = malloc(strlen(bkp) + strlen(DEFAULT_CONF_PATH) + 2) ); /* we will not free it, but not important */
     156                sprintf( fd_g_config->cnf_file, DEFAULT_CONF_PATH "/%s", bkp );
     157                fddin = fopen(fd_g_config->cnf_file, "r");
     158        }
    150159        if (fddin == NULL) {
    151160                int ret = errno;
     
    155164       
    156165        /* call yacc parser */
     166        TRACE_DEBUG (FULL, "Parsing configuration file: %s", fd_g_config->cnf_file);
    157167        CHECK_FCT(  fddparse(fd_g_config)  );
    158168       
  • freeDiameter/fD.h

    r285 r304  
    4242#include <freeDiameter/freeDiameter.h>
    4343
     44#ifndef FD_DEFAULT_CONF_FILENAME
     45#define FD_DEFAULT_CONF_FILENAME "freeDiameter.conf"
     46#endif /* FD_DEFAULT_CONF_FILENAME */
     47
    4448#ifdef DISABLE_SCTP
    4549#undef IPPROTO_SCTP
  • freeDiameter/fdd.y

    r258 r304  
    309309loadext:                LOADEXT '=' QSTRING extconf ';'
    310310                        {
    311                                 CHECK_FCT_DO( fd_ext_add( $3, $4 ),
     311                                char * fname;
     312                                char * cfname;
     313                                FILE * fd;
     314                               
     315                                /* Try and open the extension file */
     316                                fname = $3;
     317                                fd = fopen(fname, "r");
     318                                if ((fd == NULL) && (*fname != '/')) {
     319                                        char * bkp = fname;
     320                                        CHECK_MALLOC_DO( fname = malloc( strlen(bkp) + strlen(DEFAULT_EXTENSIONS_PATH) + 2 ),
     321                                                { yyerror (&yylloc, conf, "Not enough memory"); YYERROR; } );
     322                                        sprintf(fname, DEFAULT_EXTENSIONS_PATH "/%s", bkp);
     323                                        free(bkp);
     324                                        fd = fopen(fname, "r");
     325                                }
     326                                if (fd == NULL) {
     327                                        int ret = errno;
     328                                        TRACE_DEBUG(INFO, "Unable to open extension file %s for reading: %s\n", fname, strerror(ret));
     329                                        yyerror (&yylloc, conf, "Error adding extension");
     330                                        YYERROR;
     331                                }
     332                                fclose(fd);
     333                               
     334                                /* Try and open the configuration file (optional) */
     335                                cfname = $4;
     336                                if (cfname) {
     337                                        fd = fopen(cfname, "r");
     338                                        if ((fd == NULL) && (*cfname != '/')) {
     339                                                char * test;
     340                                                CHECK_MALLOC_DO( test = malloc( strlen(cfname) + strlen(DEFAULT_CONF_PATH) + 2 ),
     341                                                        { yyerror (&yylloc, conf, "Not enough memory"); YYERROR; } );
     342                                                sprintf(test, DEFAULT_CONF_PATH "/%s", cfname);
     343                                                fd = fopen(test, "r");
     344                                                if (fd) {
     345                                                        free(cfname);
     346                                                        cfname=test;
     347                                                } else {
     348                                                        /* This is not an error, we allow an extension to wait for something else than a real conf file. */
     349                                                        free(test);
     350                                                }
     351                                        }
     352                                        if (fd)
     353                                                fclose(fd);
     354                                }
     355                               
     356                                CHECK_FCT_DO( fd_ext_add( fname, cfname ),
    312357                                        { yyerror (&yylloc, conf, "Error adding extension"); YYERROR; } );
    313358                        }
  • freeDiameter/main.c

    r285 r304  
    310310                "  -V, --version          Print version and exit\n"
    311311                "  -c, --config=filename  Read configuration from this file instead of the \n"
    312                 "                           default location (%s).\n", DEFAULT_CONF_FILE);
     312                "                           default location (" DEFAULT_CONF_PATH "/" FD_DEFAULT_CONF_FILENAME ").\n");
    313313        printf( "\nDebug:\n"
    314314                "  These options are mostly useful for developers\n"
  • freeDiameter/tests/CMakeLists.txt

    r288 r304  
    110110   ADD_TEST(${TEST} ${EXECUTABLE_OUTPUT_PATH}/${TEST})
    111111ENDFOREACH( TEST )
     112
     113
     114####
     115## INSTALL section ##
     116
     117# we do not install the tests
  • include/freeDiameter/CMakeLists.txt

    r236 r304  
    66# Configurable parameters
    77
    8 # Name of the default configuration file
    9 OPTION(DEFAULT_CONF_FILE "Default path to configuration file?" OFF)
     8# The default directory for configuration files
     9SET(DEFAULT_CONF_PATH ${CMAKE_INSTALL_PREFIX}/etc/freeDiameter CACHE PATH "Default location of freeDiameter configuration files")
     10
     11# The default directory for extension files
     12SET(DEFAULT_EXTENSIONS_PATH ${CMAKE_INSTALL_PREFIX}/lib/fdx CACHE PATH "Default location of freeDiameter extensions")
    1013
    1114# Disable SCTP support completly ?
     
    1417        OPTION(DEBUG_SCTP "Verbose SCTP (for debug)?" OFF)
    1518        OPTION(SCTP_USE_MAPPED_ADDRESSES "Use v6-mapped v4 addresses in SCTP (workaround some SCTP limitations)?" OFF)
     19ELSE (NOT DISABLE_SCTP)
     20        MESSAGE(STATUS "Disabled SCTP support.")
    1621ENDIF (NOT DISABLE_SCTP)
    1722
     
    1924OPTION(ERRORS_ON_TODO "(development) Generate compilation errors on TODO items ?" OFF)
    2025
     26MARK_AS_ADVANCED(DISABLE_SCTP DEBUG_SCTP SCTP_USE_MAPPED_ADDRESSES ERRORS_ON_TODO)
    2127
    2228########################
     
    9096CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
    9197
    92 # The default configuration file name
    93 IF (NOT DEFAULT_CONF_FILE)
    94    SET(DEFAULT_CONF_FILE "freeDiameter.conf")
    95 ENDIF (NOT DEFAULT_CONF_FILE)
    9698##########################
    9799
     
    99101CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeDiameter-host.h.in ${CMAKE_CURRENT_BINARY_DIR}/freeDiameter-host.h)
    100102
    101 # Save the FD_LIBS for parent scope
     103# Save some variables for the other directories
    102104SET(FD_LIBS ${FD_LIBS} PARENT_SCOPE)
     105SET(DEFAULT_CONF_PATH ${DEFAULT_CONF_PATH} PARENT_SCOPE)
     106SET(DEFAULT_EXTENSIONS_PATH ${DEFAULT_EXTENSIONS_PATH} PARENT_SCOPE)
     107
     108
     109####
     110## INSTALL section ##
     111
     112# The headers from this directory are required to develop new extensions for freeDiameter.
     113INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/freeDiameter-host.h libfreeDiameter.h freeDiameter.h extension.h
     114        DESTINATION include/freeDiameter
     115        COMPONENT freeDiameter-dev)
     116
  • include/freeDiameter/freeDiameter-host.h.in

    r51 r304  
    7070#cmakedefine FD_PROJECT_COPYRIGHT "@FD_PROJECT_COPYRIGHT@"
    7171
    72 #cmakedefine DEFAULT_CONF_FILE "@DEFAULT_CONF_FILE@"
    73 
     72#cmakedefine DEFAULT_CONF_PATH "@DEFAULT_CONF_PATH@"
     73#cmakedefine DEFAULT_EXTENSIONS_PATH "@DEFAULT_EXTENSIONS_PATH@"
    7474
    7575#endif /* FD_IS_CONFIG */
  • include/freeDiameter/libfreeDiameter.h

    r302 r304  
    224224}
    225225#else /* DEBUG */
    226 /* Do not print thread, function, ... only the message itself in this case. */
    227 #define TRACE_DEBUG(level,format,args... ) {            \
    228         if ( TRACE_BOOL(level) ) {                      \
    229                 fd_log_debug(format "\n", ## args);     \
    230         }                                               \
     226/* Do not print thread, function, ... only the message itself in this case, unless the debug level is set > FULL. */
     227#define TRACE_DEBUG(level,format,args... ) {                                                                                            \
     228        if ( TRACE_BOOL(level) ) {                                                                                                      \
     229                if (fd_g_debug_lvl > FULL) {                                                                                            \
     230                        char __buf[25];                                                                                                 \
     231                        char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed");                                       \
     232                        fd_log_debug("\t | tid:%-20s\t%s\tin %s@%s:%d\n"                                                                \
     233                                  "\t%s|%*s" format "\n",                                                                               \
     234                                                __thn, fd_log_time(NULL, __buf, sizeof(__buf)), __PRETTY_FUNCTION__, __FILE__, __LINE__,\
     235                                                (level < FULL)?"@":" ",level, "", ## args);                                             \
     236                } else {                                                                                                                \
     237                        fd_log_debug(format "\n", ## args);                                                                             \
     238                }                                                                                                                       \
     239        }                                                                                                                               \
    231240}
    232241#endif /* DEBUG */
  • libfreeDiameter/CMakeLists.txt

    r300 r304  
    2626TARGET_LINK_LIBRARIES(libfreeDiameter ${FD_LIBS})
    2727
    28 # The library is to be installed as part of the freeDiameter-common component.
     28# Save the list of files for testcases in the daemon's directory
     29SET(LFD_SRC ${LFD_SRC} PARENT_SCOPE)
     30
     31
     32####
     33## INSTALL section ##
     34
    2935INSTALL(TARGETS libfreeDiameter
    3036        LIBRARY DESTINATION lib
    3137        COMPONENT freeDiameter-common)
    3238
    33 # Save the list of files for testcases in the daemon's directory
    34 SET(LFD_SRC ${LFD_SRC} PARENT_SCOPE)
    35 
Note: See TracChangeset for help on using the changeset viewer.