summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>2022-02-12 14:57:42 +0900
committerNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>2022-02-12 15:07:11 +0900
commit878e3ffc85585b83fe9db29086dd125b82162256 (patch)
tree858c6c4d93f65a85f2a1eb782b1982daba0dd81d
parentbbdf5e3bdb72bfe5516cec63573b117d97ed6bc6 (diff)
Input device support in ivi-demo guest
When weston is running in guset, it can't find input device. It cause by udev data dependency for libinput. IC EG member investigate some input support plan now, but it require to long way. This patch is workaround for next release to support input device in ivi-demo guest. That based on CES2020 demo method. Bug-AGL: SPEC-4136 Signed-off-by: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp> Change-Id: I622a53add8441374d3c3be6e905f46ee56d51dad
-rw-r--r--meta-agl-lxc/dynamic-layers/meta-rcar-gen3/recipes-container/lxc-config/lxc-config-ivi-demo/mount.in5
-rw-r--r--meta-agl-lxc/recipes-container/lxc-config/lxc-config-ivi-demo/mount.in4
-rw-r--r--meta-agl-lxc/recipes-core/base-files/base-files/fstab3
-rw-r--r--meta-agl-lxc/recipes-core/base-files/base-files_%.bbappend2
4 files changed, 14 insertions, 0 deletions
diff --git a/meta-agl-lxc/dynamic-layers/meta-rcar-gen3/recipes-container/lxc-config/lxc-config-ivi-demo/mount.in b/meta-agl-lxc/dynamic-layers/meta-rcar-gen3/recipes-container/lxc-config/lxc-config-ivi-demo/mount.in
index 1bd40a3f..13216a9e 100644
--- a/meta-agl-lxc/dynamic-layers/meta-rcar-gen3/recipes-container/lxc-config/lxc-config-ivi-demo/mount.in
+++ b/meta-agl-lxc/dynamic-layers/meta-rcar-gen3/recipes-container/lxc-config/lxc-config-ivi-demo/mount.in
@@ -4,12 +4,17 @@ lxc.mount.entry = /var/lib/lxc/ivi-demo/system.conf etc/systemd/system.conf.d/10
lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
lxc.mount.entry = shm /dev/shm tmpfs defaults 0 0
lxc.mount.entry = /sys/kernel/security sys/kernel/security none ro,bind,optional 0 0
+lxc.mount.entry = tmpfs run tmpfs defaults
+lxc.mount.entry = /run/udev/data run/udev/data none ro,bind,optional,create=dir
lxc.cgroup.devices.allow = c 226:* rwm
lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
lxc.mount.entry = /run/drm-lease-manager/@DRM_LEASE_DEVICE@ var/display/drm-lease-manager/@DRM_LEASE_DEVICE@ none bind,create=file
+lxc.cgroup.devices.allow = c 13:* rwm
+lxc.mount.entry = /dev/input dev/input none bind,optional,create=dir
+
lxc.cgroup.devices.allow = c 10:* rwm
lxc.mount.entry = /dev/pvr_sync dev/pvr_sync none bind,optional,create=file
diff --git a/meta-agl-lxc/recipes-container/lxc-config/lxc-config-ivi-demo/mount.in b/meta-agl-lxc/recipes-container/lxc-config/lxc-config-ivi-demo/mount.in
index 781cdb7b..7ae9c458 100644
--- a/meta-agl-lxc/recipes-container/lxc-config/lxc-config-ivi-demo/mount.in
+++ b/meta-agl-lxc/recipes-container/lxc-config/lxc-config-ivi-demo/mount.in
@@ -4,9 +4,13 @@ lxc.mount.entry = /var/lib/lxc/ivi-demo/system.conf etc/systemd/system.conf.d/10
lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
lxc.mount.entry = shm /dev/shm tmpfs defaults 0 0
lxc.mount.entry = /sys/kernel/security sys/kernel/security none ro,bind,optional 0 0
+lxc.mount.entry = tmpfs run tmpfs defaults
+lxc.mount.entry = /run/udev/data run/udev/data none ro,bind,optional,create=dir
lxc.cgroup.devices.allow = c 226:* rwm
lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
lxc.mount.entry = /run/drm-lease-manager/@DRM_LEASE_DEVICE@ var/display/drm-lease-manager/@DRM_LEASE_DEVICE@ none bind,create=file
+lxc.cgroup.devices.allow = c 13:* rwm
+lxc.mount.entry = /dev/input dev/input none bind,optional,create=dir
diff --git a/meta-agl-lxc/recipes-core/base-files/base-files/fstab b/meta-agl-lxc/recipes-core/base-files/base-files/fstab
new file mode 100644
index 00000000..a27f8cd6
--- /dev/null
+++ b/meta-agl-lxc/recipes-core/base-files/base-files/fstab
@@ -0,0 +1,3 @@
+# Reference fstab for container guest
+devpts /dev/pts devpts mode=0620,gid=5 0 0
+tmpfs /var/volatile tmpfs defaults 0 0
diff --git a/meta-agl-lxc/recipes-core/base-files/base-files_%.bbappend b/meta-agl-lxc/recipes-core/base-files/base-files_%.bbappend
new file mode 100644
index 00000000..2df9447b
--- /dev/null
+++ b/meta-agl-lxc/recipes-core/base-files/base-files_%.bbappend
@@ -0,0 +1,2 @@
+FILESEXTRAPATHS:prepend:aglcontainerguest := "${THISDIR}/base-files:"
+
5 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655
[LEGACY] Migration from binding V1 to binding V2
=======================================

> LEGACY!!! IT IS NOT EXPECTED THAT YOU STILL NEED THIS GUIDE.
>
> THIS GUIDE WILL BE REMOVED IN A NEAR FUTURE


The ***binding*** interface evolved from version 1 to version 2
for the following reasons:

- integration of the security requirements within the bindings
- simplification of the API (after developer feedbacks)
- removal of obscure features, cleanup

The ***binder*** can run ***bindings*** v1 and/or v2 in any combination.  
Thus moving from v1 to v2 is not enforced, there is no real need.

More, it is possible to write a dual ***binding***:

- a ***binding*** that implements the version 1 and the version 2.

However, IT IS HIGHLY RECOMMENDED TO SWITCH TO ONLY VERSION 2:

- any new development SHOULD start using ***binding*** V2
- existing ***bindings*** SHOULD migrate to the version 2

This guide covers the migration of bindings from version 1 to version 2.

It also explains some of the rationale taken when migrating from version 1 to version 2.

In the future, if ***binding*** api evolves to fresh versions (3, 4, ...)
it might be necessarily to write bindings implementing more than
just one version.  
For example:

- a ***binding*** being v2 AND v3 will resolve the issue of running on older and newer version of AGL. 

This should always be possible even if more complicated.

Important things to known when migrating
----------------------------------------

One of the most important change when migrating from v1 to v2 is
that many functions use an hidden *common* variable.  
This affects the functions of the following classes:

- functions of class **daemon**:
  - functions starting with **afb_daemon_...**
  - functions for logging: **ERROR**, **WARNING**, **NOTICE**, **INFO**, **DEBUG**
- functions of class **service**:
  - functions starting with **afb_service_...**
- callback functions:
  - the register function (that is removed)
  - the service init function
  - the onevent function

For these functions, the first parameter is now implicit.

Let takes an example.  
For ***binding*** v1 you had to write:

```C
        afb_daemon_broadcast_event(afbitf->daemon, reason, description);
```

For ***binding*** v2, you simply write:

```C
        afb_daemon_broadcast_event(reason, description);
```

This simplification is possible because the header files included for the bindings
now provide a common variable for storing the **daemon** and **service** data.

As a programmer, you shouldn't care much about that hidden variable.  
It simplifies the job, that's all and that is the reason of the change.

An other important difference is between the version 1 and the version 2 is
on how the ***binding***'s **API** is documented.  
The version 2 emphasis the **OpenAPI v3** description of the **API**.  
For this reason, to avoid duplication of descriptions, only one description is expected:

- The **OpenAPI** one.

Task list for the migration
---------------------------

This task list is:

1. Enforce use of binding v2 by setting **AFB_BINDING_VERSION**
1. Rewrite the main structure and the list of exported verbs
1. Adapt the init and callback functions
1. Removes the first parameter of functions of classes **daemon** and **service**
1. Consider where to emit logs for requests
1. Take care of store/unstore changes
1. Consider use of synchronous (sub)call requests
1. Optionally, removes explicit struct

The remaining chapters explain these task with more details.

Enforce use of binding v2 by setting AFB_BINDING_VERSION
--------------------------------------------------------

By defining **AFB_BINDING_VERSION** to **2** you switch to version 2.  
This is done as below.

```C
#define AFB_BINDING_VERSION 2
#include <afb/afb-binding.h>
```

After that you will get many errors when compiling.

Rewrite the main structures and the list of exported verbs
---------------------------------------------------------

The structures describing the ***binding** changed from version 1 to version 2.

The structure for describing verbs changed to include security
requirements.

In version 1 it was:

```C
struct afb_verb_desc_v1
{
       const char *name;                       /* name of the verb */
       enum afb_session_flags_v1 session;      /* authorization and session requirements of the verb */
       void (*callback)(struct afb_req req);   /* callback function implementing the verb */
       const char *info;                       /* textual description of the verb */
};
```

In version 2 it becomes:

```C
struct afb_verb_v2
{
        const char *verb;                       /* name of the verb */
        void (*callback)(struct afb_req req);   /* callback function implementing the verb */
        const struct afb_auth *auth;            /* required authorization */
        uint32_t session;                       /* authorization and session requirements of the verb */
};

```

The migration of instances of that structure requires the following actions:

- rename field **name** to **verb**
- remove field **info**
- adapt field **session** if needed
- set field **auth** to NULL

Example:

```C
 { .name= "new",   .session= AFB_SESSION_NONE, .callback= new,   .info= "Starts a new game" }
```

Becomes

```C
 { .verb = "new",   .session = AFB_SESSION_NONE, .callback = new, .auth = NULL }
```

The field **auth** can be set to a value describing the requested
authorization.

The main describing structure also changed.

In version 1 it was:

```C
struct afb_binding_desc_v1
{
       const char *info;                       /* textual information about the binding */
       const char *prefix;                     /* required prefix name for the binding */
       const struct afb_verb_desc_v1 *verbs;   /* array of descriptions of verbs terminated by a NULL name */
};
```

In version 2 it becomes:

```C
struct afb_binding_v2
{
        const char *api;                        /* api name for the binding */
        const char *specification;              /* textual specification of the binding */
        const struct afb_verb_v2 *verbs;        /* array of descriptions of verbs terminated by a NULL name */
        int (*preinit)();                       /* callback at load of the binding */
        int (*init)();                          /* callback for starting the service */
        void (*onevent)(const char *event, struct json_object *object); /* callback for handling events */
        unsigned noconcurrency: 1;              /* avoids concurrent requests to verbs */
};
```

The migration of instances of that structure requires the following actions:

- declare, explore, name the structure as ```const struct afb_binding_v2 afbBindingV2```
- rename the field **prefix** to **api**
- remove the field **info**
- setup the fields **preinit**, **init**, **onevent** according to the next section
- set the field **noconcurrency** to the right value:
  - to 1 if you want to avoid concurrent calls to verbs.
  - to 0 if you allow concurrent calls to verbs.

Example:

```C
static const struct afb_binding plugin_desc = {
        .type = AFB_BINDING_VERSION_1,
        .v1 = {
                .info = "Minimal Hello World Sample",
                .prefix = "hello",
                .verbs = verbs
        }
```

Becomes:

```C
const struct afb_binding_v2 afbBindingV2 = {
        .api = "hello",
        .specification = NULL,
        .verbs = verbs,
        .preinit = preinit,
        .init = init
};
```

The **binder** now relies only on the exported names
to deduce the type of the binding.  
This make the main structure more simple.

Adapt the init and callback functions
-------------------------------------

The ***bindings*** version 1 defined 3 exported functions:

- **afbBindingV1Register**
- **afbBindingV1ServiceInit**
- **afbBindingV1ServiceEvent**

These function should not be exported any more and there definition changed.

The function **afbBindingV1Register** is no more used to describe the binding.  
When a binding has to take actions when it is loaded, it must set the field
**preinit** of the structure **afbBindingV2**.  
This field, this preinit, might be used to check features at load.  
When it returns a negative number, the ***binder*** stops before initializing any ***binding***.

The function **afbBindingV1ServiceInit** is replaced by the field **init**
of the structure **afbBindingV2**.  
The init function should return 0 in case of success or a negative error code
in case of problem.  
It is called during initialization of services.

The function **afbBindingV1ServiceEvent**is replaced by the field **onevent**
of the structure **afbBindingV2**.

The two functions **afbBindingV1Register** and **afbBindingV1ServiceInit**,
were taking as parameter the ***binder*** interface and the service interface respectively.  
These interfaces are now managed hiddenly for the **binding** by the **binder**.  
So the variable that ***bindings*** version used to store the ***binder*** interface
and the service interface are no more needed and can be removed.

Example:

```C
const struct afb_binding_interface *interface;
struct afb_service service;

static const struct afb_binding plugin_desc = {
        .type = AFB_BINDING_VERSION_1,
        .v1 = {
                .info = "Minimal Hello World Sample",
                .prefix = "hello",
                .verbs = verbs
        }
}

const struct afb_binding *afbBindingV1Register (const struct afb_binding_interface *itf)
{
        interface = itf;
        NOTICE(interface, "binding register");
        return &plugin_desc;
}

int afbBindingV1ServiceInit(struct afb_service svc)
{
        service = svc;
        NOTICE(interface, "binding init");
        return 0;
}

void afbBindingV1ServiceEvent(const char *event, struct json_object *object)
{
        NOTICE(interface, "onevent %s", event);
}
```

Becomes:

```C
static int preinit()
{
        AFB_NOTICE("binding preinit (was register)");
        return 0;
}

static int init()
{
        AFB_NOTICE("binding init");
        return 0;
}

static void onevent(const char *event, struct json_object *object)
{
        AFB_NOTICE("onevent %s", event);
}

const struct afb_binding_v2 afbBindingV2 = {
        .api = "hello",
        .specification = NULL,
        .verbs = verbs,
        .preinit = preinit,
        .init = init,
        .onevent = onevent
};
```

The two functions **afbBindingV1Register** and **afbBindingV1ServiceInit**,
were taking as parameter the ***binder*** interface and the service interface respectively.  
These interfaces are now managed hiddenly for the **binding** by the **binder**.  
So the variable that ***bindings*** version used to store the ***binder*** interface
and the service interface are no more needed and can be removed.

On the above example the following lines were removed:

```C
const struct afb_binding_interface *interface;
struct afb_service service;

        interface = itf;

        service = svc;
```

Removes the first parameter of functions of classes **daemon** and **service**
------------------------------------------------------------------------------

As explained before, many functions loose there first
arguments, this are the functions of the following classes:

- functions of class **daemon**:
  - functions starting with **afb_daemon_...**
  - functions for logging: **ERROR**, **WARNING**, **NOTICE**, **INFO**, **DEBUG**
- functions of class **service**:
  - functions starting with **afb_service_...**
- callback functions:
  - the register function (that is removed)
  - the service init function
  - the onevent function

For these functions, the first parameter is now implicit.

Example:

```C
        afb_daemon_broadcast_event(afbitf->daemon, reason, description);
```

Becomes:

```C
        afb_daemon_broadcast_event(reason, description);
```

Also, to avoid possible conflicts, we introduced prefixed logging functions:  
the macros 

- **ERROR**
- **WARNING**
- **NOTICE**
- **INFO**
- **DEBUG** 

have now a prefixed version: 

- **AFB\_ERROR**
- **AFB\_WARNING**
- **AFB\_NOTICE**
- **AFB\_INFO**
- **AFB\_DEBUG**

It is now recommended to use the prefixed version.

Example:

```C
        NOTICE(interface, "hello plugin comes to live");
```

Become:

```C
        NOTICE("hello plugin comes to live");
```

or, better:

```C
        AFB_NOTICE("hello plugin comes to live");
```

To remove definition of the un-prefixed versions of logging macros:

- **ERROR**
- **WARNING**
- **NOTICE**
- **INFO**
- **DEBUG** 

and just define 

- **AFB_BINDING_PRAGMA_NO_VERBOSE_UNPREFIX**

before to include **afb/afb-binding.h**.

```C
#define AFB_BINDING_PRAGMA_NO_VERBOSE_UNPREFIX
#define AFB_BINDING_VERSION 2
#include <afb/afb-binding.h>
```

Consider where to emit logs for requests
----------------------------------------

The ***bindings*** v2 now allows to emit log messages associated to ***requests***.  
This feature is valuable when debugging because it allows to return
side information associated to a ***request***.

The defined macros for logging to requests are: 

- **AFB_REQ_ERROR**
- **AFB_REQ_WARNING**
- **AFB_REQ_NOTICE**
- **AFB_REQ_INFO**
- **AFB_REQ_DEBUG**

We encourage the use of these new logging facilities everywhere it makes sense.

Example:

```C
        INFO(afbitf, "method 'new' called for boardid %d", board->id);
```

Might become:

```C
        AFB_REQ_INFO(req, "method 'new' called for boardid %d", board->id);
```

Take care of store/unstore change
---------------------------------

For efficiency, the version 2 redefined how storing/un-storing of
requests works.  
Storing request is needed for asynchronous handling of requests.

For ***bindings*** version, the signature of the functions were:

```C
struct afb_req *afb_req_store(struct afb_req req);
struct afb_req afb_req_unstore(struct afb_req *req);
```

For version 2 it becomes

```C
struct afb_stored_req *afb_req_store(struct afb_req req);
struct afb_req afb_req_unstore(struct afb_stored_req *sreq);
```

Where the structure ```struct afb_stored_req``` is opaque.

It should require few code change.

Also check the following chapter that explain that asynchronous (sub)calls
can be replaced by synchronous one, avoiding the need to store/unstore
requests.

Consider use of synchronous (sub)call requests
----------------------------------------------

***Bindings*** can emit requests for themselves (calls) or for
their clients (subcalls).  
With ***bindings*** version 2 comes also synchronous requests for both cases.

So when migrating to bindings version 2, a developer can consider
to replace the asynchronous requests (with asynchronous call back)
by synchronous ones.

See functions ***afb_service_call_sync*** and ***afb_req_subcall_sync***.

Optionally, removes explicit struct
-----------------------------------

The new definitions now includes **typedefs** for common
structures, as shown on below sample:

```C
typedef struct afb_daemon               afb_daemon;
typedef struct afb_event                afb_event;
typedef struct afb_arg                  afb_arg;
typedef struct afb_req                  afb_req;
typedef struct afb_service              afb_service;
```

So you can remove the keyword **struct** if it bores you.

Example:

```C
static void verb(struct afb_req req)
{
        ...
}
```

Might become:

```C
static void verb(afb_req req)
{
        ...
}
```

Example of migration
--------------------

The first ***binding*** that migrated from v1 to v2 was the sample **HelloWorld**.  
Here is shown the differences between the version 1 and the version 2.

```diff
diff --git a/bindings/samples/HelloWorld.c b/bindings/samples/HelloWorld.c
index c6fa779..505aee3 100644
--- a/bindings/samples/HelloWorld.c
+++ b/bindings/samples/HelloWorld.c
@@ -21,9 +21,9 @@

 #include <json-c/json.h>

+#define AFB_BINDING_VERSION 2
 #include <afb/afb-binding.h>

-const struct afb_binding_interface *interface;
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;

 struct event
@@ -79,7 +80,7 @@ static int event_add(const char *tag, const char *name)
         strcpy(e->tag, tag);

         /* make the event */
-    e->event = afb_daemon_make_event(interface->daemon, name);
+    e->event = afb_daemon_make_event(name);
         if (!e->event.closure) { free(e); return -1; }

         /* link */
@@ -140,7 +141,7 @@ static void pingBug (struct afb_req request)
 static void pingEvent(struct afb_req request)
 {
         json_object *query = afb_req_json(request);
-    afb_daemon_broadcast_event(interface->daemon, "event", json_object_get(query));
+    afb_daemon_broadcast_event("event", json_object_get(query));
         ping(request, json_object_get(query), "event");
 }

@@ -288,38 +289,43 @@ static void exitnow (struct afb_req request)
         exit(0);
 }

+static int preinit()
+{
+    AFB_NOTICE("hello binding comes to live");
+    return 0;
+}
+
+static int init()
+{
+    AFB_NOTICE("hello binding starting");
+    return 0;
+}
+
 // NOTE: this sample does not use session to keep test a basic as possible
 //       in real application most APIs should be protected with AFB_SESSION_CHECK
-static const struct afb_verb_desc_v1 verbs[]= {
-  {"ping"     , AFB_SESSION_NONE, pingSample  , "Ping Application Framework"},
-  {"pingfail" , AFB_SESSION_NONE, pingFail    , "Fails"},
-  {"pingnull" , AFB_SESSION_NONE, pingNull    , "Return NULL"},
-  {"pingbug"  , AFB_SESSION_NONE, pingBug     , "Do a Memory Violation"},
-  {"pingJson" , AFB_SESSION_NONE, pingJson    , "Return a JSON object"},
-  {"pingevent", AFB_SESSION_NONE, pingEvent   , "Send an event"},
-  {"subcall",   AFB_SESSION_NONE, subcall     , "Call api/verb(args)"},
-  {"subcallsync",   AFB_SESSION_NONE, subcallsync     , "Call api/verb(args)"},
-  {"eventadd",  AFB_SESSION_NONE, eventadd    , "adds the event of 'name' for the 'tag'"},
-  {"eventdel",  AFB_SESSION_NONE, eventdel    , "deletes the event of 'tag'"},
-  {"eventsub",  AFB_SESSION_NONE, eventsub    , "subscribes to the event of 'tag'"},
-  {"eventunsub",AFB_SESSION_NONE, eventunsub  , "unsubscribes to the event of 'tag'"},
-  {"eventpush", AFB_SESSION_NONE, eventpush   , "pushs the event of 'tag' with the 'data'"},
-  {"exit",      AFB_SESSION_NONE, exitnow     , "exits from afb-daemon"},
-  {NULL}
+static const struct afb_verb_v2 verbs[]= {
+  { "ping"     ,    pingSample , NULL, AFB_SESSION_NONE },
+  { "pingfail" ,    pingFail   , NULL, AFB_SESSION_NONE },
+  { "pingnull" ,    pingNull   , NULL, AFB_SESSION_NONE },
+  { "pingbug"  ,    pingBug    , NULL, AFB_SESSION_NONE },
+  { "pingJson" ,    pingJson   , NULL, AFB_SESSION_NONE },
+  { "pingevent",    pingEvent  , NULL, AFB_SESSION_NONE },
+  { "subcall",      subcall    , NULL, AFB_SESSION_NONE },
+  { "subcallsync",  subcallsync, NULL, AFB_SESSION_NONE },
+  { "eventadd",     eventadd   , NULL, AFB_SESSION_NONE },
+  { "eventdel",     eventdel   , NULL, AFB_SESSION_NONE },
+  { "eventsub",     eventsub   , NULL, AFB_SESSION_NONE },
+  { "eventunsub",   eventunsub , NULL, AFB_SESSION_NONE },
+  { "eventpush",    eventpush  , NULL, AFB_SESSION_NONE },
+  { "exit",         exitnow    , NULL, AFB_SESSION_NONE },
+  { NULL}
 };

-static const struct afb_binding plugin_desc = {
-    .type = AFB_BINDING_VERSION_1,
-    .v1 = {
-        .info = "Minimal Hello World Sample",
-        .prefix = "hello",
-        .verbs = verbs
-    }
+const struct afb_binding_v2 afbBindingV2 = {
+    .api = "hello",
+    .specification = NULL,
+    .verbs = verbs,
+    .preinit = preinit,
+    .init = init
 };

-const struct afb_binding *afbBindingV1Register (const struct afb_binding_interface *itf)
-{
-    interface = itf;
-    NOTICE(interface, "hello plugin comes to live");
-    return &plugin_desc;
-}
```