Brian Waters | 13d9601 | 2017-12-08 16:53:31 -0600 | [diff] [blame] | 1 | # The app_radgw extension |
| 2 | PROJECT("RADIUS/Diameter extensible gateway application for freeDiameter" C) |
| 3 | |
| 4 | |
| 5 | ########### Main app_radgw extension ############# |
| 6 | |
| 7 | # Parser files |
| 8 | BISON_FILE(rgw_conf.y) |
| 9 | FLEX_FILE(rgw_conf.l) |
| 10 | SET_SOURCE_FILES_PROPERTIES(lex.rgw_conf.c rgw_conf.tab.c PROPERTIES COMPILE_FLAGS "-I ${CMAKE_CURRENT_SOURCE_DIR}") |
| 11 | |
| 12 | # List of source files |
| 13 | SET( RGW_DEFAULT_SRC |
| 14 | radius.c |
| 15 | md5.c |
| 16 | rgw_msg_codes.c |
| 17 | rgw_msg_attrtype.c |
| 18 | rgw_main.c |
| 19 | lex.rgw_conf.c |
| 20 | rgw_conf.tab.c |
| 21 | rgw_conf.tab.h |
| 22 | rgw_clients.c |
| 23 | rgw_plugins.c |
| 24 | rgw_servers.c |
| 25 | rgw_worker.c |
| 26 | ) |
| 27 | |
| 28 | SET( RG_COMMON_HEADER |
| 29 | rgw_common.h |
| 30 | radius.h |
| 31 | md5.h |
| 32 | hostap_compat.h |
| 33 | ) |
| 34 | |
| 35 | # Compile these files as a freeDiameter extension. |
| 36 | FD_ADD_EXTENSION(app_radgw ${RGW_DEFAULT_SRC} ${RG_COMMON_HEADER}) |
| 37 | |
| 38 | |
| 39 | ########### RADIUS/Diameter translation agent plugins (support for RADIUS protocol) ############ |
| 40 | # Use the macro RGWX_ADD_PLUGIN(name files...) to create a plugin. |
| 41 | # It is equivalent to add_library with the appropriate parameters |
| 42 | # and naming conventions (.rgwx : Radius GateWay eXtension) |
| 43 | MACRO(RGWX_ADD_PLUGIN PLGNAME) |
| 44 | ADD_LIBRARY(${PLGNAME} MODULE ${ARGN}) |
| 45 | SET_TARGET_PROPERTIES(${PLGNAME} PROPERTIES PREFIX "" ) |
| 46 | SET_TARGET_PROPERTIES(${PLGNAME} PROPERTIES SUFFIX ".rgwx" ) |
| 47 | INSTALL(TARGETS ${PLGNAME} |
| 48 | LIBRARY DESTINATION ${INSTALL_EXTENSIONS_SUFFIX} |
| 49 | COMPONENT freeDiameter-radius-gateway) |
| 50 | ENDMACRO(RGWX_ADD_PLUGIN) |
| 51 | |
| 52 | # Ask unless ALL_EXTENSIONS is set: |
| 53 | MACRO(FD_OPTION_PLUGIN PLGVAR DESCR DEFLT) |
| 54 | IF (NOT ALL_EXTENSIONS) |
| 55 | OPTION(BUILD_${PLGVAR} ${DESCR} ${DEFLT}) |
| 56 | ENDIF (NOT ALL_EXTENSIONS) |
| 57 | IF (BUILD_${PLGVAR} OR ALL_EXTENSIONS) |
| 58 | SET(${PLGVAR} TRUE) |
| 59 | ELSE (BUILD_${PLGVAR} OR ALL_EXTENSIONS) |
| 60 | SET(${PLGVAR} FALSE) |
| 61 | ENDIF (BUILD_${PLGVAR} OR ALL_EXTENSIONS) |
| 62 | ENDMACRO(FD_OPTION_PLUGIN PLGVAR DESCR DEFLT) |
| 63 | |
| 64 | |
| 65 | ### Debug |
| 66 | # Example of plugin: |
| 67 | |
| 68 | FD_OPTION_PLUGIN(RGWX_SAMPLE "Build sample plugin? (for developers only)" OFF) |
| 69 | IF (RGWX_SAMPLE) |
| 70 | RGWX_ADD_PLUGIN(sample ${RG_COMMON_HEADER} rgwx_sample.c) |
| 71 | ENDIF (RGWX_SAMPLE) |
| 72 | |
| 73 | # A plugin for debug: dumps RADIUS and Diameter messages state at the time the plugin is called. |
| 74 | FD_OPTION_PLUGIN(RGWX_DEBUG "Build debug plugin? (display status of RADIUS and Diameter messages)" ON) |
| 75 | IF (RGWX_DEBUG) |
| 76 | RGWX_ADD_PLUGIN(debug ${RG_COMMON_HEADER} rgwx_debug.c) |
| 77 | ENDIF (RGWX_DEBUG) |
| 78 | |
| 79 | |
| 80 | ### Authentication, Authorization messages translation. |
| 81 | FD_OPTION_PLUGIN(RGWX_AUTH "Build Authentication & Authorization RADIUS translation plugin? (RFC2865, RFC3579)" ON) |
| 82 | IF (RGWX_AUTH) |
| 83 | RGWX_ADD_PLUGIN(auth ${RG_COMMON_HEADER} rgwx_auth.c) |
| 84 | ENDIF (RGWX_AUTH) |
| 85 | |
| 86 | ### SIP Authentication, Authorization messages translation. |
| 87 | FD_OPTION_PLUGIN(RGWX_SIP "Build SIP RADIUS translation plugin? (RFC4740 or RFC5090)" OFF) |
| 88 | IF (RGWX_SIP) |
| 89 | RGWX_ADD_PLUGIN(sip ${RG_COMMON_HEADER} rgwx_sip.c) |
| 90 | ENDIF (RGWX_SIP) |
| 91 | |
| 92 | |
| 93 | |
| 94 | ### Accounting messages translation. |
| 95 | FD_OPTION_PLUGIN(RGWX_ACCT "Build Accounting RADIUS translation plugin? (RFC2866)" ON) |
| 96 | IF (RGWX_ACCT) |
| 97 | RGWX_ADD_PLUGIN(acct ${RG_COMMON_HEADER} rgwx_acct.c) |
| 98 | ENDIF (RGWX_ACCT) |
| 99 | |
| 100 | |
| 101 | ### Generic plugin to handle some attributes (either delete them or simply echo them in the answer) |
| 102 | FD_OPTION_PLUGIN(RGWX_ECHODROP "Build 'echo/drop' plugin? (drop specific RADIUS attributes or echo them in RADIUS answer)" ON) |
| 103 | IF (RGWX_ECHODROP) |
| 104 | BISON_FILE(rgwx_echodrop.y) |
| 105 | FLEX_FILE(rgwx_echodrop.l) |
| 106 | SET_SOURCE_FILES_PROPERTIES(lex.rgwx_echodrop.c rgwx_echodrop.tab.c PROPERTIES COMPILE_FLAGS "-I ${CMAKE_CURRENT_SOURCE_DIR}") |
| 107 | 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 ) |
| 108 | ENDIF (RGWX_ECHODROP) |
| 109 | |
| 110 | |
| 111 | #### |
| 112 | ## INSTALL section ## |
| 113 | |
| 114 | INSTALL(TARGETS app_radgw |
| 115 | LIBRARY DESTINATION ${INSTALL_EXTENSIONS_SUFFIX} |
| 116 | COMPONENT freeDiameter-radius-gateway) |
| 117 | |
| 118 | # Note that all compiled plugins are added by the RGWX_ADD_PLUGIN macro in the component freeDiameter-radius-gateway as well. |