Bindings V2: Refactor session flags
[src/app-framework-binder.git] / include / afb / afb-binding-v2.h
index 19bff05..d869dc6 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <stdint.h>
 
+#include "afb-session-v2.h"
+
 struct afb_service;
 struct afb_daemon;
 struct afb_binding_v2;
@@ -43,7 +45,7 @@ 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 authorisation */
+       const struct afb_auth *auth;            /* required authorisation */
        uint32_t session;                       /* authorisation and session requirements of the verb */
 };
 
@@ -78,3 +80,33 @@ struct afb_binding_v2
 #  define AFB_DEBUG_V2(daemon,...)   do{if(afbBindingV2verbosity>=3)afb_daemon_verbose(daemon,7,NULL,0,__VA_ARGS__);}while(0)
 # endif
 #endif
+
+#if AFB_BINDING_VERSION == 2
+
+# define afb_binding           afb_binding_v2
+# define afb_binding_interface afb_binding_interface_v2
+
+# define AFB_SESSION_NONE      AFB_SESSION_NONE_V2
+# define AFB_SESSION_CLOSE     AFB_SESSION_CLOSE_V2
+# define AFB_SESSION_RENEW     AFB_SESSION_REFRESH_V2
+# define AFB_SESSION_REFRESH   AFB_SESSION_REFRESH_V2
+# define AFB_SESSION_CHECK     AFB_SESSION_CHECK_V2
+
+# define AFB_SESSION_LOA_MASK  AFB_SESSION_LOA_MASK_V2
+
+# define AFB_SESSION_LOA_0     AFB_SESSION_LOA_0_V2
+# define AFB_SESSION_LOA_1     AFB_SESSION_LOA_1_V2
+# define AFB_SESSION_LOA_2     AFB_SESSION_LOA_2_V2
+# define AFB_SESSION_LOA_3     AFB_SESSION_LOA_3_V2
+
+# if !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO)
+
+#  define ERROR                        AFB_ERROR_V2
+#  define WARNING              AFB_WARNING_V2
+#  define NOTICE               AFB_NOTICE_V2
+#  define INFO                 AFB_INFO_V2
+#  define DEBUG                        AFB_DEBUG_V2
+
+# endif
+
+#endif