version 1.1.2.4, 2011/11/23 08:50:03
|
version 1.2.2.2, 2012/02/01 15:44:40
|
Line 4
|
Line 4
|
|
|
static void *acc_rtlm, *pub_rtlm, *log_rtlm; |
static void *acc_rtlm, *pub_rtlm, *log_rtlm; |
|
|
|
struct tagCallbacks call; |
|
|
|
|
/* |
/* |
* mqttLog() Log message to syslog |
* mqttLog() Log message to syslog |
* |
* |
Line 53 mqttLoadRTLM(sl_config *cfg, int modtype)
|
Line 55 mqttLoadRTLM(sl_config *cfg, int modtype)
|
|
|
rtlm = dlopen(str, RTLD_LAZY); |
rtlm = dlopen(str, RTLD_LAZY); |
if (!rtlm) { |
if (!rtlm) { |
mqttLog("Error:: RTL module not found %s\n", dlerror()); | mqttLog("Error:: RTL module %s not found %s\n", str, dlerror()); |
return NULL; |
return NULL; |
} |
} |
|
|
Line 73 mqttLoadRTLM(sl_config *cfg, int modtype)
|
Line 75 mqttLoadRTLM(sl_config *cfg, int modtype)
|
switch (modtype) { |
switch (modtype) { |
case 0: |
case 0: |
acc_rtlm = rtlm; |
acc_rtlm = rtlm; |
mqttOpenACC = mqttOpenRTLM; | call.OpenACC = mqttOpenRTLM; |
mqttCloseACC = mqttCloseRTLM; | call.CloseACC = mqttCloseRTLM; |
| call.LoginACC = dlsym(rtlm, "mqtt_rtlm_login"); |
| if (!call.LoginACC) { |
| mqttLog("Error:: incorrect module ...\n"); |
| dlclose(rtlm); |
| return NULL; |
| } |
break; |
break; |
case 1: |
case 1: |
pub_rtlm = rtlm; |
pub_rtlm = rtlm; |
mqttOpenPUB = mqttOpenRTLM; | call.OpenPUB = mqttOpenRTLM; |
mqttClosePUB = mqttCloseRTLM; | call.ClosePUB = mqttCloseRTLM; |
| call.InitSessPUB = dlsym(rtlm, "mqtt_rtlm_init_session"); |
| call.FiniSessPUB = dlsym(rtlm, "mqtt_rtlm_fini_session"); |
| call.ChkSessPUB = dlsym(rtlm, "mqtt_rtlm_chk_session"); |
| call.WritePUB_topic = dlsym(rtlm, "mqtt_rtlm_write_topic"); |
| call.ReadPUB_topic = dlsym(rtlm, "mqtt_rtlm_read_topic"); |
| call.DeletePUB_topic = dlsym(rtlm, "mqtt_rtlm_delete_topic"); |
| call.WritePUB_subscribe = dlsym(rtlm, "mqtt_rtlm_write_subscribe"); |
| call.ReadPUB_subscribe = dlsym(rtlm, "mqtt_rtlm_read_subscribe"); |
| call.DeletePUB_subscribe = dlsym(rtlm, "mqtt_rtlm_delete_subscribe"); |
| if (!call.InitSessPUB || !call.FiniSessPUB || !call.ChkSessPUB || |
| !call.WritePUB_topic || !call.ReadPUB_topic || |
| !call.DeletePUB_topic || !call.WritePUB_subscribe || |
| !call.ReadPUB_subscribe || !call.DeletePUB_subscribe) { |
| mqttLog("Error:: incorrect module ...\n"); |
| dlclose(rtlm); |
| return NULL; |
| } |
break; |
break; |
default: |
default: |
log_rtlm = rtlm; |
log_rtlm = rtlm; |
mqttOpenLOG = mqttOpenRTLM; | call.OpenLOG = mqttOpenRTLM; |
mqttCloseLOG = mqttCloseRTLM; | call.CloseLOG = mqttCloseRTLM; |
| call.LOG = dlsym(rtlm, "mqtt_rtlm_logger"); |
| if (!call.LOG) { |
| mqttLog("Error:: incorrect module ...\n"); |
| dlclose(rtlm); |
| return NULL; |
| } |
break; |
break; |
} |
} |
|
|