|
version 1.2.2.4, 2012/04/24 08:06:08
|
version 1.3, 2012/07/03 09:02:50
|
|
Line 2
|
Line 2
|
| #include "rtlm.h" |
#include "rtlm.h" |
| |
|
| |
|
| static void *acc_rtlm, *pub_rtlm, *log_rtlm; |
|
| |
|
| struct tagCallbacks call; |
struct tagCallbacks call; |
| |
|
| |
|
|
Line 53 mqttLoadRTLM(cfg_root_t *cfg, int modtype)
|
Line 51 mqttLoadRTLM(cfg_root_t *cfg, int modtype)
|
| return NULL; |
return NULL; |
| } |
} |
| |
|
| rtlm = dlopen(str, RTLD_LAZY); | rtlm = dlopen(str, RTLD_NOW); |
| if (!rtlm) { |
if (!rtlm) { |
| mqttLog("Error:: RTL module %s not found %s\n", str, dlerror()); |
mqttLog("Error:: RTL module %s not found %s\n", str, dlerror()); |
| return NULL; |
return NULL; |
|
Line 74 mqttLoadRTLM(cfg_root_t *cfg, int modtype)
|
Line 72 mqttLoadRTLM(cfg_root_t *cfg, int modtype)
|
| |
|
| switch (modtype) { |
switch (modtype) { |
| case 0: |
case 0: |
| acc_rtlm = rtlm; |
|
| call.OpenACC = mqttOpenRTLM; |
call.OpenACC = mqttOpenRTLM; |
| call.CloseACC = mqttCloseRTLM; |
call.CloseACC = mqttCloseRTLM; |
| call.LoginACC = dlsym(rtlm, "mqtt_rtlm_login"); |
call.LoginACC = dlsym(rtlm, "mqtt_rtlm_login"); |
|
Line 85 mqttLoadRTLM(cfg_root_t *cfg, int modtype)
|
Line 82 mqttLoadRTLM(cfg_root_t *cfg, int modtype)
|
| } |
} |
| break; |
break; |
| case 1: |
case 1: |
| pub_rtlm = rtlm; |
|
| call.OpenPUB = mqttOpenRTLM; |
call.OpenPUB = mqttOpenRTLM; |
| call.ClosePUB = mqttCloseRTLM; |
call.ClosePUB = mqttCloseRTLM; |
| call.InitSessPUB = dlsym(rtlm, "mqtt_rtlm_init_session"); |
call.InitSessPUB = dlsym(rtlm, "mqtt_rtlm_init_session"); |
|
Line 94 mqttLoadRTLM(cfg_root_t *cfg, int modtype)
|
Line 90 mqttLoadRTLM(cfg_root_t *cfg, int modtype)
|
| call.WritePUB_topic = dlsym(rtlm, "mqtt_rtlm_write_topic"); |
call.WritePUB_topic = dlsym(rtlm, "mqtt_rtlm_write_topic"); |
| call.ReadPUB_topic = dlsym(rtlm, "mqtt_rtlm_read_topic"); |
call.ReadPUB_topic = dlsym(rtlm, "mqtt_rtlm_read_topic"); |
| call.DeletePUB_topic = dlsym(rtlm, "mqtt_rtlm_delete_topic"); |
call.DeletePUB_topic = dlsym(rtlm, "mqtt_rtlm_delete_topic"); |
| |
call.WipePUB_topic = dlsym(rtlm, "mqtt_rtlm_wipe_topic"); |
| call.WritePUB_subscribe = dlsym(rtlm, "mqtt_rtlm_write_subscribe"); |
call.WritePUB_subscribe = dlsym(rtlm, "mqtt_rtlm_write_subscribe"); |
| call.ReadPUB_subscribe = dlsym(rtlm, "mqtt_rtlm_read_subscribe"); |
call.ReadPUB_subscribe = dlsym(rtlm, "mqtt_rtlm_read_subscribe"); |
| call.DeletePUB_subscribe = dlsym(rtlm, "mqtt_rtlm_delete_subscribe"); |
call.DeletePUB_subscribe = dlsym(rtlm, "mqtt_rtlm_delete_subscribe"); |
|
Line 107 mqttLoadRTLM(cfg_root_t *cfg, int modtype)
|
Line 104 mqttLoadRTLM(cfg_root_t *cfg, int modtype)
|
| } |
} |
| break; |
break; |
| default: |
default: |
| log_rtlm = rtlm; |
|
| call.OpenLOG = mqttOpenRTLM; |
call.OpenLOG = mqttOpenRTLM; |
| call.CloseLOG = mqttCloseRTLM; |
call.CloseLOG = mqttCloseRTLM; |
| call.LOG = dlsym(rtlm, "mqtt_rtlm_logger"); |
call.LOG = dlsym(rtlm, "mqtt_rtlm_logger"); |
|
Line 123 mqttLoadRTLM(cfg_root_t *cfg, int modtype)
|
Line 119 mqttLoadRTLM(cfg_root_t *cfg, int modtype)
|
| } |
} |
| |
|
| void |
void |
| mqttUnloadRTLM(int modtype) | mqttUnloadRTLM(void *rtlm) |
| { |
{ |
| switch (modtype) { | if (rtlm) |
| case 0: | dlclose(rtlm); |
| dlclose(acc_rtlm); | |
| break; | |
| case 1: | |
| dlclose(pub_rtlm); | |
| break; | |
| default: | |
| dlclose(log_rtlm); | |
| break; | |
| } | |
| } |
} |
| |
|
| inline int |
inline int |