Navigation


Changeset 9:fc7c18867cf7 in freeDiameter


Ignore:
Timestamp:
Sep 24, 2009, 2:01:48 PM (15 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

New extension mechanism committed

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r8 r9  
    2323# All source code should be POSIX 200112L compatible, but some other extensions might be used, so:
    2424ADD_DEFINITIONS(-D_GNU_SOURCE)
     25IF (CMAKE_BUILD_TYPE MATCHES "Debug")
     26  SET(DEBUG 1)
     27ENDIF (CMAKE_BUILD_TYPE MATCHES "Debug")
    2528
    2629# some subfolders use yacc and lex parsers
  • doc/freediameter.conf.sample

    r8 r9  
    129129TwTimer = 6;
    130130NoRelay;
    131 LoadExtension = "extensions/sample.so";
    132 LoadExtension = "extensions/sample.so":"conf/sample.conf";
     131#LoadExtension = "extensions/sample.fdx";
     132LoadExtension = "extensions/sample.fdx":"conf/sample.conf";
  • extensions/CMakeLists.txt

    r8 r9  
    33# We want all resulting objects in the same folder
    44SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
    5 # And named fdext_XXX instead of libXXX.so
    65
    7 #-- faire une macro ici!
    8 SET(FD_EXT_PREFIX "fdext_" PARENT_SCOPE)
    9 SET(FD_EXT_SUFFIX "" PARENT_SCOPE)
     6# Use the macro FD_ADD_EXTENSION(name files...) to create an extension
     7# It is equivalent to add_library with the appropriate parameters
     8# and naming conventions (.fdx : FreeDiameter eXtension)
     9MACRO(FD_ADD_EXTENSION EXTNAME)
     10  ADD_LIBRARY(${EXTNAME} MODULE ${ARGN})
     11  SET_TARGET_PROPERTIES(${EXTNAME} PROPERTIES PREFIX "" )
     12  SET_TARGET_PROPERTIES(${EXTNAME} PROPERTIES SUFFIX ".fdx" )
     13ENDMACRO(FD_ADD_EXTENSION)
    1014
    1115###########################
  • extensions/_sample/CMakeLists.txt

    r8 r9  
    33
    44# Compile as a module
    5 ADD_LIBRARY(sample MODULE sample.c fini.c)
    6 
    7 # Comply to naming scheme
    8 SET_TARGET_PROPERTIES(sample PROPERTIES PREFIX "${FD_EXT_PREFIX}" )
    9 SET_TARGET_PROPERTIES(sample PROPERTIES SUFFIX "${FD_EXT_SUFFIX}" )
     5FD_ADD_EXTENSION(sample sample.c fini.c)
  • extensions/_sample/fini.c

    r8 r9  
    4040void fd_ext_fini(void)
    4141{
    42         log_debug("Extension is terminated... Bye!\n");
     42        fd_log_debug("Extension is terminated... Bye!\n");
    4343        return ;
    4444}
  • extensions/_sample/sample.c

    r8 r9  
    5656       
    5757        /* Use the dictionary for test */
    58         log_debug("Let's create that 'Example-AVP'...\n");
     58        fd_log_debug("Let's create that 'Example-AVP'...\n");
    5959        {
    6060                struct dict_object * origin_host_avp = NULL;
     
    7979                CHECK_FCT( fd_dict_new ( fd_g_config->g_dict, DICT_RULE, &rule_data, example_avp_avp, NULL ));
    8080        }
    81         log_debug("'Example-AVP' created without error\n");
     81        fd_log_debug("'Example-AVP' created without error\n");
    8282       
    8383        return 0;
  • freeDiameter/extensions.c

    r8 r9  
    9797               
    9898                /* Load the extension */
     99#ifndef DEBUG
    99100                ext->handler = dlopen(ext->filename, RTLD_LAZY | RTLD_GLOBAL);
     101#else /* DEBUG */
     102                /* We resolve immediatly so it's easier to find problems in ABI */
     103                ext->handler = dlopen(ext->filename, RTLD_NOW | RTLD_GLOBAL);
     104#endif /* DEBUG */
    100105                if (ext->handler == NULL) {
    101106                        /* An error occured */
  • freeDiameter/main.c

    r8 r9  
    247247       
    248248        /* cleanups */
    249         CHECK_FCT( fd_thr_term(&sig_th) );
     249        CHECK_FCT_DO( fd_ext_fini(), /* continue */ );
     250        CHECK_FCT_DO( fd_thr_term(&sig_th), /* continue */ );
    250251       
    251252        return ret;
  • include/freeDiameter/freeDiameter-host.h.in

    r8 r9  
    4646#cmakedefine DISABLE_SCTP
    4747
     48#cmakedefine DEBUG
     49
    4850#cmakedefine FD_PROJECT_BINARY "@FD_PROJECT_BINARY@"
    4951#cmakedefine FD_PROJECT_NAME "@FD_PROJECT_NAME@"
Note: See TracChangeset for help on using the changeset viewer.