4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: JuHyun Kim <jh8212.kim@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
32 #include <netinet/in.h>
33 #include <arpa/inet.h>
36 #include <cobject_type.h>
43 #include <cipc_worker.h>
46 #include <sf_common.h>
48 #include <csensor_module.h>
49 #include <cfilter_module.h>
50 #include <cfilter_catalog.h>
52 #include <resource_str.h>
56 cfilter_catalog::cfilter_catalog()
62 cfilter_catalog::~cfilter_catalog()
68 bool cfilter_catalog::create(char *file)
75 if (ccatalog::load(file) == false) {
76 if ( ccatalog::is_loaded() ) {
77 DBG("The catalog is already loaded , so first unload it");
80 ERR("Failed to load a catalog file\n");
84 handle = ccatalog::iterate_init();
86 name = ccatalog::iterate_get_name(handle);
87 handle = ccatalog::iterate_next(handle);
89 ERR("Name is null\n");
93 value = ccatalog::value(name, (char*)STR_DISABLE);
94 if (value && !strcasecmp(value, STR_YES)) {
95 ERR("%s is disabled\n", name);
99 value = ccatalog::value(name, (char*)STR_PATH);
101 ERR("Module path is not defined\n");
105 module = cfilter_module::register_module(value, NULL, NULL);
107 ERR("Failed to register a module %s\n", name);
111 value = ccatalog::value(name, (char*)STR_OVERRIDE);
112 if (value && !strcasecmp(value, STR_YES)) {
113 DBG("Let's override module description\n");
115 if (module->update_name(name) == false) {
116 ERR("Failed to update module name\n");
119 value = ccatalog::value(name, (char*)STR_ID);
121 if (module->update_id(atoi(value)) == false) {
122 ERR("Failed to update ID\n");
126 value = ccatalog::value(name, (char*)STR_VERSION);
128 if (module->update_version(atoi(value)) == false) {
129 ERR("Failed to update version\n");
135 DBG("Finished registeration , unload filter.conf ");
143 void cfilter_catalog::destroy(void)
145 if ( ccatalog::is_loaded() ) {