| 01. |
載入資料現在值檔案, 檢查資料有無錯誤.
|
||||
| 02. | 執行資料檢查的啟動表. | ||||
| 03. | 在啟動表內的模組修正錯誤的資料. | ||||
| 04. | 如果資料損毀嚴重需要做還原預設值處理, 使用 [還原預設值 (內部)] (#07-02#) 處理. |
struct mcm_action_module_t MCM_ACTION_CUSTOM_MODULE_BOOT_PROFILE_LIST_NAME[] =
{
{"mcm_module_boot_check_01"},
{"mcm_module_boot_check_02"},
{"mcm_module_boot_check_03"},
{""}
}
| MCM_RCODE_PASS | 資料錯誤已修正 |
| MCM_RCODE_MODULE_INTERNAL_ERROR | 資料錯誤嚴重, 需要還原預設值 |
|
MCM_DSERROR_LOSE_PARENT 遺失 parent-entry.
被加上錯誤狀態的對象 :
注意事項 :
示範 (狀況-01) : $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system date:2015/06/07 ip_addr:192.168.10.254 uptime:0 loading:45.678 ; device.vap.* ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.* 錯誤項目 : device.vap.#8.extra 和 device.vap.#8.station.#20 存在, 但是 device.vap.#8 卻不存在, 發生錯誤. 系統處理 : device.vap.#8.extra 貼上 MCM_DSATUS_ERROR_LOSE_PARENT. device.vap.#8.station.#20 貼上 MCM_DSERROR_LOSE_PARENT. 範例程式 : 現在值檔案部分 $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system date:2015/06/07 ip_addr:192.168.10.254 uptime:0 loading:45.678 ; device.vap.* ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.*
模組程式部分
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mcm_lib/mcm_lheader/mcm_type.h"
#include "mcm_lib/mcm_lheader/mcm_size.h"
#include "mcm_lib/mcm_lheader/mcm_control.h"
#include "mcm_lib/mcm_lheader/mcm_connect.h"
#include "mcm_lib/mcm_lheader/mcm_return.h"
#include "mcm_lib/mcm_lheader/mcm_debug.h"
#include "mcm_lib/mcm_lheader/mcm_data_exinfo_auto.h"
#include "../mcm_service_handle_define.h"
#include "../mcm_config_handle_extern.h"
#define DMSG(msg_fmt, msgs...) printf("%s(%04u): " msg_fmt "\n", __FILE__, __LINE__, ##msgs)
int mcm_module_check_test(
struct mcm_service_session_t *this_session)
{
int fret = MCM_RCODE_MODULE_INTERNAL_ERROR;
char *path1;
struct mcm_ds_device_vap_extra_t extra_s;
struct mcm_ds_device_vap_station_t station_s;
// 範例 (狀況-01) :
// device.vap.#8.extra 存在但是 device.vap.#8 不存在, 發生錯誤.
// device.vap.#8.extra 被貼上 MCM_DSERROR_LOSE_PARENT.
// 取得 device.vap.#8.extra 狀態.
path1 = "device.vap.#8.extra";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &extra_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
extra_s.ekey &= MCM_DSERROR_MASK;
extra_s.hidden &= MCM_DSERROR_MASK;
extra_s.tx_power &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_LOSE_PARENT.
if((station_s.ekey & MCM_DSERROR_LOSE_PARENT) != 0)
{
DMSG("%s = MCM_DSERROR_LOSE_PARENT", path1);
}
// 範例 (狀況-01) :
// device.vap.#8.station.#20 存在但是 device.vap.#8 不存在, 發生錯誤.
// device.vap.#8.station.#20 被貼上 MCM_DSERROR_LOSE_PARENT.
// 取得 device.vap.#8.station.#20 狀態.
path1 = "device.vap.#8.station.#20";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &station_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
station_s.ekey &= MCM_DSERROR_MASK;
station_s.mac_addr &= MCM_DSERROR_MASK;
station_s.rule &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_LOSE_PARENT.
if((station_s.ekey & MCM_DSERROR_LOSE_PARENT) != 0)
{
DMSG("%s = MCM_DSERROR_LOSE_PARENT", path1);
}
fret = MCM_RCODE_PASS;
FREE_01:
return fret;
}
資料檢查啟動表部分
struct mcm_action_module_t MCM_ACTION_CUSTOM_MODULE_BOOT_PROFILE_LIST_NAME[] =
{
{"mcm_module_check_test"},
{""}
};
|
|
MCM_DSERROR_LOSE_ENTRY 遺失 entry.
被加上錯誤狀態的對象 :
注意事項 :
示範 (狀況-01) : $version 1.0 ; device ; device.system device.system date:2015/06/07 ip_addr:192.168.10.254 uptime:0 loading:45.678 ; device.vap.* device.vap.#8 ssid:open-1 channel:10 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.* 錯誤項目 : device 是根結點但是不存在, 發生錯誤. 系統處理 : device 被建立並貼上 MCM_DSERROR_LOSE_ENTRY. 示範 (狀況-02) : $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system ; device.vap.* device.vap.#8 ssid:open-1 channel:10 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.* 錯誤項目 : device 存在, device.system 是 gs 類型但是不存在, 發生錯誤. 系統處理 : device.system 被建立並貼上 MCM_DSERROR_LOSE_ENTRY. 示範 (狀況-02) : $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system date:2015/06/07 ip_addr:192.168.10.254 uptime:0 loading:45.678 ; device.vap.* device.vap.#8 ssid:open-1 channel:10 ; device.vap.*.extra ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.* 錯誤項目 : device.vap.#8 存在, device.vap.*.extra 是 gs 類型但是 device.vap.#8.extra 不存在, 發生錯誤. 系統處理 : device.vap.#8.extra 被建立並貼上 MCM_DSERROR_LOSE_ENTRY. 示範 (狀況-03) : $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system date:2015/06/07 ip_addr:192.168.10.254 uptime:0 loading:45.678 ; device.vap.* ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.* 錯誤項目 : device.vap.#8.extra 和 device.vap.#8.station.#20 存在, 但是 device.vap.#8 卻不存在, 發生錯誤. 系統處理 : device.vap.#8 被建立並貼上 MCM_DSERROR_LOSE_ENTRY. 範例程式 : 現在值檔案部分 $version 1.0 ; device ; device.system ; device.vap.* ; device.vap.*.extra ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.*
模組程式部分
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mcm_lib/mcm_lheader/mcm_type.h"
#include "mcm_lib/mcm_lheader/mcm_size.h"
#include "mcm_lib/mcm_lheader/mcm_control.h"
#include "mcm_lib/mcm_lheader/mcm_connect.h"
#include "mcm_lib/mcm_lheader/mcm_return.h"
#include "mcm_lib/mcm_lheader/mcm_debug.h"
#include "mcm_lib/mcm_lheader/mcm_data_exinfo_auto.h"
#include "../mcm_service_handle_define.h"
#include "../mcm_config_handle_extern.h"
#define DMSG(msg_fmt, msgs...) printf("%s(%04u): " msg_fmt "\n", __FILE__, __LINE__, ##msgs)
int mcm_module_check_test(
struct mcm_service_session_t *this_session)
{
int fret = MCM_RCODE_MODULE_INTERNAL_ERROR;
char *path1;
struct mcm_ds_device_t device_s;
struct mcm_ds_device_system_t system_s;
struct mcm_ds_device_vap_t vap_s;
struct mcm_ds_device_vap_extra_t extra_s;
// 範例 (狀況-01) :
// device 是根結點且不存在, 發生錯誤.
// device 被建立並貼上 MCM_DSERROR_LOSE_ENTRY.
// 取得 device 狀態.
path1 = "device";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &device_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
device_s.ekey &= MCM_DSERROR_MASK;
device_s.descript &= MCM_DSERROR_MASK;
device_s.serial_number &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_LOSE_ENTRY.
if((device_s.ekey & MCM_DSERROR_LOSE_ENTRY) != 0)
{
DMSG("%s = MCM_DSERROR_LOSE_ENTRY", path1);
}
// 範例 (狀況-02) :
// device 存在 (原本不存在但是系統會自動建立並貼上錯誤),
// device.system 是 gs 類型但是不存在, 發生錯誤.
// device.system 被建立並貼上 MCM_DSERROR_LOSE_ENTRY.
path1 = "device.system";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &device_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
system_s.ekey &= MCM_DSERROR_MASK;
system_s.date &= MCM_DSERROR_MASK;
system_s.ip_addr &= MCM_DSERROR_MASK;
system_s.uptime &= MCM_DSERROR_MASK;
system_s.loading &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_LOSE_ENTRY.
if((device_s.ekey & MCM_DSERROR_LOSE_ENTRY) != 0)
{
DMSG("%s = MCM_DSERROR_LOSE_ENTRY", path1);
}
// 範例 (狀況-03) :
// device.vap.#8.station.#20 存在但是 device.vap.#8 不存在, 發生錯誤.
// device.vap.#8 被建立並貼上 MCM_DSERROR_LOSE_ENTRY.
// 取得 device.vap.#8 狀態.
path1 = "device.vap.#8";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &vap_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
vap_s.ekey &= MCM_DSERROR_MASK;
vap_s.ssid &= MCM_DSERROR_MASK;
vap_s.channel &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_LOSE_ENTRY.
if((vap_s.ekey & MCM_DSERROR_LOSE_ENTRY) != 0)
{
DMSG("%s = MCM_DSERROR_LOSE_ENTRY", path1);
}
// 範例 (狀況-02) :
// device.vap.#8 存在 (原本不存在但是系統會自動建立並貼上錯誤),
// device.vap.#8.extra 是 gs 類型但是不存在, 發生錯誤.
// device.vap.#8.extra 被建立並貼上 MCM_DSERROR_LOSE_ENTRY.
// 取得 device.vap.#8.extra 狀態.
path1 = "device.vap.#8.extra";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &vap_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
extra_s.ekey &= MCM_DSERROR_MASK;
extra_s.hidden &= MCM_DSERROR_MASK;
extra_s.tx_power &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_LOSE_ENTRY.
if((vap_s.ekey & MCM_DSERROR_LOSE_ENTRY) != 0)
{
DMSG("%s = MCM_DSERROR_LOSE_ENTRY", path1);
}
fret = MCM_RCODE_PASS;
FREE_01:
return fret;
}
資料檢查啟動表部分
struct mcm_action_module_t MCM_ACTION_CUSTOM_MODULE_BOOT_PROFILE_LIST_NAME[] =
{
{"mcm_module_check_test"},
{""}
};
|
|
MCM_DSERROR_DUPLIC_ENTRY 重複的 entry.
被加上錯誤狀態的對象 :
注意事項 :
示範 (狀況-01) : $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system date:2015/06/07 ip_addr:192.168.10.254 uptime:0 loading:45.678 ; device.vap.* device.vap.#8 ssid:open-1 channel:10 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 device.vap.#8.station.#20 mac_addr:00:11:22:33:44:01 rule:5 device.vap.#8.station.#20 mac_addr:00:11:22:33:44:02 rule:7 ; device.limit.* ; device.client.* 錯誤項目 : device.vap.#8.station.#20 重複出現, 發生錯誤. 系統處理 : 第一次出現的 device.vap.#8.station.#20 貼上 MCM_DSERROR_DUPLIC_ENTRY, 其餘的放棄. 範例程式 : 現在值檔案部分 $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F device descript: ; device.system device.system date:2015/06/07 ip_addr:192.168.10.254 uptime:0 loading:45.678 ; device.vap.* device.vap.#8 ssid:open-1 channel:10 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 device.vap.#8.station.#20 mac_addr:00:11:22:33:44:01 rule:5 device.vap.#8.station.#20 mac_addr:00:11:22:33:44:02 rule:7 ; device.limit.* ; device.client.*
模組程式部分
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mcm_lib/mcm_lheader/mcm_type.h"
#include "mcm_lib/mcm_lheader/mcm_size.h"
#include "mcm_lib/mcm_lheader/mcm_control.h"
#include "mcm_lib/mcm_lheader/mcm_connect.h"
#include "mcm_lib/mcm_lheader/mcm_return.h"
#include "mcm_lib/mcm_lheader/mcm_debug.h"
#include "mcm_lib/mcm_lheader/mcm_data_exinfo_auto.h"
#include "../mcm_service_handle_define.h"
#include "../mcm_config_handle_extern.h"
#define DMSG(msg_fmt, msgs...) printf("%s(%04u): " msg_fmt "\n", __FILE__, __LINE__, ##msgs)
int mcm_module_check_test(
struct mcm_service_session_t *this_session)
{
int fret = MCM_RCODE_MODULE_INTERNAL_ERROR;
char *path1;
struct mcm_ds_device_t device_s;
struct mcm_ds_device_vap_station_t station_s;
// 範例 (狀況-01) :
// device 有重複的 entry, 發生錯誤
// device 被貼上 MCM_DSERROR_DUPLIC_ENTRY.
// 取得 device 狀態.
path1 = "device";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &device_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
device_s.ekey &= MCM_DSERROR_MASK;
device_s.descript &= MCM_DSERROR_MASK;
device_s.serial_number &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_DUPLIC_ENTRY.
if((device_s.ekey & MCM_DSERROR_DUPLIC_ENTRY) != 0)
{
DMSG("%s = MCM_DSERROR_DUPLIC_ENTRY", path1);
}
// 範例 (狀況-01) :
// device.vap.#8.station.#20 有重複的 entry, 發生錯誤
// device.vap.#8.station.#20 被貼上 MCM_DSERROR_DUPLIC_ENTRY.
// 取得 device.vap.#8.station.#20 狀態.
path1 = "device.vap.#8.station.#20";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &station_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
station_s.ekey &= MCM_DSERROR_MASK;
station_s.mac_addr &= MCM_DSERROR_MASK;
station_s.rule &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_DUPLIC_ENTRY.
if((device_s.ekey & MCM_DSERROR_DUPLIC_ENTRY) != 0)
{
DMSG("%s = MCM_DSERROR_DUPLIC_ENTRY", path1);
}
fret = MCM_RCODE_PASS;
FREE_01:
return fret;
}
資料檢查啟動表部分
struct mcm_action_module_t MCM_ACTION_CUSTOM_MODULE_BOOT_PROFILE_LIST_NAME[] =
{
{"mcm_module_check_test"},
{""}
};
|
|
MCM_DSERROR_UNKNOWN_PARAMETER entry 有無法識別的項目.
被加上錯誤狀態的對象 :
注意事項 :
示範 (狀況-01) : $version 1.0 ; device device pFw%#1$(%^=? descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system date:2015/06/07 ip_addr:192.168.10.254 uptime:0 loading:45.678 ; device.vap.* device.vap.#8 ssid:open-1 channel:10 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.* 錯誤項目 : device 該行出現無法識別的項目 "pFw%#1$(%^=?", 發生錯誤. 系統處理 : device 貼上 MCM_DSERROR_UNKNOWN_PARAMETER. 範例程式 : 現在值檔案部分 $version 1.0 ; device device wG#%&45Ef@-? descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system date:2015/06/07 ip_addr:192.168.10.254 !0$rW4%=(f+z uptime:0 loading:45.678 mask=255.255.255.0 ; device.vap.* device.vap.#8 ssid:open-1 channel:10 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.*
模組程式部分
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mcm_lib/mcm_lheader/mcm_type.h"
#include "mcm_lib/mcm_lheader/mcm_size.h"
#include "mcm_lib/mcm_lheader/mcm_control.h"
#include "mcm_lib/mcm_lheader/mcm_connect.h"
#include "mcm_lib/mcm_lheader/mcm_return.h"
#include "mcm_lib/mcm_lheader/mcm_debug.h"
#include "mcm_lib/mcm_lheader/mcm_data_exinfo_auto.h"
#include "../mcm_service_handle_define.h"
#include "../mcm_config_handle_extern.h"
#define DMSG(msg_fmt, msgs...) printf("%s(%04u): " msg_fmt "\n", __FILE__, __LINE__, ##msgs)
int mcm_module_check_test(
struct mcm_service_session_t *this_session)
{
int fret = MCM_RCODE_MODULE_INTERNAL_ERROR;
char *path1;
struct mcm_ds_device_t device_s;
struct mcm_ds_device_system_t system_s;
// 範例 (狀況-01) :
// device 該行出現無法識別的項目 "wG#%&45Ef@-?", 發生錯誤.
// device 被貼上 MCM_DSERROR_UNKNOWN_PARAMETER.
// 取得 device 狀態.
path1 = "device";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &device_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
device_s.ekey &= MCM_DSERROR_MASK;
device_s.descript &= MCM_DSERROR_MASK;
device_s.serial_number &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_UNKNOWN_PARAMETER.
if((device_s.ekey & MCM_DSERROR_UNKNOWN_PARAMETER) != 0)
{
DMSG("%s = MCM_DSERROR_UNKNOWN_PARAMETER", path1);
}
// 範例 (狀況-01) :
// device.system 該行出現無法識別的項目 "!0$rW4%=(f+z", "mask=255.255.255.0", 發生錯誤.
// device.system 被貼上 MCM_DSERROR_UNKNOWN_PARAMETER.
// 取得 device.system 狀態.
path1 = "device.system";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &system_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
system_s.ekey &= MCM_DSERROR_MASK;
system_s.date &= MCM_DSERROR_MASK;
system_s.ip_addr &= MCM_DSERROR_MASK;
system_s.uptime &= MCM_DSERROR_MASK;
system_s.loading &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_UNKNOWN_PARAMETER.
if((system_s.ekey & MCM_DSERROR_UNKNOWN_PARAMETER) != 0)
{
DMSG("%s = MCM_DSERROR_UNKNOWN_PARAMETER", path1);
}
fret = MCM_RCODE_PASS;
FREE_01:
return fret;
}
資料檢查啟動表部分
struct mcm_action_module_t MCM_ACTION_CUSTOM_MODULE_BOOT_PROFILE_LIST_NAME[] =
{
{"mcm_module_check_test"},
{""}
};
|
|
MCM_DSERROR_UNKNOWN_MEMBER entry 有無法識別的 member.
被加上錯誤狀態的對象 :
注意事項 :
示範 (狀況-01) : $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system date:2015/06/07 ip_addr:192.168.10.254 uptime:0 loading:45.678 ; device.vap.* device.vap.#8 ssid:open-1 channel:10 authentication:wpa2 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.* 錯誤項目 : device.vap.#8 該行出現無法識別的 member "authentication:wpa2", 發生錯誤. 系統處理 : device.vap.#8 貼上 MCM_DSERROR_UNKNOWN_MEMBER. 範例程式 : 現在值檔案部分 $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system date:2015/06/07 ip_addr:192.168.10.254 uptime:0 loading:45.678 ; device.vap.* device.vap.#8 ssid:open-1 channel:10 authentication:wpa2 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.*
模組程式部分
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mcm_lib/mcm_lheader/mcm_type.h"
#include "mcm_lib/mcm_lheader/mcm_size.h"
#include "mcm_lib/mcm_lheader/mcm_control.h"
#include "mcm_lib/mcm_lheader/mcm_connect.h"
#include "mcm_lib/mcm_lheader/mcm_return.h"
#include "mcm_lib/mcm_lheader/mcm_debug.h"
#include "mcm_lib/mcm_lheader/mcm_data_exinfo_auto.h"
#include "../mcm_service_handle_define.h"
#include "../mcm_config_handle_extern.h"
#define DMSG(msg_fmt, msgs...) printf("%s(%04u): " msg_fmt "\n", __FILE__, __LINE__, ##msgs)
int mcm_module_check_test(
struct mcm_service_session_t *this_session)
{
int fret = MCM_RCODE_MODULE_INTERNAL_ERROR;
char *path1;
struct mcm_ds_device_vap_t vap_s;
// 範例 (狀況-01) :
// device.vap.#8 該行出現無法識別的 member "authentication:wpa2", 發生錯誤.
// device.vap.#8 被貼上 MCM_DSERROR_UNKNOWN_MEMBER.
// 取得 device.vap.#8 狀態.
path1 = "device.vap.#8";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &vap_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
vap_s.ekey &= MCM_DSERROR_MASK;
vap_s.ssid &= MCM_DSERROR_MASK;
vap_s.channel &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_UNKNOWN_MEMBER.
if((vap_s.ekey & MCM_DSERROR_UNKNOWN_MEMBER) != 0)
{
DMSG("%s = MCM_DSERROR_UNKNOWN_MEMBER", path1);
}
fret = MCM_RCODE_PASS;
FREE_01:
return fret;
}
資料檢查啟動表部分
struct mcm_action_module_t MCM_ACTION_CUSTOM_MODULE_BOOT_PROFILE_LIST_NAME[] =
{
{"mcm_module_check_test"},
{""}
};
|
|
MCM_DSERROR_LOSE_MEMBER 遺失 member.
被加上錯誤狀態的對象 :
注意事項 :
示範 (狀況-01) : $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system ip_addr:192.168.10.254 loading:45.678 ; device.vap.* device.vap.#8 ssid:open-1 channel:10 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.* 錯誤項目 : device.system 的 date 和 uptime 遺失, 發生錯誤. 系統處理 : device.system 和 date 和 uptime 貼上 MCM_DSERROR_LOSE_MEMBER. 範例程式 : 現在值檔案部分 $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system ip_addr:192.168.10.254 loading:45.678 ; device.vap.* device.vap.#8 ssid:open-1 channel:10 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.*
模組程式部分
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mcm_lib/mcm_lheader/mcm_type.h"
#include "mcm_lib/mcm_lheader/mcm_size.h"
#include "mcm_lib/mcm_lheader/mcm_control.h"
#include "mcm_lib/mcm_lheader/mcm_connect.h"
#include "mcm_lib/mcm_lheader/mcm_return.h"
#include "mcm_lib/mcm_lheader/mcm_debug.h"
#include "mcm_lib/mcm_lheader/mcm_data_exinfo_auto.h"
#include "../mcm_service_handle_define.h"
#include "../mcm_config_handle_extern.h"
#define DMSG(msg_fmt, msgs...) printf("%s(%04u): " msg_fmt "\n", __FILE__, __LINE__, ##msgs)
int mcm_module_check_test(
struct mcm_service_session_t *this_session)
{
int fret = MCM_RCODE_MODULE_INTERNAL_ERROR;
char *path1;
struct mcm_ds_device_system_t system_s;
// 範例 (狀況-01) :
// device.system 的 date 和 uptime 遺失, 發生錯誤.
// device.system 和 date 和 uptime 被貼上 MCM_DSERROR_LOSE_MEMBER.
// 取得 device.system 狀態.
path1 = "device.system";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &system_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
system_s.ekey &= MCM_DSERROR_MASK;
system_s.date &= MCM_DSERROR_MASK;
system_s.ip_addr &= MCM_DSERROR_MASK;
system_s.uptime &= MCM_DSERROR_MASK;
system_s.loading &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_LOSE_MEMBER.
if((system_s.ekey & MCM_DSERROR_LOSE_MEMBER) != 0)
{
DMSG("%s = MCM_DSERROR_LOSE_MEMBER", path1);
}
if((system_s.date & MCM_DSERROR_LOSE_MEMBER) != 0)
{
DMSG("%s.date = MCM_DSERROR_LOSE_MEMBER", path1);
}
if((system_s.ip_addr & MCM_DSERROR_LOSE_MEMBER) != 0)
{
DMSG("%s.ip_addr = MCM_DSERROR_LOSE_MEMBER", path1);
}
if((system_s.uptime & MCM_DSERROR_LOSE_MEMBER) != 0)
{
DMSG("%s.uptime = MCM_DSERROR_LOSE_MEMBER", path1);
}
if((system_s.loading & MCM_DSERROR_LOSE_MEMBER) != 0)
{
DMSG("%s.loading = MCM_DSERROR_LOSE_MEMBER", path1);
}
fret = MCM_RCODE_PASS;
FREE_01:
return fret;
}
資料檢查啟動表部分
struct mcm_action_module_t MCM_ACTION_CUSTOM_MODULE_BOOT_PROFILE_LIST_NAME[] =
{
{"mcm_module_check_test"},
{""}
};
|
|
MCM_DSERROR_DUPLIC_MEMBER 重複的 member.
被加上錯誤狀態的對象 :
注意事項 :
示範 (狀況-01) : $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system date:2015/06/07 ip_addr:192.168.10.254 uptime:0 loading:45.678 ip_addr:10.0.0.254 loading:-65.432 ; device.vap.* device.vap.#8 ssid:open-1 channel:10 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.* 錯誤項目 : device.system 的 ip_addr 和 loading 重複出現, 發生錯誤. 系統處理 : device.system 和第一次出現的 ip_addr 和 loading 貼上 MCM_DSERROR_DUPLIC_MEMBER, 其餘的放棄. 範例程式 : 現在值檔案部分 $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system date:2015/06/07 ip_addr:192.168.10.254 uptime:0 loading:45.678 ip_addr:10.0.0.254 loading:-65.432 ; device.vap.* device.vap.#8 ssid:open-1 channel:10 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.*
模組程式部分
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mcm_lib/mcm_lheader/mcm_type.h"
#include "mcm_lib/mcm_lheader/mcm_size.h"
#include "mcm_lib/mcm_lheader/mcm_control.h"
#include "mcm_lib/mcm_lheader/mcm_connect.h"
#include "mcm_lib/mcm_lheader/mcm_return.h"
#include "mcm_lib/mcm_lheader/mcm_debug.h"
#include "mcm_lib/mcm_lheader/mcm_data_exinfo_auto.h"
#include "../mcm_service_handle_define.h"
#include "../mcm_config_handle_extern.h"
#define DMSG(msg_fmt, msgs...) printf("%s(%04u): " msg_fmt "\n", __FILE__, __LINE__, ##msgs)
int mcm_module_check_test(
struct mcm_service_session_t *this_session)
{
int fret = MCM_RCODE_MODULE_INTERNAL_ERROR;
char *path1;
struct mcm_ds_device_system_t system_s;
// 範例 (狀況-01) :
// device.system 的 ip_addr 和 loading 重複出現, 發生錯誤.
// device.system 和第一次出現的 ip_addr 和 loading 貼上 MCM_DSERROR_DUPLIC_MEMBER.
// 取得 device.system 狀態.
path1 = "device.system";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &system_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
system_s.ekey &= MCM_DSERROR_MASK;
system_s.date &= MCM_DSERROR_MASK;
system_s.ip_addr &= MCM_DSERROR_MASK;
system_s.uptime &= MCM_DSERROR_MASK;
system_s.loading &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_DUPLIC_MEMBER.
if((system_s.ekey & MCM_DSERROR_DUPLIC_MEMBER) != 0)
{
DMSG("%s = MCM_DSERROR_DUPLIC_MEMBER", path1);
}
if((system_s.date & MCM_DSERROR_DUPLIC_MEMBER) != 0)
{
DMSG("%s.date = MCM_DSERROR_DUPLIC_MEMBER", path1);
}
if((system_s.ip_addr & MCM_DSERROR_DUPLIC_MEMBER) != 0)
{
DMSG("%s.ip_addr = MCM_DSERROR_DUPLIC_MEMBER", path1);
}
if((system_s.uptime & MCM_DSERROR_DUPLIC_MEMBER) != 0)
{
DMSG("%s.uptime = MCM_DSERROR_DUPLIC_MEMBER", path1);
}
if((system_s.loading & MCM_DSERROR_DUPLIC_MEMBER) != 0)
{
DMSG("%s.loading = MCM_DSERROR_DUPLIC_MEMBER", path1);
}
fret = MCM_RCODE_PASS;
FREE_01:
return fret;
}
資料檢查啟動表部分
struct mcm_action_module_t MCM_ACTION_CUSTOM_MODULE_BOOT_PROFILE_LIST_NAME[] =
{
{"mcm_module_check_test"},
{""}
};
|
|
MCM_DSERROR_INVALID_VALUE 無效的資料數值.
被加上錯誤狀態的對象 :
注意事項 :
示範 (狀況-01) : $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system date:2015/06/07-Sun ip_addr:192.168.10.254 uptime:184467440737095516159 loading:45.678a ; device.vap.* device.vap.#8 ssid:open-1 channel:10 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.* 錯誤項目 : device.system 的 date 的長度超過設定的緩衝大小 (12), 發生錯誤. device.system 的 uptime 的範圍無效 (0 ~ 18446744073709551615), 發生錯誤. device.system 的 loading 的數值有無效的字元, 發生錯誤. 系統處理 : device.system 和 date 和 uptime 和 loading 貼上 MCM_DSERROR_INVALID_VALUE. 範例程式 : 現在值檔案部分 $version 1.0 ; device device descript:Wireless%20Device serial_number:0022E5A1CC9F ; device.system device.system date:2015/06/07-Sun ip_addr:192.168.10.254 uptime:184467440737095516159 loading:45.678a ; device.vap.* device.vap.#8 ssid:open-1 channel:10 ; device.vap.*.extra device.vap.#8.extra hidden:1 tx_power:9 ; device.vap.*.station.* device.vap.#8.station.#20 mac_addr:00:11:22:33:44:55 rule:3 ; device.limit.* ; device.client.*
模組程式部分
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mcm_lib/mcm_lheader/mcm_type.h"
#include "mcm_lib/mcm_lheader/mcm_size.h"
#include "mcm_lib/mcm_lheader/mcm_control.h"
#include "mcm_lib/mcm_lheader/mcm_connect.h"
#include "mcm_lib/mcm_lheader/mcm_return.h"
#include "mcm_lib/mcm_lheader/mcm_debug.h"
#include "mcm_lib/mcm_lheader/mcm_data_exinfo_auto.h"
#include "../mcm_service_handle_define.h"
#include "../mcm_config_handle_extern.h"
#define DMSG(msg_fmt, msgs...) printf("%s(%04u): " msg_fmt "\n", __FILE__, __LINE__, ##msgs)
int mcm_module_check_test(
struct mcm_service_session_t *this_session)
{
int fret = MCM_RCODE_MODULE_INTERNAL_ERROR;
char *path1;
struct mcm_ds_device_system_t system_s;
// 範例 (狀況-01) :
// device.system 的 date 的長度超過設定的緩衝大小 (12), 發生錯誤.
// device.system 的 uptime 的範圍無效 (0 ~ 18446744073709551615), 發生錯誤.
// device.system 的 loading 的數值有無效的字元, 發生錯誤.
// device.system 和 date 和 uptime 和 loading 貼上 MCM_DSERROR_INVALID_VALUE.
// 取得 device.system 狀態.
path1 = "device.system";
if(mcm_config_get_entry_all_status_by_path(this_session, path1, &system_s) < MCM_RCODE_PASS)
{
DMSG("call mcm_config_get_entry_all_status_by_path(%s) fail", path1);
goto FREE_01;
}
system_s.ekey &= MCM_DSERROR_MASK;
system_s.date &= MCM_DSERROR_MASK;
system_s.ip_addr &= MCM_DSERROR_MASK;
system_s.uptime &= MCM_DSERROR_MASK;
system_s.loading &= MCM_DSERROR_MASK;
// 檢查是否有 MCM_DSERROR_INVALID_VALUE.
if((system_s.ekey & MCM_DSERROR_INVALID_VALUE) != 0)
{
DMSG("%s = MCM_DSERROR_INVALID_VALUE", path1);
}
if((system_s.date & MCM_DSERROR_INVALID_VALUE) != 0)
{
DMSG("%s.date = MCM_DSERROR_INVALID_VALUE", path1);
}
if((system_s.ip_addr & MCM_DSERROR_INVALID_VALUE) != 0)
{
DMSG("%s.ip_addr = MCM_DSERROR_INVALID_VALUE", path1);
}
if((system_s.uptime & MCM_DSERROR_INVALID_VALUE) != 0)
{
DMSG("%s.uptime = MCM_DSERROR_INVALID_VALUE", path1);
}
if((system_s.loading & MCM_DSERROR_INVALID_VALUE) != 0)
{
DMSG("%s.loading = MCM_DSERROR_INVALID_VALUE", path1);
}
fret = MCM_RCODE_PASS;
FREE_01:
return fret;
}
資料檢查啟動表部分
struct mcm_action_module_t MCM_ACTION_CUSTOM_MODULE_BOOT_PROFILE_LIST_NAME[] =
{
{"mcm_module_check_test"},
{""}
};
|
|
MCM_CONFIG_PROFILE_VERSION |
資料模型的版本 |
|
mcm_config_base_data.profile_current_version |
資料現在值檔案的版本 |
|
MCM_FILE_SOURCE (mint_cm/mcm_lib/mcm_lheader/mcm_control.h) |
|
| MCM_FSOURCE_DEFAULT | 資料預設值檔案 |
| MCM_FSOURCE_CURRENT | 資料現在值檔案 |
| 0 | 無 |
| 1 |
有 (包含可以標記的錯誤或無法標記的錯誤) |
| 01. | 範例程式目錄在 mint_cm/usage/example/0704. |
| 02. | 下面關於 make 的操作沒有特別註明的話都是在 mint_cm 目錄. |
| 03. | 第一次使用, 使用 make example_add KEY=0704 載入範例並編譯. |
| 04. |
執行 mcm_daemon 並加入 -e 2 參數就可以看到結果. 注意當程式檢查到錯誤並執行處理後, mcm_store_profile_current.txt 會重新產生並且內容是正確的的. |
| 05. | 測試完畢不使用後, 使用 make example_del KEY=0704 將範例移除. |
| 06. |
範例程式目錄下的檔案在做完 make example_add
後會複製到真正使用的位置, 要修改做測試的話要改在複製後的.
|