fold version macros into runtime functions to avoid cascade rebuilds when modifying the core

This commit is contained in:
Anthony Minessale 2014-01-17 01:54:47 +05:00
parent 104ce2a35f
commit 8dfbd91a3d
22 changed files with 157 additions and 39 deletions

View File

@ -251,6 +251,7 @@ libfreeswitch_la_SOURCES = \
src/switch_core_rwlock.c \
src/switch_core_port_allocator.c \
src/switch_core.c \
src/switch_version.c \
src/switch_core_media.c \
src/switch_sdp.c \
src/switch_scheduler.c \
@ -307,8 +308,6 @@ if ENABLE_CPP
libfreeswitch_la_SOURCES += src/switch_cpp.cpp
endif
$(top_builddir)/libfreeswitch_la-switch_console.lo: src/include/switch_version.h
$(libfreeswitch_la_SOURCES): $(CORE_LIBS) $(switch_builddir)/quiet_libtool $(switch_builddir)/modules.conf
src/include/switch_swigable_cpp.h: $(switch_srcdir)/src/include/switch_cpp.h

View File

@ -6,7 +6,7 @@ cd ../../../..
cd src/mod/legacy/languages/mod_lua
make swigclean
make lua_wrap
cd ../../../..
cd ../../../../..
cd src/mod/languages/mod_perl
make swigclean

View File

@ -40,8 +40,6 @@
#endif
#include <switch.h>
#include <switch_version.h>
/* Picky compiler */
#ifdef __ICC

View File

@ -2603,6 +2603,15 @@ SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t
SWITCH_DECLARE(switch_call_direction_t) switch_ice_direction(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_session_debug_pool(switch_stream_handle_t *stream);
SWITCH_DECLARE(const char *)switch_version_major(void);
SWITCH_DECLARE(const char *)switch_version_minor(void);
SWITCH_DECLARE(const char *)switch_version_micro(void);
SWITCH_DECLARE(const char *)switch_version_revision(void);
SWITCH_DECLARE(const char *)switch_version_revision_human(void);
SWITCH_DECLARE(const char *)switch_version_full(void);
SWITCH_DECLARE(const char *)switch_version_full_human(void);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:

View File

@ -42,7 +42,6 @@
*/
#include <switch.h>
#include <switch_stun.h>
#include <switch_version.h>
SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown);
@ -536,7 +535,7 @@ SWITCH_STANDARD_API(version_function)
char *mydata = NULL, *argv[2];
if (zstr(cmd)) {
stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_REVISION_HUMAN);
stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", switch_version_full(), switch_version_revision_human());
goto end;
}
@ -546,9 +545,9 @@ SWITCH_STANDARD_API(version_function)
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if (argc > 0 && switch_stristr("short", argv[0])) {
stream->write_function(stream, "%s.%s.%s\n", SWITCH_VERSION_MAJOR,SWITCH_VERSION_MINOR,SWITCH_VERSION_MICRO);
stream->write_function(stream, "%s.%s.%s\n", switch_version_major(),switch_version_minor(),switch_version_micro());
} else {
stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_FULL_HUMAN);
stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", switch_version_full(), switch_version_full_human());
}
switch_safe_free(mydata);
@ -2106,7 +2105,7 @@ SWITCH_STANDARD_API(status_function)
duration.sec, duration.sec == 1 ? "" : "s", duration.ms , duration.ms == 1 ? "" : "s", duration.mms,
duration.mms == 1 ? "" : "s", nl);
stream->write_function(stream, "FreeSWITCH (Version %s) is %s%s", SWITCH_VERSION_FULL_HUMAN,
stream->write_function(stream, "FreeSWITCH (Version %s) is %s%s", switch_version_full_human(),
switch_core_ready() ? "ready" : "not ready", nl);
stream->write_function(stream, "%" SWITCH_SIZE_T_FMT " session(s) since startup%s", switch_core_session_id() - 1, nl);
@ -6268,7 +6267,7 @@ SWITCH_STANDARD_JSON_API(json_api_function)
}
#include <switch_version.h>
SWITCH_STANDARD_JSON_API(json_status_function)
{
cJSON *o, *oo, *reply = cJSON_CreateObject();
@ -6298,7 +6297,7 @@ SWITCH_STANDARD_JSON_API(json_status_function)
cJSON_AddItemToObject(o, "microseconds", cJSON_CreateNumber(duration.mms));
cJSON_AddItemToObject(reply, "uptime", o);
cJSON_AddItemToObject(reply, "version", cJSON_CreateString(SWITCH_VERSION_FULL_HUMAN));
cJSON_AddItemToObject(reply, "version", cJSON_CreateString(switch_version_full_human()));
o = cJSON_CreateObject();
cJSON_AddItemToObject(reply, "sessions", o);

View File

@ -76,7 +76,6 @@
#define GSMOPEN_ALSA
#endif // NO_ALSA
#include <switch.h>
#include <switch_version.h>
#ifndef WIN32
#include <termios.h>
#include <sys/ioctl.h>
@ -132,7 +131,7 @@
//#define SAMPLES_PER_FRAME SAMPLERATE_GSMOPEN/50
#ifndef GSMOPEN_SVN_VERSION
#define GSMOPEN_SVN_VERSION SWITCH_VERSION_FULL
#define GSMOPEN_SVN_VERSION switch_version_full()
#endif /* GSMOPEN_SVN_VERSION */
typedef enum {

View File

@ -66,7 +66,6 @@
#define SAMPLERATE_GSMOPEN 8000
#include <switch.h>
#include <switch_version.h>
#ifndef WIN32
#include <termios.h>
#include <sys/ioctl.h>
@ -104,7 +103,7 @@
#endif
#ifndef GSMOPEN_SVN_VERSION
#define GSMOPEN_SVN_VERSION SWITCH_VERSION_FULL
#define GSMOPEN_SVN_VERSION switch_version_full()
#endif /* GSMOPEN_SVN_VERSION */
#include "ctb-0.16/ctb.h"

View File

@ -61,7 +61,6 @@
#define HAVE_APR
#include <switch.h>
#include <switch_version.h>
#define MODNAME "mod_h323"
#define OpalT38_IFP_COR GetOpalT38_IFP_COR()
#define OpalT38_IFP_PRE GetOpalT38_IFP_PRE()

View File

@ -45,7 +45,6 @@
#define _DEFS_H_
/* formatation macros */
#include "switch_version.h"
#include "revision.h"
#define KHOMP_LOG __FILE__, __SWITCH_FUNC__, __LINE__

View File

@ -33,7 +33,6 @@
#include <switch.h>
#include <switch_version.h>
#ifndef WIN32
#include <sys/time.h>
@ -85,7 +84,7 @@
#endif
#ifndef SKYPOPEN_SVN_VERSION
#define SKYPOPEN_SVN_VERSION SWITCH_VERSION_FULL
#define SKYPOPEN_SVN_VERSION switch_version_full()
#endif /* SKYPOPEN_SVN_VERSION */
typedef enum {

View File

@ -47,7 +47,6 @@
#define SOFIA_QUEUE_SIZE 50000
#define HAVE_APR
#include <switch.h>
#include <switch_version.h>
#define SOFIA_NAT_SESSION_TIMEOUT 90
#define SOFIA_MAX_ACL 100
#ifdef _MSC_VER
@ -96,7 +95,6 @@ typedef struct private_object private_object_t;
#define MULTICAST_EVENT "multicast::event"
#define SOFIA_REPLACES_HEADER "_sofia_replaces_"
#define SOFIA_USER_AGENT "FreeSWITCH-mod_sofia/" SWITCH_VERSION_FULL
#define SOFIA_CHAT_PROTO "sip"
#define SOFIA_MULTIPART_PREFIX "sip_mp_"
#define SOFIA_MULTIPART_PREFIX_T "~sip_mp_"

View File

@ -3742,7 +3742,8 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
profile->auto_rtp_bugs = RTP_BUG_CISCO_SKIP_MARK_BIT_2833;// | RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833;
profile->pool = pool;
profile->user_agent = SOFIA_USER_AGENT;
profile->user_agent = switch_core_sprintf(profile->pool, "FreeSWITCH-mod_sofia/%s", switch_version_full());
profile->name = switch_core_strdup(profile->pool, xprofilename);
switch_snprintf(url, sizeof(url), "sofia_reg_%s", xprofilename);

View File

@ -31,7 +31,6 @@
*
*/
#include <switch.h>
#include <switch_version.h>
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
@ -175,7 +174,7 @@ int handle_identity(netsnmp_mib_handler *handler, netsnmp_handler_registration *
{
netsnmp_request_info *request = NULL;
oid subid;
static char const version[] = SWITCH_VERSION_FULL;
static char const version[] = switch_version_full();
char uuid[40] = "";
switch(reqinfo->mode) {

View File

@ -14626,6 +14626,76 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_debug_pool(void * jarg1)
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_major() {
char * jresult ;
char *result = 0 ;
result = (char *)switch_version_major();
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_minor() {
char * jresult ;
char *result = 0 ;
result = (char *)switch_version_minor();
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_micro() {
char * jresult ;
char *result = 0 ;
result = (char *)switch_version_micro();
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_revision() {
char * jresult ;
char *result = 0 ;
result = (char *)switch_version_revision();
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_revision_human() {
char * jresult ;
char *result = 0 ;
result = (char *)switch_version_revision_human();
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_full() {
char * jresult ;
char *result = 0 ;
result = (char *)switch_version_full();
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_full_human() {
char * jresult ;
char *result = 0 ;
result = (char *)switch_version_full_human();
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) {
switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ;
char *arg2 = (char *) 0 ;

View File

@ -3150,6 +3150,41 @@ public class freeswitch {
freeswitchPINVOKE.switch_core_session_debug_pool(switch_stream_handle.getCPtr(stream));
}
public static string switch_version_major() {
string ret = freeswitchPINVOKE.switch_version_major();
return ret;
}
public static string switch_version_minor() {
string ret = freeswitchPINVOKE.switch_version_minor();
return ret;
}
public static string switch_version_micro() {
string ret = freeswitchPINVOKE.switch_version_micro();
return ret;
}
public static string switch_version_revision() {
string ret = freeswitchPINVOKE.switch_version_revision();
return ret;
}
public static string switch_version_revision_human() {
string ret = freeswitchPINVOKE.switch_version_revision_human();
return ret;
}
public static string switch_version_full() {
string ret = freeswitchPINVOKE.switch_version_full();
return ret;
}
public static string switch_version_full_human() {
string ret = freeswitchPINVOKE.switch_version_full_human();
return ret;
}
public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload);
return ret;
@ -10712,6 +10747,27 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_debug_pool")]
public static extern void switch_core_session_debug_pool(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_version_major")]
public static extern string switch_version_major();
[DllImport("mod_managed", EntryPoint="CSharp_switch_version_minor")]
public static extern string switch_version_minor();
[DllImport("mod_managed", EntryPoint="CSharp_switch_version_micro")]
public static extern string switch_version_micro();
[DllImport("mod_managed", EntryPoint="CSharp_switch_version_revision")]
public static extern string switch_version_revision();
[DllImport("mod_managed", EntryPoint="CSharp_switch_version_revision_human")]
public static extern string switch_version_revision_human();
[DllImport("mod_managed", EntryPoint="CSharp_switch_version_full")]
public static extern string switch_version_full();
[DllImport("mod_managed", EntryPoint="CSharp_switch_version_full_human")]
public static extern string switch_version_full_human();
[DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")]
public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2);
@ -35105,6 +35161,7 @@ namespace FreeSWITCH.Native {
public enum switch_rtp_flag_t {
SWITCH_RTP_FLAG_NOBLOCK = 0,
SWITCH_RTP_FLAG_DTMF_ON,
SWITCH_RTP_FLAG_IO,
SWITCH_RTP_FLAG_USE_TIMER,
SWITCH_RTP_FLAG_RTCP_PASSTHRU,

View File

@ -57,7 +57,6 @@
*
*/
#include <switch.h>
#include <switch_version.h>
#ifdef _MSC_VER
#pragma warning(disable:4142)
#endif
@ -811,6 +810,7 @@ abyss_bool handler_hook(TSession * r)
const char *uri = 0;
TRequestInfo *info = 0;
switch_event_t *evnt = 0; /* shortcut to stream.param_event */
char v[256] = "";
if (!r || !(info = &r->requestInfo) || !(uri = info->uri)) {
return FALSE;
@ -1008,7 +1008,8 @@ abyss_bool handler_hook(TSession * r)
}
/* Generation of the server field */
ResponseAddField(r, "Server", "FreeSWITCH-" SWITCH_VERSION_FULL "-mod_xml_rpc");
switch_sprintf(v, sizeof(v), "FreeSWITCH-%s-mod_xml_rpc", switch_version_full());
ResponseAddField(r, "Server", v);
if (html) {
ResponseAddField(r, "Content-Type", "text/html");

View File

@ -49,7 +49,6 @@
#endif
#include <switch.h>
#include <switch_version.h>
#include "private/switch_core_pvt.h"
/* pid filename: Stores the process id of the freeswitch process */
@ -676,7 +675,7 @@ int main(int argc, char *argv[])
}
else if (!strcmp(local_argv[x], "-version")) {
fprintf(stdout, "FreeSWITCH version: %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_REVISION_HUMAN);
fprintf(stdout, "FreeSWITCH version: %s (%s)\n", switch_version_full(), switch_version_revision_human());
exit(EXIT_SUCCESS);
}
#endif

View File

@ -32,7 +32,6 @@
#include <switch.h>
#include <switch_console.h>
#include <switch_version.h>
#ifndef _MSC_VER
#include <switch_private.h>
#endif

View File

@ -40,7 +40,6 @@
#include <switch_ssl.h>
#include <switch_stun.h>
#include <switch_nat.h>
#include <switch_version.h>
#include "private/switch_core_pvt.h"
#include <switch_curl.h>
#ifndef WIN32
@ -83,7 +82,7 @@ static void send_heartbeat(void)
duration.sec, duration.sec == 1 ? "" : "s",
duration.ms, duration.ms == 1 ? "" : "s", duration.mms, duration.mms == 1 ? "" : "s");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Version", SWITCH_VERSION_FULL);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Version", switch_version_full());
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Uptime-msec", "%"SWITCH_TIME_T_FMT, switch_core_uptime() / 1000);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Count", "%u", switch_core_session_count());
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Max-Sessions", "%u", switch_core_session_limit(0));
@ -2142,7 +2141,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
"\nFreeSWITCH Version %s (%s)\n\nFreeSWITCH Started\nMax Sessions [%u]\nSession Rate [%d]\nSQL [%s]\n",
SWITCH_VERSION_FULL, SWITCH_VERSION_REVISION_HUMAN,
switch_version_full(), switch_version_revision_human(),
switch_core_session_limit(0),
switch_core_sessions_per_second(0), switch_test_flag((&runtime), SCF_USE_SQL) ? "Enabled" : "Disabled");

View File

@ -33,7 +33,6 @@
#include <switch_ssl.h>
#include <switch_stun.h>
#include <switch_nat.h>
#include <switch_version.h>
#include "private/switch_core_pvt.h"
#include <switch_curl.h>
#include <errno.h>

View File

@ -51,7 +51,6 @@
#include <datatypes.h>
#include <srtp.h>
#include <srtp_priv.h>
#include <switch_version.h>
#include <switch_ssl.h>
#define FIR_COUNTDOWN 50
@ -757,7 +756,7 @@ static switch_status_t ice_out(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice)
switch_stun_packet_attribute_add_priority(packet, ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].priority);
switch_snprintf(sw, sizeof(sw), "FreeSWITCH (%s)", SWITCH_VERSION_REVISION_HUMAN);
switch_snprintf(sw, sizeof(sw), "FreeSWITCH (%s)", switch_version_revision_human());
switch_stun_packet_attribute_add_software(packet, sw, (uint16_t)strlen(sw));
if ((ice->type & ICE_CONTROLLED)) {

View File

@ -44,9 +44,6 @@
#endif
#include <switch.h>
#include <switch_version.h>
/* Picky compiler */
#ifdef __ICC