Merge changes Id24d9bb0,I6807ed25
authorJosé Bollo <jose.bollo@iot.bzh>
Tue, 23 Apr 2019 09:06:24 +0000 (09:06 +0000)
committerGerrit Code Review <gerrit@automotivelinux.org>
Tue, 23 Apr 2019 09:06:24 +0000 (09:06 +0000)
* changes:
  change style initialization of struct afb_auth
  missing full initialization for struct afb_verb_v3

21 files changed:
CMakeLists.txt
bindings/CMakeLists.txt
bindings/intrinsics/CMakeLists.txt
bindings/samples/CMakeLists.txt
bindings/samples/hello3.c
bindings/tutorials/CMakeLists.txt [moved from bindings/tutorial/CMakeLists.txt with 88% similarity]
bindings/tutorials/export.map [moved from bindings/tutorial/export.map with 100% similarity]
bindings/tutorials/tuto-1.c [moved from bindings/tutorial/tuto-1.c with 100% similarity]
bindings/tutorials/tuto-2.c [moved from bindings/tutorial/tuto-2.c with 100% similarity]
bindings/tutorials/tuto-3.cpp [moved from bindings/tutorial/tuto-3.cpp with 100% similarity]
bindings/tutorials/tuto-4.c [moved from bindings/tutorial/tuto-4.c with 100% similarity]
bindings/tutorials/tuto-5.cpp [moved from bindings/tutorial/tuto-5.cpp with 100% similarity]
bindings/tutorials/tuto-app1.c [moved from bindings/tutorial/tuto-app1.c with 100% similarity]
conf.d/packaging/deb/agl-app-framework-binder.dsc
conf.d/packaging/deb/debian.agl-app-framework-binder-samples.install [new file with mode: 0644]
conf.d/packaging/deb/debian.control
conf.d/packaging/rpm/agl-app-framework-binder.spec
coverage/bin/Makefile
docs/afb-migration-to-binding-v3.md
src/afb-wsj1.c
src/sig-monitor.c

index f841b5d..ebda48f 100644 (file)
@@ -157,6 +157,7 @@ IF(ONLY_DEVTOOLS)
        MESSAGE(WARNING "Only DEVTOOLS are compiled, not the binder!")
 ELSE()
        SET(binding_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/afb)
+       SET(install_datadir ${CMAKE_INSTALL_FULL_DATADIR}/af-binder)
 
        ###########################################################################
        # activates the monitoring by default
index 35f2289..c4fbdea 100644 (file)
@@ -18,5 +18,5 @@
 
 ADD_SUBDIRECTORY(intrinsics)
 ADD_SUBDIRECTORY(samples)
-ADD_SUBDIRECTORY(tutorial)
+ADD_SUBDIRECTORY(tutorials)
 
index 70da19e..ee98121 100644 (file)
@@ -27,7 +27,7 @@ SET_TARGET_PROPERTIES(afb-dbus-binding PROPERTIES
        PREFIX ""
        LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
 )
-TARGET_LINK_LIBRARIES(afb-dbus-binding ${link_libraries})
+TARGET_LINK_LIBRARIES(afb-dbus-binding ${json-c_LDFLAGS} ${libsystemd_LDFLAGS})
 INSTALL(TARGETS afb-dbus-binding
         LIBRARY DESTINATION ${binding_install_dir})
 
index 34b364f..5144268 100644 (file)
 # limitations under the License.
 ###########################################################################
 
-
-INCLUDE_DIRECTORIES(${include_dirs})
-
-##################################################
-# AuthLogin
-##################################################
-ADD_LIBRARY(authLogin MODULE AuthLogin.c)
-SET_TARGET_PROPERTIES(authLogin PROPERTIES
-       PREFIX ""
-       LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
-)
-TARGET_LINK_LIBRARIES(authLogin ${link_libraries})
-INSTALL(TARGETS authLogin
-        LIBRARY DESTINATION ${binding_install_dir})
-
-##################################################
-# DemoContext
-##################################################
-ADD_LIBRARY(demoContext MODULE DemoContext.c)
-SET_TARGET_PROPERTIES(demoContext PROPERTIES
-       PREFIX ""
-       LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
-)
-TARGET_LINK_LIBRARIES(demoContext ${link_libraries})
-INSTALL(TARGETS demoContext
-        LIBRARY DESTINATION ${binding_install_dir})
-
-##################################################
-# DemoPost
-##################################################
-ADD_LIBRARY(demoPost MODULE DemoPost.c)
-SET_TARGET_PROPERTIES(demoPost PROPERTIES
-       PREFIX ""
-       LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
-)
-TARGET_LINK_LIBRARIES(demoPost ${link_libraries})
-INSTALL(TARGETS demoPost
-        LIBRARY DESTINATION ${binding_install_dir})
-
-##################################################
-# tic-tac-toe
-##################################################
-ADD_LIBRARY(tic-tac-toe MODULE tic-tac-toe.c)
-SET_TARGET_PROPERTIES(tic-tac-toe PROPERTIES
-       PREFIX ""
-       LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
-)
-TARGET_LINK_LIBRARIES(tic-tac-toe ${link_libraries})
-INSTALL(TARGETS tic-tac-toe
-        LIBRARY DESTINATION ${binding_install_dir})
-
-##################################################
-# hello2
-##################################################
-ADD_LIBRARY(hello2 MODULE hello2.c)
-SET_TARGET_PROPERTIES(hello2 PROPERTIES
-       PREFIX ""
-       LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
-)
-TARGET_LINK_LIBRARIES(hello2 ${link_libraries})
-INSTALL(TARGETS hello2
-        LIBRARY DESTINATION ${binding_install_dir})
-
-##################################################
-# hello3
-##################################################
-ADD_LIBRARY(hello3 MODULE hello3.c)
-SET_TARGET_PROPERTIES(hello3 PROPERTIES
-       PREFIX ""
-       LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
-)
-TARGET_LINK_LIBRARIES(hello3 ${link_libraries})
-INSTALL(TARGETS hello3
-        LIBRARY DESTINATION ${binding_install_dir})
+macro(sample name source)
+  add_library(${name} MODULE ${source})
+  set_target_properties(${name} PROPERTIES PREFIX "" LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map")
+#  target_link_libraries(${name} ${link_libraries})
+  target_link_libraries(${name} ${json-c_LDFLAGS} ${CMAKE_THREAD_LIBS_INIT})
+  install(TARGETS ${name} LIBRARY DESTINATION ${install_datadir}/bindings/samples)
+endmacro(sample)
+
+sample(authLogin    AuthLogin.c)
+sample(demoContext  DemoContext.c)
+sample(demoPost     DemoPost.c)
+sample(tic-tac-toe  tic-tac-toe.c)
+sample(hello2       hello2.c)
+sample(hello3       hello3.c)
 
index af19478..ff7da61 100644 (file)
@@ -913,6 +913,7 @@ static void api (afb_req_t request)
                }
                sapi->api = afb_api_new_api(api, apiname, NULL, 1, apipreinit, NULL);
                if (!sapi->api) {
+                       free(sapi);
                        afb_req_reply_f(request, NULL, "cant-create", "%m");
                        goto end;
                }
similarity index 88%
rename from bindings/tutorial/CMakeLists.txt
rename to bindings/tutorials/CMakeLists.txt
index f05fa54..e071d7a 100644 (file)
 ###########################################################################
 
 
-#INCLUDE_DIRECTORIES(${include_dirs})
-
 MACRO(tuto num ext)
   ADD_LIBRARY(tuto-${num} MODULE tuto-${num}.${ext})
   SET_TARGET_PROPERTIES(tuto-${num} PROPERTIES
        PREFIX ""
        LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
   )
-  TARGET_LINK_LIBRARIES(tuto-${num} ${link_libraries})
+  TARGET_LINK_LIBRARIES(tuto-${num}  ${json-c_LDFLAGS})
+  install(TARGETS tuto-${num} LIBRARY DESTINATION ${install_datadir}/bindings/tutorials)
 ENDMACRO(tuto)
 
 
index 9327ea3..b9c1ef5 100644 (file)
@@ -1,6 +1,6 @@
 Format: 1.0
 Source: agl-app-framework-binder
-Binary: agl-app-framework-binder-bin, agl-app-framework-binder-dev
+Binary: agl-app-framework-binder-bin, agl-app-framework-binder-dev, agl-app-framework-binder-samples
 Architecture: any
 Version: 2.0-0
 Maintainer: unknown <unknown@debian.org>
diff --git a/conf.d/packaging/deb/debian.agl-app-framework-binder-samples.install b/conf.d/packaging/deb/debian.agl-app-framework-binder-samples.install
new file mode 100644 (file)
index 0000000..497004f
--- /dev/null
@@ -0,0 +1 @@
+/opt/AGL/share/af-binder/*
index 45e9827..d8dac6f 100644 (file)
@@ -24,3 +24,9 @@ Architecture: any
 Depends: agl-app-framework-binder-bin
 Description: agl-app-framework-binder-devel
 
+Package: agl-app-framework-binder-samples
+Section: libs
+Architecture: any
+Depends: agl-app-framework-binder-bin
+Description: agl-app-framework-binder-samples
+
index 4f70146..7102e86 100644 (file)
@@ -51,13 +51,19 @@ Summary:        AGL app-framework-binder-devel
 Provides a test agl binder service which can be used to test agl bindings on Linux PC
 This service is evolving permanently and is only designed as a helper for developper.
 
+%package samples
+Requires:       %{name} = %{version}
+Summary:        AGL app-framework-binder-samples
+%description samples
+Provides sample bindings for testing AGL framework binder
+
 
 %prep
 %setup -q -n app-framework-binder-%{version}
 
 %build
 export PKG_CONFIG_PATH=%{_libdir}/pkgconfig
-%cmake  -DAGL_DEVEL=1 -DINCLUDE_MONITORING=ON"
+%cmake  -DAGL_DEVEL=1 -DINCLUDE_MONITORING=ON
 %__make %{?_smp_mflags}
 
 
@@ -112,6 +118,12 @@ EOF
 %dir %{_libdir}/pkgconfig
 %{_libdir}/pkgconfig/*.pc
 
+%files samples
+%defattr(-,root,root)
+%dir %{_datadir}
+%dir %{_datadir}/af-binder
+%{_datadir}/af-binder/*
+
 %changelog
 * Wed Sep 27 2017 Dominig
 - move to git repo
index c058169..b0914c7 100644 (file)
@@ -60,7 +60,7 @@ ldflags = -ldl -lrt -lpthread \
 
 cflags = $(ccflags) $(ldflags)
 
-defs =         -DAGL_DEVEL \
+defs =         -DAGL_DEVEL=1 \
        -DWITH_MONITORING_OPTION \
        -DAFB_VERSION=\"cov\" \
        -DUSE_SIG_MONITOR_DUMPSTACK=1 \
@@ -69,6 +69,12 @@ defs =       -DAGL_DEVEL \
        -DUSE_SIG_MONITOR_TIMERS=1 \
        -DWITH_AFB_HOOK=1 \
        -DWITH_AFB_TRACE=1 \
+       -DWITH_LEGACY_BINDING_V1=0 \
+       -DWITH_LEGACY_BINDING_V2=1 \
+       -DWITH_LEGACY_BINDING_VDYN=0 \
+       -DWITH_DBUS_TRANSPARENCY=0 \
+       -DWITH_SUPERVISION=0 \
+       -DWITH_DYNAMIC_BINDING=1 \
        -DBINDING_INSTALL_DIR=\"$(shell pwd)/fake\"
 
 afb_lib_src = $(shell ls $(srcdir)/*.c | egrep -v '/afs-|/main-|/fdev-epoll.c|/afb-ws-client.c' )
index 29ea179..4a8096d 100644 (file)
@@ -177,8 +177,8 @@ of the context and event subscriptions. The new design allows you to specify:
  - whether the caller or the service or both or none will receive the
    eventually events during the subcall.
 
-See [calls](reference-v3/func-api/#calls-and-job-functions) and
-[subcalls](reference-v3/func-req/#subcall-functions).
+See [calls](reference-v3/func-api.html#calls-and-job-functions) and
+[subcalls](reference-v3/func-req.html#subcall-functions).
 
 The table below list the changes to apply:
 
@@ -197,4 +197,4 @@ Consider use of event handlers
 Binding V3 brings new ways of handling event in services. You can register
 functions that will handle specific events and that accept closure arguments.
 
-See [**afb_api_event_handler_add** and **afb_api_event_handler_del**](reference-v3/func-api/#event-functions)
+See [**afb_api_event_handler_add** and **afb_api_event_handler_del**](reference-v3/func-api.html#event-functions)
index 33e0d19..4080edf 100644 (file)
@@ -307,11 +307,13 @@ static struct afb_wsj1_msg *wsj1_msg_make(struct afb_wsj1 *wsj1, char *text, siz
 
        /* scan */
        n = wsj1_msg_scan(text, items);
-       if (n < 0)
+       if (n <= 0)
                goto bad_header;
 
        /* scans code: 2|3|4|5 */
-       if (items[0][1] != 1) goto bad_header;
+       if (items[0][1] != 1)
+               goto bad_header;
+
        switch (text[items[0][0]]) {
        case '2': msg->code = CALL; break;
        case '3': msg->code = RETOK; break;
index f15f214..7059281 100644 (file)
@@ -154,7 +154,7 @@ static inline int timeout_create()
                rc = timer_create(CLOCK_THREAD_CPUTIME_ID, &sevp, &thread_timerid);
                thread_timer_set = !rc;
        }
-       return 0;
+       return rc;
 }
 
 /*