From ce9e8acb09307150ee2913eb60f8eedfa0e35037 Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Fri, 12 May 2017 15:08:56 +0900 Subject: [PATCH 01/16] Fix build issue on 64bit environment Change-Id: I95653b356fe68d8125262b32b2d21c903d21f85b Signed-off-by: Jiwan Kim --- packaging/zigbee-manager.spec | 13 ++++++++----- zigbee-client/CMakeLists.txt | 4 ++-- zigbee-client/zigbee-client.pc.in | 2 +- zigbee-daemon/CMakeLists.txt | 4 ++-- zigbee-daemon/zigbee-lib/CMakeLists.txt | 2 +- zigbee-daemon/zigbee-lib/src/zblib_request.c | 6 +++--- zigbee-daemon/zigbee-lib/src/zblib_service.c | 2 +- zigbee-daemon/zigbee-lib/zigbee-lib.pc.in | 2 +- 8 files changed, 19 insertions(+), 16 deletions(-) diff --git a/packaging/zigbee-manager.spec b/packaging/zigbee-manager.spec index 19fb9fc..79e1b2a 100644 --- a/packaging/zigbee-manager.spec +++ b/packaging/zigbee-manager.spec @@ -50,7 +50,10 @@ cp -a %{SOURCE2} . %endif %build -cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DVERSION=%{version} \ +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DVERSION=%{version} \ + -DLIB_INSTALL_DIR=%{_libdir} \ + -DUNIT_INSTALL_DIR=%{_unitdir} \ make %{?_smp_mflags} @@ -58,8 +61,8 @@ make %{?_smp_mflags} %make_install # Do not execute daemon on boot time -#mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants -#ln -s %{_libdir}/systemd/system/zigbee-daemon.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/zigbee-daemon.service +#mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants +#ln -s %{_unitdir}/zigbee-daemon.service %{buildroot}%{_unitdir}/multi-user.target.wants/zigbee-daemon.service mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services/ mkdir -p %{buildroot}%{_datadir}/dbus-1/system.d/ @@ -76,8 +79,8 @@ cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf %manifest zigbee-daemon.manifest %defattr(644,system,system,-) %attr(755,system,system) %{_bindir}/zigbee-daemon -%{_libdir}/systemd/system/zigbee-daemon.service -#%{_libdir}/systemd/system/multi-user.target.wants/zigbee-daemon.service +%{_unitdir}/zigbee-daemon.service +#%{_unitdir}/multi-user.target.wants/zigbee-daemon.service %{_datadir}/license/zigbee-daemon %attr(644,root,root) %{_datadir}/dbus-1/system-services/* %if %{CHECK_ZIGBEE_PRIVILEGE} == "True" diff --git a/zigbee-client/CMakeLists.txt b/zigbee-client/CMakeLists.txt index 8622e3d..aaeed6c 100644 --- a/zigbee-client/CMakeLists.txt +++ b/zigbee-client/CMakeLists.txt @@ -50,9 +50,9 @@ CONFIGURE_FILE(zigbee-client.pc.in zigbee-client.pc @ONLY) ### Install files ### INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/zigbee/client) INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/common/include/ DESTINATION include/zigbee/common) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zigbee-client.pc DESTINATION lib/pkgconfig) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zigbee-client.pc DESTINATION ${LIBDIR}/pkgconfig) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME zigbee-client) -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT Runtime) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR} COMPONENT Runtime) IF (TIZEN_ENGINEER_MODE) ADD_SUBDIRECTORY(test_src) ENDIF (TIZEN_ENGINEER_MODE) diff --git a/zigbee-client/zigbee-client.pc.in b/zigbee-client/zigbee-client.pc.in index 75c7f4b..3634b35 100644 --- a/zigbee-client/zigbee-client.pc.in +++ b/zigbee-client/zigbee-client.pc.in @@ -1,6 +1,6 @@ prefix=@PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/lib +libdir=@LIBDIR@ includedir=${prefix}/include Name: ZigBee Client Library diff --git a/zigbee-daemon/CMakeLists.txt b/zigbee-daemon/CMakeLists.txt index 4ac2665..09a577f 100644 --- a/zigbee-daemon/CMakeLists.txt +++ b/zigbee-daemon/CMakeLists.txt @@ -101,7 +101,7 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS} ${ZIGBEE_LIB_SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} zigbee-service zigbee-interface ${pkgs_LDFLAGS} "-ldl") ### Install files ### -INSTALL(TARGETS zigbee-lib DESTINATION lib COMPONENT Runtime) +INSTALL(TARGETS zigbee-lib DESTINATION ${LIBDIR} COMPONENT Runtime) INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME zigbee-daemon) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/resources/zigbee-daemon.service DESTINATION /usr/lib/systemd/system) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/resources/zigbee-daemon.service DESTINATION ${UNITDIR}) diff --git a/zigbee-daemon/zigbee-lib/CMakeLists.txt b/zigbee-daemon/zigbee-lib/CMakeLists.txt index 352d5c1..fb40778 100644 --- a/zigbee-daemon/zigbee-lib/CMakeLists.txt +++ b/zigbee-daemon/zigbee-lib/CMakeLists.txt @@ -39,6 +39,6 @@ CONFIGURE_FILE(zigbee-lib.pc.in zigbee-lib.pc @ONLY) ### Install files ### INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/zigbee/lib) INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/common/include/ DESTINATION include/zigbee/common) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zigbee-lib.pc DESTINATION lib/pkgconfig) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zigbee-lib.pc DESTINATION ${LIBDIR}/pkgconfig) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME zigbee-lib) #INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT Runtime) diff --git a/zigbee-daemon/zigbee-lib/src/zblib_request.c b/zigbee-daemon/zigbee-lib/src/zblib_request.c index 2df88f0..f23f3e5 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_request.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_request.c @@ -87,7 +87,7 @@ static ZigBeeRequest *__zblib_request_ref_request_by_by_request_id(ZigBeeService } /* Look-up requets_id in request hash table */ - request = (ZigBeeRequest *)g_hash_table_lookup(request_table, (gconstpointer)request_id); + request = (ZigBeeRequest *)g_hash_table_lookup(request_table, (gconstpointer)GUINT_TO_POINTER(request_id)); if (NULL == request) { Z_LOGE("No request available for request_id: [%d]", request_id); return NULL; @@ -125,7 +125,7 @@ static ZigBeeRequest *__zblib_request_ref_request_by_request_id(ZigBeeService *s } /* Look-up requets_id in request hash table */ - request = (ZigBeeRequest *)g_hash_table_lookup(request_table, (gconstpointer)request_id); + request = (ZigBeeRequest *)g_hash_table_lookup(request_table, (gconstpointer)GUINT_TO_POINTER(request_id)); if (NULL == request) { Z_LOGE("No request available for request_id: [%d]", request_id); return NULL; @@ -4597,7 +4597,7 @@ gint zblib_request_new(ZigBeeServiceInterface *service_interface, } /* Insert request to request table */ - g_hash_table_insert(request_table, (gpointer)(request->request_id), request); + g_hash_table_insert(request_table, GINT_TO_POINTER(request->request_id), request); return request->request_id; } diff --git a/zigbee-daemon/zigbee-lib/src/zblib_service.c b/zigbee-daemon/zigbee-lib/src/zblib_service.c index ff46159..045b651 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_service.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_service.c @@ -256,7 +256,7 @@ static void __zblib_service_remove_request_table_iter(gpointer key, gpointer value, gpointer user_data) { ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data; - gint request_id = (gint)key; + gint request_id = GPOINTER_TO_INT(key); NOT_USED(value); diff --git a/zigbee-daemon/zigbee-lib/zigbee-lib.pc.in b/zigbee-daemon/zigbee-lib/zigbee-lib.pc.in index 444788e..4faa1b8 100644 --- a/zigbee-daemon/zigbee-lib/zigbee-lib.pc.in +++ b/zigbee-daemon/zigbee-lib/zigbee-lib.pc.in @@ -1,6 +1,6 @@ prefix=@PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/lib +libdir=@LIBDIR@ includedir=${prefix}/include Name: lib-zigbee -- 2.7.4 From 265aa3b0c41ee3c8d6e20be30b0c06334c05d7d8 Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Wed, 7 Jun 2017 17:10:39 +0900 Subject: [PATCH 02/16] Add license documentation - add '%license' macro on build spec file Change-Id: I4923f05a6091ba38ed0571125c472ce770ce6880 Signed-off-by: Jiwan Kim --- packaging/zigbee-manager.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packaging/zigbee-manager.spec b/packaging/zigbee-manager.spec index 79e1b2a..57a94e4 100644 --- a/packaging/zigbee-manager.spec +++ b/packaging/zigbee-manager.spec @@ -1,6 +1,6 @@ %define major 0 %define minor 1 -%define patchlevel 0 +%define patchlevel 1 %define CHECK_ZIGBEE_PRIVILEGE False Name: zigbee-manager @@ -86,11 +86,13 @@ cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf %if %{CHECK_ZIGBEE_PRIVILEGE} == "True" %{_datadir}/dbus-1/system.d/zigbee.conf %endif +%license LICENSE %files -n zigbee-lib %defattr(644,system,system,-) %{_libdir}/libzigbee-lib.so* %{_datadir}/license/zigbee-lib +%license LICENSE %files -n zigbee-lib-devel %defattr(644,system,system,-) -- 2.7.4 From 9d26ccbff0dc33114370c84022211bd8b966afef Mon Sep 17 00:00:00 2001 From: saerome kim Date: Wed, 7 Jun 2017 19:39:26 +0900 Subject: [PATCH 03/16] Remove codes to copy license files manually. Change-Id: Ie23c267824238098715726fc48ccfd17bd4aa8c0 Signed-off-by: saerome kim --- packaging/zigbee-manager.spec | 2 -- zigbee-client/CMakeLists.txt | 1 - zigbee-daemon/CMakeLists.txt | 1 - zigbee-daemon/zigbee-lib/CMakeLists.txt | 1 - 4 files changed, 5 deletions(-) diff --git a/packaging/zigbee-manager.spec b/packaging/zigbee-manager.spec index 57a94e4..e0182d4 100644 --- a/packaging/zigbee-manager.spec +++ b/packaging/zigbee-manager.spec @@ -81,7 +81,6 @@ cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf %attr(755,system,system) %{_bindir}/zigbee-daemon %{_unitdir}/zigbee-daemon.service #%{_unitdir}/multi-user.target.wants/zigbee-daemon.service -%{_datadir}/license/zigbee-daemon %attr(644,root,root) %{_datadir}/dbus-1/system-services/* %if %{CHECK_ZIGBEE_PRIVILEGE} == "True" %{_datadir}/dbus-1/system.d/zigbee.conf @@ -91,7 +90,6 @@ cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf %files -n zigbee-lib %defattr(644,system,system,-) %{_libdir}/libzigbee-lib.so* -%{_datadir}/license/zigbee-lib %license LICENSE %files -n zigbee-lib-devel diff --git a/zigbee-client/CMakeLists.txt b/zigbee-client/CMakeLists.txt index aaeed6c..94a738d 100644 --- a/zigbee-client/CMakeLists.txt +++ b/zigbee-client/CMakeLists.txt @@ -51,7 +51,6 @@ CONFIGURE_FILE(zigbee-client.pc.in zigbee-client.pc @ONLY) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/zigbee/client) INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/common/include/ DESTINATION include/zigbee/common) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zigbee-client.pc DESTINATION ${LIBDIR}/pkgconfig) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME zigbee-client) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR} COMPONENT Runtime) IF (TIZEN_ENGINEER_MODE) ADD_SUBDIRECTORY(test_src) diff --git a/zigbee-daemon/CMakeLists.txt b/zigbee-daemon/CMakeLists.txt index 09a577f..0a44dbf 100644 --- a/zigbee-daemon/CMakeLists.txt +++ b/zigbee-daemon/CMakeLists.txt @@ -103,5 +103,4 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} zigbee-service zigbee-interface ${pkgs_LDF ### Install files ### INSTALL(TARGETS zigbee-lib DESTINATION ${LIBDIR} COMPONENT Runtime) INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME zigbee-daemon) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/resources/zigbee-daemon.service DESTINATION ${UNITDIR}) diff --git a/zigbee-daemon/zigbee-lib/CMakeLists.txt b/zigbee-daemon/zigbee-lib/CMakeLists.txt index fb40778..d562c6f 100644 --- a/zigbee-daemon/zigbee-lib/CMakeLists.txt +++ b/zigbee-daemon/zigbee-lib/CMakeLists.txt @@ -40,5 +40,4 @@ CONFIGURE_FILE(zigbee-lib.pc.in zigbee-lib.pc @ONLY) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/zigbee/lib) INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/common/include/ DESTINATION include/zigbee/common) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zigbee-lib.pc DESTINATION ${LIBDIR}/pkgconfig) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME zigbee-lib) #INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT Runtime) -- 2.7.4 From a97323cf2c2b52e0612002dfdf2ca8412c825e62 Mon Sep 17 00:00:00 2001 From: "saerome.kim" Date: Wed, 9 Aug 2017 13:30:21 +0900 Subject: [PATCH 04/16] [SECSFV-22] Change uid/gid to network_fw Change-Id: Id0d20049720559123efbf87e7530f892f9b587ab Signed-off-by: saerome.kim --- packaging/org.tizen.zigbee.service | 3 ++- zigbee-daemon/resources/zigbee-daemon.service | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packaging/org.tizen.zigbee.service b/packaging/org.tizen.zigbee.service index 129767e..92a7f03 100644 --- a/packaging/org.tizen.zigbee.service +++ b/packaging/org.tizen.zigbee.service @@ -2,5 +2,6 @@ Name=org.tizen.zigbee.manager Exec=/bin/false -User=system +User=network_fw +Group=network_fw SystemdService=zigbee-daemon.service diff --git a/zigbee-daemon/resources/zigbee-daemon.service b/zigbee-daemon/resources/zigbee-daemon.service index 5353556..240ce7f 100644 --- a/zigbee-daemon/resources/zigbee-daemon.service +++ b/zigbee-daemon/resources/zigbee-daemon.service @@ -6,8 +6,8 @@ After=dbus.socket [Service] Type=dbus BusName=org.tizen.zigbee.manager -User=system -Group=system +User=network_fw +Group=network_fw SmackProcessLabel=System ExecStart=/usr/bin/zigbee-daemon Restart=on-failure -- 2.7.4 From 7cf5bbfcd00b7691535c4361a89c7d074fc5d4fd Mon Sep 17 00:00:00 2001 From: "jh8801.jung" Date: Tue, 12 Sep 2017 08:27:35 +0900 Subject: [PATCH 05/16] Apply coding rule (BRC_M_EUS, SPC_M_OPR, SPC_M_KWD) Signed-off-by: jh8801.jung Change-Id: I73373a0ec510f5bf2b98c6c636e5019879f21624 --- zigbee-client/include_private/zigbee_log.h | 12 ++++---- .../zigbee-lib/include/zblib_driver_custom.h | 6 ++-- .../include/zblib_driver_mfglib_control.h | 34 +++++++++++----------- .../zigbee-lib/include/zblib_driver_service.h | 28 +++++++++--------- .../zigbee-lib/include/zblib_driver_zcl_alarm.h | 12 ++++---- .../zigbee-lib/include/zblib_driver_zcl_basic.h | 2 +- .../include/zblib_driver_zcl_color_control.h | 22 +++++++------- .../include/zblib_driver_zcl_door_lock.h | 8 ++--- .../include/zblib_driver_zcl_fan_control.h | 8 ++--- .../include/zblib_driver_zcl_global_control.h | 24 +++++++-------- .../zigbee-lib/include/zblib_driver_zcl_group.h | 12 ++++---- .../zigbee-lib/include/zblib_driver_zcl_ias_zone.h | 2 +- .../zigbee-lib/include/zblib_driver_zcl_identify.h | 4 +-- .../include/zblib_driver_zcl_level_control.h | 14 ++++----- .../zigbee-lib/include/zblib_driver_zcl_on_off.h | 4 +-- .../include/zblib_driver_zcl_poll_control.h | 8 ++--- .../zigbee-lib/include/zblib_driver_zcl_scene.h | 14 ++++----- .../include/zblib_driver_zcl_thermostat.h | 10 +++---- .../zigbee-lib/include/zblib_driver_zdo_bind.h | 4 +-- .../include/zblib_driver_zdo_dev_control.h | 34 +++++++++++----------- zigbee-daemon/zigbee-lib/include/zblib_log.h | 14 ++++----- zigbee-daemon/zigbee-lib/include/zblib_types.h | 3 +- 22 files changed, 139 insertions(+), 140 deletions(-) diff --git a/zigbee-client/include_private/zigbee_log.h b/zigbee-client/include_private/zigbee_log.h index bc77f41..238b786 100644 --- a/zigbee-client/include_private/zigbee_log.h +++ b/zigbee-client/include_private/zigbee_log.h @@ -51,11 +51,11 @@ enum zigbee_log_priority { void zigbee_log(enum zigbee_log_type type, enum zigbee_log_priority priority, const char *tag, const char *fmt, ...); /* Logs would be available in system logs */ -#define Z_LOGI(fmt,args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGM(fmt,args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, fmt "\n", ##args); } while (0) -#define Z_LOGD(fmt,args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_DEBUG, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGW(fmt,args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_WARN, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGE(fmt,args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_ERROR, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGF(fmt,args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_FATAL, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGI(fmt, args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGM(fmt, args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, fmt "\n", ##args); } while (0) +#define Z_LOGD(fmt, args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_DEBUG, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGW(fmt, args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_WARN, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGE(fmt, args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_ERROR, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGF(fmt, args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_FATAL, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) #endif /* __ZIGBEE_LOG_H__ */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_custom.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_custom.h index 79585cc..b21d1d5 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_custom.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_custom.h @@ -21,9 +21,9 @@ /**< ZigBee 'custom' driver operations */ typedef struct { - gboolean (*aps_send)(ZigBeeDriver *driver, guint request_id); - gboolean (*zcl_send)(ZigBeeDriver *driver, guint request_id); - gboolean (*send_to_local)(ZigBeeDriver *driver, guint request_id); + gboolean(*aps_send) (ZigBeeDriver *driver, guint request_id); + gboolean(*zcl_send) (ZigBeeDriver *driver, guint request_id); + gboolean(*send_to_local) (ZigBeeDriver *driver, guint request_id); } ZblibDriverCustomOps_t; /**< ZigBee 'custom' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_mfglib_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_mfglib_control.h index 251bfe4..b972eb3 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_mfglib_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_mfglib_control.h @@ -21,23 +21,23 @@ /**< ZigBee 'mfglib control' driver operations */ typedef struct { - gboolean (*start)(ZigBeeDriver *driver, guint request_id); - gboolean (*end)(ZigBeeDriver *driver, guint request_id); - gboolean (*start_tone)(ZigBeeDriver *driver, guint request_id); - gboolean (*stop_tone)(ZigBeeDriver *driver, guint request_id); - gboolean (*start_stream)(ZigBeeDriver *driver, guint request_id); - gboolean (*stop_stream)(ZigBeeDriver *driver, guint request_id); - gboolean (*send_packet)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_channel)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_channel)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_power)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_power)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_synoffset)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_synoffset)(ZigBeeDriver *driver, guint request_id); - gboolean (*rx_start)(ZigBeeDriver *driver, guint request_id); - gboolean (*rx_stop)(ZigBeeDriver *driver, guint request_id); - gboolean (*rx_verify)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_rssi)(ZigBeeDriver *driver, guint request_id); + gboolean(*start) (ZigBeeDriver *driver, guint request_id); + gboolean(*end) (ZigBeeDriver *driver, guint request_id); + gboolean(*start_tone) (ZigBeeDriver *driver, guint request_id); + gboolean(*stop_tone) (ZigBeeDriver *driver, guint request_id); + gboolean(*start_stream) (ZigBeeDriver *driver, guint request_id); + gboolean(*stop_stream) (ZigBeeDriver *driver, guint request_id); + gboolean(*send_packet) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_channel) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_channel) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_power) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_power) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_synoffset) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_synoffset) (ZigBeeDriver *driver, guint request_id); + gboolean(*rx_start) (ZigBeeDriver *driver, guint request_id); + gboolean(*rx_stop) (ZigBeeDriver *driver, guint request_id); + gboolean(*rx_verify) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_rssi) (ZigBeeDriver *driver, guint request_id); } ZblibDriverMfglibControlOps_t; /**< ZigBee 'mfglib control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_service.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_service.h index 21f31c6..d5c278b 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_service.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_service.h @@ -21,20 +21,20 @@ /**< ZigBee 'service' driver operations */ typedef struct { - gboolean (*zb_hw_reset)(ZigBeeDriver *driver, guint request_id); - gboolean (*form_network)(ZigBeeDriver *driver, guint request_id); - gboolean (*coex_start)(ZigBeeDriver *driver, guint request_id); - gboolean (*coex_stop)(ZigBeeDriver *driver, guint request_id); - gboolean (*leave_network)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_network_info)(ZigBeeDriver *driver, guint request_id); - gboolean (*permit_join)(ZigBeeDriver *driver, guint request_id); - gboolean (*leave_request)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_device_list)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_mac)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_device_info)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_endpoint_list)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_cluster_list)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_node_type)(ZigBeeDriver *driver, guint request_id); + gboolean(*zb_hw_reset) (ZigBeeDriver *driver, guint request_id); + gboolean(*form_network) (ZigBeeDriver *driver, guint request_id); + gboolean(*coex_start) (ZigBeeDriver *driver, guint request_id); + gboolean(*coex_stop) (ZigBeeDriver *driver, guint request_id); + gboolean(*leave_network) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_network_info) (ZigBeeDriver *driver, guint request_id); + gboolean(*permit_join) (ZigBeeDriver *driver, guint request_id); + gboolean(*leave_request) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_device_list) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_mac) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_device_info) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_endpoint_list) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_cluster_list) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_node_type) (ZigBeeDriver *driver, guint request_id); } ZblibDriverServiceOps_t; /**< ZigBee 'service' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_alarm.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_alarm.h index cbf4a68..f284422 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_alarm.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_alarm.h @@ -21,12 +21,12 @@ /**< ZigBee 'ZCL alarm' driver operations */ typedef struct { - gboolean (*get_alarm_count)(ZigBeeDriver *driver, guint request_id); - gboolean (*reset_alarm)(ZigBeeDriver *driver, guint request_id); - gboolean (*reset_all_alarm)(ZigBeeDriver *driver, guint request_id); - gboolean (*alarm)(ZigBeeDriver *driver, guint request_id); - gboolean (*reset_alarm_log)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_alarm)(ZigBeeDriver *driver, guint request_id); + gboolean(*get_alarm_count) (ZigBeeDriver *driver, guint request_id); + gboolean(*reset_alarm) (ZigBeeDriver *driver, guint request_id); + gboolean(*reset_all_alarm) (ZigBeeDriver *driver, guint request_id); + gboolean(*alarm) (ZigBeeDriver *driver, guint request_id); + gboolean(*reset_alarm_log) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_alarm) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclAlarmOps_t; /**< ZigBee 'ZCL alarm' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_basic.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_basic.h index 6faeceb..ec05d6b 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_basic.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_basic.h @@ -21,7 +21,7 @@ /**< ZigBee 'ZCL Basic' driver operations */ typedef struct { - gboolean (*reset_factory_default)(ZigBeeDriver *driver, guint request_id); + gboolean(*reset_factory_default) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclBasicOps_t; /**< ZigBee 'ZCL Basic' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_color_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_color_control.h index 2a01524..2863c5e 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_color_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_color_control.h @@ -21,17 +21,17 @@ /**< ZigBee 'ZCL color control' driver operations */ typedef struct { - gboolean (*move_to_hue)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_hue)(ZigBeeDriver *driver, guint request_id); - gboolean (*step_hue)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_to_saturation)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_saturation)(ZigBeeDriver *driver, guint request_id); - gboolean (*step_saturation)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_to_hue_and_saturation)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_to_color)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_color)(ZigBeeDriver *driver, guint request_id); - gboolean (*step_color)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_color_temperature)(ZigBeeDriver *driver, guint request_id); + gboolean(*move_to_hue) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_hue) (ZigBeeDriver *driver, guint request_id); + gboolean(*step_hue) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_to_saturation) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_saturation) (ZigBeeDriver *driver, guint request_id); + gboolean(*step_saturation) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_to_hue_and_saturation) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_to_color) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_color) (ZigBeeDriver *driver, guint request_id); + gboolean(*step_color) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_color_temperature) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclColorControlOps_t; /**< ZigBee 'ZCL color control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_door_lock.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_door_lock.h index 08d0ef6..56b0395 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_door_lock.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_door_lock.h @@ -21,10 +21,10 @@ /**< ZigBee 'ZCL door lock' driver operations */ typedef struct { - gboolean (*subscribe_lock_event)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_door_lock_pin)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_door_lock)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_lock_state)(ZigBeeDriver *driver, guint request_id); + gboolean(*subscribe_lock_event) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_door_lock_pin) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_door_lock) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_lock_state) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclDoorLockOps_t; /**< ZigBee 'ZCL door lock' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_fan_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_fan_control.h index 8408032..4542a01 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_fan_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_fan_control.h @@ -21,10 +21,10 @@ /**< ZigBee 'ZCL fan control' driver operations */ typedef struct { - gboolean (*set_fan_mode)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_fan_mode)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_fan_mode_sequence)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_fan_mode_sequence)(ZigBeeDriver *driver, guint request_id); + gboolean(*set_fan_mode) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_fan_mode) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_fan_mode_sequence) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_fan_mode_sequence) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclFanControlOps_t; /**< ZigBee 'ZCL fan control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_global_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_global_control.h index 470157d..148ce58 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_global_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_global_control.h @@ -21,18 +21,18 @@ /**< ZigBee 'ZCL global control' driver operations */ typedef struct { - gboolean (*read_attributes_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*write_attributes_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*write_attributes_undivided_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*write_attributes_no_resp)(ZigBeeDriver *driver, guint request_id); - gboolean (*write_attributes_structured)(ZigBeeDriver *driver, guint request_id); - gboolean (*read_attributes_structured)(ZigBeeDriver *driver, guint request_id); - gboolean (*configure_reporting_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*read_configure_reporting)(ZigBeeDriver *driver, guint request_id); - gboolean (*discover_attributes)(ZigBeeDriver *driver, guint request_id); - gboolean (*discover_attributes_extended)(ZigBeeDriver *driver, guint request_id); - gboolean (*discover_commands_received)(ZigBeeDriver *driver, guint request_id); - gboolean (*discover_commands_generated)(ZigBeeDriver *driver, guint request_id); + gboolean(*read_attributes_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*write_attributes_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*write_attributes_undivided_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*write_attributes_no_resp) (ZigBeeDriver *driver, guint request_id); + gboolean(*write_attributes_structured) (ZigBeeDriver *driver, guint request_id); + gboolean(*read_attributes_structured) (ZigBeeDriver *driver, guint request_id); + gboolean(*configure_reporting_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*read_configure_reporting) (ZigBeeDriver *driver, guint request_id); + gboolean(*discover_attributes) (ZigBeeDriver *driver, guint request_id); + gboolean(*discover_attributes_extended) (ZigBeeDriver *driver, guint request_id); + gboolean(*discover_commands_received) (ZigBeeDriver *driver, guint request_id); + gboolean(*discover_commands_generated) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclGlobalControlOps_t; /**< ZigBee 'ZCL global control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_group.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_group.h index 24987a0..5172a48 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_group.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_group.h @@ -21,12 +21,12 @@ /**< ZigBee 'ZCL Group' driver operations */ typedef struct { - gboolean (*add_group)(ZigBeeDriver *driver, guint request_id); - gboolean (*view_group)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_group_membership)(ZigBeeDriver *driver, guint request_id); - gboolean (*remove_group)(ZigBeeDriver *driver, guint request_id); - gboolean (*remove_all_group)(ZigBeeDriver *driver, guint request_id); - gboolean (*add_group_if_identifying)(ZigBeeDriver *driver, guint request_id); + gboolean(*add_group) (ZigBeeDriver *driver, guint request_id); + gboolean(*view_group) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_group_membership) (ZigBeeDriver *driver, guint request_id); + gboolean(*remove_group) (ZigBeeDriver *driver, guint request_id); + gboolean(*remove_all_group) (ZigBeeDriver *driver, guint request_id); + gboolean(*add_group_if_identifying) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclGroupOps_t; /**< ZigBee 'ZCL Group' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_ias_zone.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_ias_zone.h index db8aaa6..13b9420 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_ias_zone.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_ias_zone.h @@ -21,7 +21,7 @@ /**< ZigBee 'ZCL IAS zone' driver operations */ typedef struct { - gboolean (*enroll_response)(ZigBeeDriver *driver, guint request_id); + gboolean(*enroll_response) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclIasZoneOps_t; /**< ZigBee 'ZCL IAS zone' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_identify.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_identify.h index 44eb123..b3d3dea 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_identify.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_identify.h @@ -21,8 +21,8 @@ /**< ZigBee 'ZCL Identify' driver operations */ typedef struct { - gboolean (*identify)(ZigBeeDriver *driver, guint request_id); - gboolean (*query)(ZigBeeDriver *driver, guint request_id); + gboolean(*identify) (ZigBeeDriver *driver, guint request_id); + gboolean(*query) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclIdentifyOps_t; /**< ZigBee 'ZCL Identify' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_level_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_level_control.h index c603b0e..7b90f07 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_level_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_level_control.h @@ -21,13 +21,13 @@ /**< ZigBee 'ZCL level control' driver operations */ typedef struct { - gboolean (*move_to_level)(ZigBeeDriver *driver, guint request_id); - gboolean (*move)(ZigBeeDriver *driver, guint request_id); - gboolean (*step)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_to_level_with_on_off)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_with_on_off)(ZigBeeDriver *driver, guint request_id); - gboolean (*step_with_on_off)(ZigBeeDriver *driver, guint request_id); - gboolean (*stop)(ZigBeeDriver *driver, guint request_id); + gboolean(*move_to_level) (ZigBeeDriver *driver, guint request_id); + gboolean(*move) (ZigBeeDriver *driver, guint request_id); + gboolean(*step) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_to_level_with_on_off) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_with_on_off) (ZigBeeDriver *driver, guint request_id); + gboolean(*step_with_on_off) (ZigBeeDriver *driver, guint request_id); + gboolean(*stop) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclLevelControlOps_t; /**< ZigBee 'ZCL level control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_on_off.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_on_off.h index d06ef3b..22f8348 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_on_off.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_on_off.h @@ -21,8 +21,8 @@ /**< ZigBee 'ZCL on off' driver operations */ typedef struct { - gboolean (*set_on_off)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_on_off_state)(ZigBeeDriver *driver, guint request_id); + gboolean(*set_on_off) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_on_off_state) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclOnOffOps_t; /**< ZigBee 'ZCL on off' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_poll_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_poll_control.h index eb21717..9a50887 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_poll_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_poll_control.h @@ -21,10 +21,10 @@ /**< ZigBee 'ZCL poll control' driver operations */ typedef struct { - gboolean (*check_in_response)(ZigBeeDriver *driver, guint request_id); - gboolean (*fast_poll_stop)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_long_poll_interval)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_short_poll_interval)(ZigBeeDriver *driver, guint request_id); + gboolean(*check_in_response) (ZigBeeDriver *driver, guint request_id); + gboolean(*fast_poll_stop) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_long_poll_interval) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_short_poll_interval) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclPollControlOps_t; /**< ZigBee 'ZCL poll control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_scene.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_scene.h index e56304e..ee7a4b9 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_scene.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_scene.h @@ -21,13 +21,13 @@ /**< ZigBee 'ZCL scene' driver operations */ typedef struct { - gboolean (*add_scene)(ZigBeeDriver *driver, guint request_id); - gboolean (*view_scene)(ZigBeeDriver *driver, guint request_id); - gboolean (*remove_scene)(ZigBeeDriver *driver, guint request_id); - gboolean (*store_scene)(ZigBeeDriver *driver, guint request_id); - gboolean (*recall_scene)(ZigBeeDriver *driver, guint request_id); - gboolean (*remove_all_scene)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_scene_membership)(ZigBeeDriver *driver, guint request_id); + gboolean(*add_scene) (ZigBeeDriver *driver, guint request_id); + gboolean(*view_scene) (ZigBeeDriver *driver, guint request_id); + gboolean(*remove_scene) (ZigBeeDriver *driver, guint request_id); + gboolean(*store_scene) (ZigBeeDriver *driver, guint request_id); + gboolean(*recall_scene) (ZigBeeDriver *driver, guint request_id); + gboolean(*remove_all_scene) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_scene_membership) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclSceneOps_t; /**< ZigBee 'ZCL scene' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_thermostat.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_thermostat.h index dd73122..a230d49 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_thermostat.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_thermostat.h @@ -21,11 +21,11 @@ /**< ZigBee 'ZCL thermostat' driver operations */ typedef struct { - gboolean (*get_local_temp)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_weekly_schedule)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_weekly_schedule)(ZigBeeDriver *driver, guint request_id); - gboolean (*clear_weekly_schedule)(ZigBeeDriver *driver, guint request_id); - gboolean (*setpoint_raise_lower)(ZigBeeDriver *driver, guint request_id); + gboolean(*get_local_temp) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_weekly_schedule) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_weekly_schedule) (ZigBeeDriver *driver, guint request_id); + gboolean(*clear_weekly_schedule) (ZigBeeDriver *driver, guint request_id); + gboolean(*setpoint_raise_lower) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclThermostatOps_t; /**< ZigBee 'ZCL thermostat' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_bind.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_bind.h index 95d7f8c..27f0680 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_bind.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_bind.h @@ -21,8 +21,8 @@ /**< ZigBee 'ZDO bind' driver operations */ typedef struct { - gboolean (*bind_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*unbind_req)(ZigBeeDriver *driver, guint request_id); + gboolean(*bind_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*unbind_req) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZdoBindOps_t; /**< ZigBee 'ZDO bind' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_dev_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_dev_control.h index ddd656b..09cb305 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_dev_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_dev_control.h @@ -21,23 +21,23 @@ /**< ZigBee 'ZDO Dev control' driver operations */ typedef struct { - gboolean (*nwk_addr_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*matched_descriptor_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*ieee_addr_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*active_ep_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*node_desc_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*power_desc_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*complex_desc_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*user_desc_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*user_desc_set_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*device_announce)(ZigBeeDriver *driver, guint request_id); - gboolean (*simple_desc_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*mgmt_lqi_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*mgmt_rtg_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*mgmt_bind_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*mgmt_permit_join_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*mgmt_nwk_update_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*mgmt_nwk_disc_req)(ZigBeeDriver *driver, guint request_id); + gboolean(*nwk_addr_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*matched_descriptor_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*ieee_addr_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*active_ep_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*node_desc_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*power_desc_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*complex_desc_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*user_desc_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*user_desc_set_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*device_announce) (ZigBeeDriver *driver, guint request_id); + gboolean(*simple_desc_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*mgmt_lqi_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*mgmt_rtg_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*mgmt_bind_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*mgmt_permit_join_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*mgmt_nwk_update_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*mgmt_nwk_disc_req) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZdoDevControlOps_t; /**< ZigBee 'ZDO Dev control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_log.h b/zigbee-daemon/zigbee-lib/include/zblib_log.h index ff3aa79..7d3a767 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_log.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_log.h @@ -54,13 +54,13 @@ enum zblib_log_priority { void zblib_log(enum zblib_log_type type, enum zblib_log_priority priority, const char *tag, const char *fmt, ...); /* Logs would be available in system logs */ -#define Z_LOGI(fmt,args...) do { if(zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGM(fmt,args...) do { if(zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, fmt "\n", ##args); } while (0) -#define Z_LOGD(fmt,args...) do { if(zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_DEBUG, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGW(fmt,args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_WARN, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGE(fmt,args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_ERROR, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGF(fmt,args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_FATAL, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGI(fmt, args...) do { if (zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGM(fmt, args...) do { if (zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, fmt "\n", ##args); } while (0) +#define Z_LOGD(fmt, args...) do { if (zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_DEBUG, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGW(fmt, args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_WARN, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGE(fmt, args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_ERROR, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGF(fmt, args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_FATAL, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_TIME_CHECK(fmt,args...) do { zblib_log(ZIGBEE_LOG_TYPE_TIME_CHECK, ZIGBEE_LOG_INFO, "TIME_CHECK", fmt "\n", ##args); } while (0) +#define Z_TIME_CHECK(fmt, args...) do { zblib_log(ZIGBEE_LOG_TYPE_TIME_CHECK, ZIGBEE_LOG_INFO, "TIME_CHECK", fmt "\n", ##args); } while (0) #endif /* __ZIGBEE_LIB_LOG_H__ */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_types.h b/zigbee-daemon/zigbee-lib/include/zblib_types.h index 8ffd77e..16c26a8 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_types.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_types.h @@ -24,8 +24,7 @@ * -------------------------------------------------------------------------------------*/ /* Enumeration for zigbee library error code. */ -typedef enum -{ +typedef enum { ZBLIB_ERROR_NONE = 0, /**< Successful */ ZBLIB_ERROR_INVALID_PARAMETER, /**< parameter error */ ZBLIB_ERROR_PARAMETER_OUT_OF_RANGE, /**< out of range error */ -- 2.7.4 From a5c459167cd501af2e56d215ff4e4ec9d828e487 Mon Sep 17 00:00:00 2001 From: saerome kim Date: Mon, 18 Sep 2017 17:34:30 +0900 Subject: [PATCH 06/16] Remove re-start option Change-Id: I11d6ceac4b5ab02f211e9b30727c0dbab85c0a6b Signed-off-by: saerome kim --- zigbee-daemon/resources/zigbee-daemon.service | 3 --- 1 file changed, 3 deletions(-) diff --git a/zigbee-daemon/resources/zigbee-daemon.service b/zigbee-daemon/resources/zigbee-daemon.service index 240ce7f..8da1635 100644 --- a/zigbee-daemon/resources/zigbee-daemon.service +++ b/zigbee-daemon/resources/zigbee-daemon.service @@ -10,9 +10,6 @@ User=network_fw Group=network_fw SmackProcessLabel=System ExecStart=/usr/bin/zigbee-daemon -Restart=on-failure -RestartSec=0 -KillMode=none [Install] WantedBy=multi-user.target -- 2.7.4 From e60d428b6eb148c64a1d31df1644a20e8fa9ec88 Mon Sep 17 00:00:00 2001 From: saerome kim Date: Mon, 18 Sep 2017 17:43:21 +0900 Subject: [PATCH 07/16] Change zigbee-daemon'owner as network_fw Change-Id: Ia308c203f09ba0b34749ba88d03bf925278fc399 Signed-off-by: saerome kim --- packaging/zigbee-manager.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/zigbee-manager.spec b/packaging/zigbee-manager.spec index e0182d4..b9072ed 100644 --- a/packaging/zigbee-manager.spec +++ b/packaging/zigbee-manager.spec @@ -77,8 +77,8 @@ cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf %files %manifest zigbee-daemon.manifest -%defattr(644,system,system,-) -%attr(755,system,system) %{_bindir}/zigbee-daemon +%defattr(-,root,root,-) +%attr(755,network_fw,network_fw) %{_bindir}/zigbee-daemon %{_unitdir}/zigbee-daemon.service #%{_unitdir}/multi-user.target.wants/zigbee-daemon.service %attr(644,root,root) %{_datadir}/dbus-1/system-services/* -- 2.7.4 From 8c82e46f3061597ac601b8e7465a71946ea78188 Mon Sep 17 00:00:00 2001 From: saerome kim Date: Thu, 21 Sep 2017 13:55:26 +0900 Subject: [PATCH 08/16] [WGID-279204] Fix a potential memory leak problem Change-Id: I1c3a18844118890d8f062e828aba84a73ff2bbab Signed-off-by: saerome kim --- zigbee-daemon/zigbee-lib/src/zblib_plugin.c | 2 ++ zigbee-daemon/zigbee-lib/src/zblib_service.c | 1 + 2 files changed, 3 insertions(+) diff --git a/zigbee-daemon/zigbee-lib/src/zblib_plugin.c b/zigbee-daemon/zigbee-lib/src/zblib_plugin.c index d8ce3a9..48de467 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_plugin.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_plugin.c @@ -44,6 +44,8 @@ ZigBeePlugin *zblib_plugin_new(ZigBeeService *service, /* Allocate memory */ plugin = g_malloc0(sizeof(ZigBeePlugin)); + if (NULL == plugin) + return NULL; /* Update fields */ plugin->plugin_name = g_strdup(plugin_name); diff --git a/zigbee-daemon/zigbee-lib/src/zblib_service.c b/zigbee-daemon/zigbee-lib/src/zblib_service.c index 045b651..61b2025 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_service.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_service.c @@ -424,6 +424,7 @@ gboolean zblib_service_load_plugins(ZigBeeService *service, const char *plugin_p /* Create new plug-in */ plugin = zblib_plugin_new(service, filename, descriptor, handle); if (G_UNLIKELY(NULL == plugin)) { + dlclose(handle); g_free(filename); continue; } -- 2.7.4 From 624d9040180a6d09ad43107374a8347ce4b43ac4 Mon Sep 17 00:00:00 2001 From: saerome kim Date: Wed, 27 Sep 2017 20:52:31 +0900 Subject: [PATCH 09/16] Fix coverity issues - add missing g_variant_unref() Change-Id: If81a4104a3891df655de280a90cfa9b7d5a410dc Signed-off-by: saerome kim --- .../src/zigbee_service_dbus_interface_service.c | 26 +++++++++-- ...bee_service_dbus_interface_zcl_global_control.c | 53 ++++++++++++++++------ ...zigbee_service_dbus_interface_zdo_dev_control.c | 26 +++++++---- 3 files changed, 78 insertions(+), 27 deletions(-) diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c index 3327890..75cc3d3 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c @@ -451,6 +451,9 @@ static void on_service_get_network_info_resp(ZigBeeServiceInterface *service_int payload->result, v_eui64, payload->node_id, payload->pan_id, payload->channel, payload->radio_tx_power); + if (v_eui64) + g_variant_unref(v_eui64); + g_free(cb_data); } @@ -784,6 +787,9 @@ static void on_service_get_mac_resp(ZigBeeServiceInterface *service_interface, zigbee_service_complete_get_mac(service_object, invocation, payload->result, v_eui64); + if (v_eui64) + g_variant_unref(v_eui64); + g_free(cb_data); } @@ -884,6 +890,9 @@ static void on_service_get_device_info_resp(ZigBeeServiceInterface *service_inte zigbee_service_complete_get_device_info(service_object, invocation, payload->result, variant); + if (variant) + g_variant_unref(variant); + g_free(cb_data); } @@ -963,6 +972,9 @@ static void on_service_get_endpoint_list_resp(ZigBeeServiceInterface *service_in zigbee_service_complete_get_endpoint_list(service_object, invocation, payload->result, v_endpoints); + if (v_endpoints) + g_variant_unref(v_endpoints); + g_free(cb_data); } @@ -1062,6 +1074,11 @@ static void on_service_get_cluster_list_resp(ZigBeeServiceInterface *service_int zigbee_service_complete_get_cluster_list(service_object, invocation, payload->result, v_in_clusters, v_out_clusters); + if (v_in_clusters) + g_variant_unref(v_in_clusters); + if (v_out_clusters) + g_variant_unref(v_out_clusters); + g_free(cb_data); } @@ -1266,14 +1283,14 @@ void zigbee_service_dbus_interface_service_notification(ZigBeeServiceInterface * child_t->endpoints, child_t->endpoint_count, TRUE, NULL, NULL); if (NULL == v_eui64 || NULL == v_endpoints) { Z_LOGE("Failed to create variant!"); - if (v_eui64) - g_object_unref(v_eui64); - if (v_endpoints) - g_object_unref(v_endpoints); } else { zigbee_service_emit_child_joined(service_object, v_eui64, child_t->endpoint_count, v_endpoints, child_t->node_id); } + if (v_eui64) + g_variant_unref(v_eui64); + if (v_endpoints) + g_variant_unref(v_endpoints); } break; case ZBLIB_SERVICE_NOTI_CHILD_REJOINED: { @@ -1299,6 +1316,7 @@ void zigbee_service_dbus_interface_service_notification(ZigBeeServiceInterface * else { zigbee_service_emit_child_left(service_object, v_eui64, child_left_t->status); + g_variant_unref(v_eui64); } } break; diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c index 9c5a0e8..1478f0e 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c @@ -1455,16 +1455,16 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService TRUE, NULL, NULL); if (NULL == v_types || NULL == v_attrs) { Z_LOGE("Failed to create variant!"); - if (v_types) - g_variant_unref(v_types); - if (v_attrs) - g_variant_unref(v_attrs); } else { Z_LOGD("Discover attribute resp"); zigbee_zcl_global_control_emit_discover_attribute_rsp(global_control_object, attr_t->node_id, attr_t->src_ep, v_types, v_attrs, attr_t->cluster_id, attr_t->record_length, attr_t->discovery_completed); } + if (v_types) + g_variant_unref(v_types); + if (v_attrs) + g_variant_unref(v_attrs); break; } case ZBLIB_ZCL_GLOBAL_NOTI_WRITE_ATTR_STRUCTURED_RSP: { @@ -1518,6 +1518,12 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService v_status, v_attrs, v_indicator, v_index, attr_t->cluster_id, attr_t->record_length, attr_t->node_id, attr_t->src_ep); + if (v_status) + g_variant_unref(v_status); + if (v_attrs) + g_variant_unref(v_attrs); + if (v_indicator) + g_variant_unref(v_indicator); break; } case ZBLIB_ZCL_GLOBAL_NOTI_DISCOVER_CMDS_RECEIVED_RSP: { @@ -1536,6 +1542,8 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService v_commands, attr_t->cluster_id, attr_t->list_count, attr_t->node_id, attr_t->src_ep, attr_t->discovery_completed); } + if (v_commands) + g_variant_unref(v_commands); break; } case ZBLIB_ZCL_GLOBAL_NOTI_DISCOVER_CMDS_GENERATED_RSP: { @@ -1554,6 +1562,8 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService v_commands, attr_t->cluster_id, attr_t->list_count, attr_t->node_id, attr_t->src_ep, attr_t->discovery_completed); } + if (v_commands) + g_variant_unref(v_commands); break; } case ZBLIB_ZCL_GLOBAL_NOTI_DISCOVER_ATTR_EXT_RSP: { @@ -1572,12 +1582,6 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService attr_t->access_list, attr_t->list_count, TRUE, NULL, NULL); if (NULL == v_attrs_type || NULL == v_attrs || NULL == v_access) { Z_LOGE("Failed to create variant!"); - if (v_attrs_type) - g_variant_unref(v_attrs_type); - if (v_attrs) - g_variant_unref(v_attrs); - if (v_access) - g_variant_unref(v_access); } else { Z_LOGD("Discover attributes extended resp"); zigbee_zcl_global_control_emit_discover_attributes_extended_rsp( @@ -1586,6 +1590,12 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService attr_t->cluster_id, attr_t->list_count, attr_t->node_id, attr_t->src_ep, attr_t->discovery_completed); } + if (v_attrs_type) + g_variant_unref(v_attrs_type); + if (v_attrs) + g_variant_unref(v_attrs); + if (v_access) + g_variant_unref(v_access); break; } case ZBLIB_ZCL_GLOBAL_NOTI_DEFAULT_RSP: { @@ -1612,12 +1622,14 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService v_attrs = g_variant_new_from_data(G_VARIANT_TYPE("aq"), attr_t->attribute_list, (sizeof(gushort) * attr_t->list_count), TRUE, NULL, NULL); + if (NULL == v_attrs) { + Z_LOGE("Failed to create variant!"); + break; + } v_data_type = g_variant_new_from_data(G_VARIANT_TYPE("a(y)"), attr_t->data_type_list, attr_t->list_count, TRUE, NULL, NULL); - if (NULL == v_data_type || NULL == v_attrs) { + if (NULL == v_data_type) { Z_LOGE("Failed to create variant!"); - if (v_data_type) - g_variant_unref(v_data_type); if (v_attrs) g_variant_unref(v_attrs); break; @@ -1626,8 +1638,10 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService values_builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)")); if (NULL == values_builder) { Z_LOGE("Failed to create variant builder!"); - g_variant_unref(v_data_type); - g_variant_unref(v_attrs); + if (v_attrs) + g_variant_unref(v_attrs); + if (v_data_type) + g_variant_unref(v_data_type); break; } for (i = 0; i < attr_t->list_count; i++) { @@ -1643,6 +1657,12 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService attr_t->node_id, attr_t->src_ep, attr_t->cluster_id, v_attrs, v_data_type, v_values, attr_t->list_count); + if (v_attrs) + g_variant_unref(v_attrs); + if (v_data_type) + g_variant_unref(v_data_type); + if (v_values) + g_variant_unref(v_values); break; } case ZBLIB_ZCL_GLOBAL_NOTI_READ_CONFIG_REPORT_RSP: { @@ -1693,6 +1713,9 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService zigbee_zcl_global_control_emit_read_configure_reporting_rsp( global_control_object, resp_t->node_id, resp_t->src_ep, resp_t->cluster_id, resp_t->record_count, v_entries); + + if (v_entries) + g_variant_unref(v_entries); break; } default: diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c index 6012740..564dd10 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c @@ -1591,16 +1591,16 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt (sizeof(gushort) * nwk_addr_t->associated_count), TRUE, NULL, NULL); if (NULL == v_eui64 || NULL == v_associated) { Z_LOGE("Failed to create variant!"); - if (v_eui64) - g_variant_unref(v_eui64); - if (v_associated) - g_variant_unref(v_associated); } else { Z_LOGD("nwk addr ext rsp : [0x%X]", nwk_addr_t->status); zigbee_zdo_dev_control_emit_nwk_addr_ext_rsp(dev_control_object, nwk_addr_t->status, v_eui64, nwk_addr_t->node_id, nwk_addr_t->associated_count, nwk_addr_t->start_index, v_associated); } + if (v_eui64) + g_variant_unref(v_eui64); + if (v_associated) + g_variant_unref(v_associated); break; } case ZBLIB_ZDO_DEV_CONTROL_NOTI_ACTIVE_EP_RSP: { @@ -1617,6 +1617,8 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt active_t->status, active_t->node_id, v_ep_list, active_t->endpoint_count); } + if (v_ep_list) + g_variant_unref(v_ep_list); break; } case ZBLIB_ZDO_DEV_CONTROL_NOTI_SIMPLE_DESC_RSP: { @@ -1633,10 +1635,6 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt TRUE, NULL, NULL); if (NULL == v_in_cluster || NULL == v_out_cluster) { Z_LOGE("Failed to create variant!"); - if (v_in_cluster) - g_variant_unref(v_in_cluster); - if (v_out_cluster) - g_variant_unref(v_out_cluster); } else { Z_LOGD("Simple descriptor rsp"); zigbee_zdo_dev_control_emit_simple_desc_rsp(dev_control_object, @@ -1645,6 +1643,10 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt desc_t->in_cluster_count, desc_t->out_cluster_count, v_in_cluster, v_out_cluster); } + if (v_in_cluster) + g_variant_unref(v_in_cluster); + if (v_out_cluster) + g_variant_unref(v_out_cluster); break; } case ZBLIB_ZDO_DEV_CONTROL_NOTI_MATCHED_DESC_RSP: { @@ -1660,6 +1662,8 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt zigbee_zdo_dev_control_emit_matched_descriptor_rsp(dev_control_object, desc_t->status, desc_t->node_id, desc_t->list_count, v_match_list); } + if (v_match_list) + g_variant_unref(v_match_list); break; } case ZBLIB_ZDO_DEV_CONTROL_NOTI_MGMT_BIND_RSP: { @@ -1718,6 +1722,8 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt desc_t->status, desc_t->table_entries, desc_t->start_index, desc_t->table_list_count, v_entries); + if (v_entries) + g_variant_unref(v_entries); break; } case ZBLIB_ZDO_DEV_CONTROL_NOTI_MGMT_LQI_RSP: { @@ -1873,6 +1879,8 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt nwk_disc_t->status, nwk_disc_t->network_count, nwk_disc_t->start_index, nwk_disc_t->table_list_count, v_entries); + if (v_entries) + g_variant_unref(v_entries); break; } case ZBLIB_ZDO_DEV_CONTROL_NOTI_NODE_DESC_RSP: { @@ -1932,6 +1940,8 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt zigbee_zdo_dev_control_emit_user_desc_rsp(dev_control_object, desc_t->status, desc_t->node_id, desc_t->list_count, v_desc_list); } + if (v_desc_list) + g_variant_unref(v_desc_list); break; } case ZBLIB_ZDO_DEV_CONTROL_NOTI_USER_DESC_CONFIRM: { -- 2.7.4 From 5cfe7fe1a3a014fdb6e4ca0ed15f1e93ca162194 Mon Sep 17 00:00:00 2001 From: "jh8801.jung" Date: Fri, 29 Sep 2017 08:41:17 +0900 Subject: [PATCH 10/16] Fix Prevent issue WGID : 36901 Signed-off-by: jh8801.jung Change-Id: Ic7df65b8c9cab89453f6b814825ba3e6690278fa --- zigbee-daemon/zigbee-lib/src/zblib_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zigbee-daemon/zigbee-lib/src/zblib_service.c b/zigbee-daemon/zigbee-lib/src/zblib_service.c index 045b651..c8c078b 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_service.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_service.c @@ -457,7 +457,7 @@ gboolean zblib_service_initialize_plugins(ZigBeeService *service) /* If there is no initializer, it should have asynchronous one */ const ZblibPluginDescriptor_t *descriptor = zblib_plugin_get_descriptor(plugin); - if (NULL != descriptor->init_async) { + if (NULL != descriptor && NULL != descriptor->init_async) { /* Register async initializer */ struct _zblib_async_init_info *info = g_try_new0(struct _zblib_async_init_info, 1); -- 2.7.4 From 8ff258a30d12afd475d293032e2bcae822f64bd6 Mon Sep 17 00:00:00 2001 From: saerome kim Date: Tue, 10 Oct 2017 19:35:49 +0900 Subject: [PATCH 11/16] Fix resource leak problem : 32057, 28497, 41860, 22384, 26742 Change-Id: Ic8ef28d48f31a8b5b7594c4129068b31466056d0 Signed-off-by: saerome kim --- .../zigbee-interface/src/zigbee_service_dbus_interface_service.c | 2 ++ .../src/zigbee_service_dbus_interface_zcl_global_control.c | 8 ++++---- .../src/zigbee_service_dbus_interface_zdo_dev_control.c | 6 ++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c index 75cc3d3..d04136d 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c @@ -1303,6 +1303,8 @@ void zigbee_service_dbus_interface_service_notification(ZigBeeServiceInterface * Z_LOGE("Failed to create variant!"); else zigbee_service_emit_child_rejoined(service_object, v_eui64); + if (v_eui64) + g_variant_unref(v_eui64); } break; case ZBLIB_SERVICE_NOTI_CHILD_LEFT: { diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c index 1478f0e..5e8974a 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c @@ -1400,16 +1400,16 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService TRUE, NULL, NULL); if (NULL == v_values || NULL == v_attrs) { Z_LOGE("Failed to create variant!"); - if (v_values) - g_variant_unref(v_values); - if (v_attrs) - g_variant_unref(v_attrs); } else { Z_LOGD("Write attributes resp"); zigbee_zcl_global_control_emit_write_attributes_rsp(global_control_object, attr_t->node_id, attr_t->src_ep, v_values, v_attrs, attr_t->cluster_id, attr_t->record_length); } + if (v_values) + g_variant_unref(v_values); + if (v_attrs) + g_variant_unref(v_attrs); break; } case ZBLIB_ZCL_GLOBAL_NOTI_CONFIG_REPORT_RSP: { diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c index 564dd10..63782ba 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c @@ -1576,6 +1576,8 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt nwk_addr_t->status, v_eui64, nwk_addr_t->node_id, nwk_addr_t->associated_count, nwk_addr_t->start_index); } + if (v_eui64) + g_variant_unref(v_eui64); break; } case ZBLIB_ZDO_DEV_CONTROL_NOTI_NWK_ADDR_EXT_RSP: { @@ -1879,6 +1881,8 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt nwk_disc_t->status, nwk_disc_t->network_count, nwk_disc_t->start_index, nwk_disc_t->table_list_count, v_entries); + if (entry_builder) + g_variant_builder_unref(entry_builder); if (v_entries) g_variant_unref(v_entries); break; @@ -1924,6 +1928,8 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt zigbee_zdo_dev_control_emit_complex_desc_rsp(dev_control_object, desc_t->status, desc_t->node_id, desc_t->list_count, v_desc_list); } + if (v_desc_list) + g_variant_unref(v_desc_list); break; } case ZBLIB_ZDO_DEV_CONTROL_NOTI_USER_DESC_RSP: { -- 2.7.4 From 3244c574f8b5858734e5c02620aaa87ad270ceec Mon Sep 17 00:00:00 2001 From: saerome kim Date: Tue, 10 Oct 2017 19:39:10 +0900 Subject: [PATCH 12/16] Fix resource leak : 23614 This problem is caused by managing a number of operations to be processed asynchronously in the initialization list. If the initialization of a function that needs to be processed asynchronously fails, we did not free the previously added asynchronous functions. To solve this problem, we modified the asynchronous initialization function list to be deleted from the memory when the function creation to be processed asynchronously fails and when the plugin is unloaded. Change-Id: I66226faedb360d7c2f41fd35db516a63684e112d Signed-off-by: saerome kim --- zigbee-daemon/zigbee-lib/src/zblib_service.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/zigbee-daemon/zigbee-lib/src/zblib_service.c b/zigbee-daemon/zigbee-lib/src/zblib_service.c index f512514..2bfb853 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_service.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_service.c @@ -266,6 +266,22 @@ static void __zblib_service_remove_request_table_iter(gpointer key, zblib_request_free(service_interface, request_id); } +static void __zblib_service_remove_async_list(GSList *list_async) +{ + GSList *iter = NULL; + if (0 < g_slist_length(list_async)) { + iter = g_slist_nth(list_async, 0); + while (iter) { + if (iter) { + struct _zblib_async_init_info *async_plugin = + (struct _zblib_async_init_info *)(list_async->data); + list_async = g_slist_remove(list_async, async_plugin); + } + iter = g_slist_nth(list_async, 0); + } + } +} + ZigBeeService *zblib_service_new() { ZigBeeService *service; @@ -473,6 +489,7 @@ gboolean zblib_service_initialize_plugins(ZigBeeService *service) list_async = g_slist_append(list_async, info); } else { + __zblib_service_remove_async_list(list_async); Z_LOGE("Fatal : Failed to initialize plugin"); return FALSE; } @@ -517,10 +534,15 @@ gboolean zblib_service_initialize_async_plugins(ZigBeeService *service) gboolean zblib_service_unload_plugins(ZigBeeService *service) { - GSList *list; + GSList *list = NULL; + GSList *list_async = NULL; zblib_check_null_ret_error("service", service, FALSE); + /* Unload everyy async_plugin */ + list_async = __zblib_service_ref_async_initializer(service); + __zblib_service_remove_async_list(list_async); + list = zblib_service_ref_plugins(service); while (list != NULL) { ZigBeePlugin *plugin = list->data; -- 2.7.4 From ae38e4925577c62b0f1b86d20da26cad0add6a37 Mon Sep 17 00:00:00 2001 From: saerome kim Date: Mon, 16 Oct 2017 19:22:44 +0900 Subject: [PATCH 13/16] Synchronize tizen_4.0 and tizen branch. Change-Id: I071b18b641117db0392948688a2b26e2ea803b89 Signed-off-by: saerome kim --- packaging/zigbee-manager.spec | 2 +- zigbee-daemon.manifest | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packaging/zigbee-manager.spec b/packaging/zigbee-manager.spec index b9072ed..59e4d70 100644 --- a/packaging/zigbee-manager.spec +++ b/packaging/zigbee-manager.spec @@ -1,6 +1,6 @@ %define major 0 %define minor 1 -%define patchlevel 1 +%define patchlevel 2 %define CHECK_ZIGBEE_PRIVILEGE False Name: zigbee-manager diff --git a/zigbee-daemon.manifest b/zigbee-daemon.manifest index f5a44ec..97e8c31 100644 --- a/zigbee-daemon.manifest +++ b/zigbee-daemon.manifest @@ -1,5 +1,5 @@ - - - + + + -- 2.7.4 From 346a548c97507a2119d4e870744d254dbbb6ef3d Mon Sep 17 00:00:00 2001 From: "jh8801.jung" Date: Mon, 23 Oct 2017 15:29:37 +0900 Subject: [PATCH 14/16] Fix Coverity issue : 22384, 41860 Signed-off-by: jh8801.jung Change-Id: I77bab2aa1e4e36407f737c3586cba1c0c102dc65 (cherry picked from commit 2732a5dc69782534ec200cd69d88100d796bd6a5) --- .../src/zigbee_service_dbus_interface_zcl_global_control.c | 2 ++ .../src/zigbee_service_dbus_interface_zdo_dev_control.c | 10 ++++++++++ 2 files changed, 12 insertions(+) mode change 100644 => 100755 zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c mode change 100644 => 100755 zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c old mode 100644 new mode 100755 index 5e8974a..91973d5 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c @@ -1385,6 +1385,8 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService attr_t->cluster_id, attr_t->status, attr_t->type, attr_t->record_length, attr_t->is_string); } + if (v_values) + g_variant_unref(v_values); break; } case ZBLIB_ZCL_GLOBAL_NOTI_WRITE_ATTR_RSP: { diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c old mode 100644 new mode 100755 index 63782ba..30582dd --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c @@ -1724,6 +1724,8 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt desc_t->status, desc_t->table_entries, desc_t->start_index, desc_t->table_list_count, v_entries); + if (entry_builder) + g_variant_builder_unref(entry_builder); if (v_entries) g_variant_unref(v_entries); break; @@ -1786,6 +1788,10 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt desc_t->status, desc_t->table_entries, desc_t->start_index, desc_t->table_list_count, v_entries); + if (entry_builder) + g_variant_builder_unref(entry_builder); + if (v_entries) + g_variant_unref(v_entries); break; } case ZBLIB_ZDO_DEV_CONTROL_NOTI_MGMT_RTG_RSP: { @@ -1817,6 +1823,10 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt desc_t->status, desc_t->table_entries, desc_t->start_index, desc_t->table_list_count, v_entries); + if (entry_builder) + g_variant_builder_unref(entry_builder); + if (v_entries) + g_variant_unref(v_entries); break; } case ZBLIB_ZDO_DEV_CONTROL_NOTI_MGMT_PERMIT_JOIN_RSP: { -- 2.7.4 From 308d35c61f8380c284ad5060f2a5181a16881b2c Mon Sep 17 00:00:00 2001 From: saerome kim Date: Wed, 15 Nov 2017 10:12:55 +0900 Subject: [PATCH 15/16] Remove 'warning: user network_fw does not exist - using root' warning Change-Id: I20aa404ab10e7c7daf53238ba559432c32f47002 Signed-off-by: saerome kim --- packaging/zigbee-manager.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/zigbee-manager.spec b/packaging/zigbee-manager.spec index 59e4d70..44ef413 100644 --- a/packaging/zigbee-manager.spec +++ b/packaging/zigbee-manager.spec @@ -18,6 +18,8 @@ BuildRequires: pkgconfig(gio-2.0) BuildRequires: pkgconfig(gio-unix-2.0) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(vconf) +# if image creater does not know 'network_fw' +Requires: security-config %description Description: ZigBee Daemon -- 2.7.4 From 9f1121732cfb3a77dafeeef8494737cc231d694b Mon Sep 17 00:00:00 2001 From: "saerome.kim" Date: Mon, 19 Mar 2018 20:33:11 +0900 Subject: [PATCH 16/16] fis svace issue - WID 317087 Change-Id: I17af8ef3b970d511f80ad994ef164d0820524c31 Signed-off-by: saerome.kim --- .../zigbee-interface/src/zigbee_service_dbus_interface.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c index afab090..af19f9f 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c @@ -362,6 +362,8 @@ static void zigbee_on_name_acquired(GDBusConnection *connection, static void zigbee_on_bus_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data) { + gboolean ret; + GError *error = NULL; ZigbeeObjectSkeleton *zigbee_object; ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data; ZigBeeService *service = NULL; @@ -413,9 +415,14 @@ static void zigbee_on_bus_acquired(GDBusConnection *connection, /* * Export 'manager' interface on ZigBee D-BUS */ - g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(custom_data->zigbee_mgr), - connection, ZIGBEE_DBUS_PATH, NULL); - + ret = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(custom_data->zigbee_mgr), + connection, ZIGBEE_DBUS_PATH, &error); + if (FALSE == ret) { + /* LCOV_EXCL_START */ + Z_LOGW("g_dbus_interface_skeleton_export() Fail(%s)", error->message); + g_error_free(error); + /* LCOV_EXCL_STOP */ + } /* * Exports all objects managed by 'manager' on Connection (connection) */ -- 2.7.4