X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=include%2Fafb%2Fafb-binding-v1.h;h=a36d5e3556f90047ec04cc2fc97b1e28732a49f6;hb=ec0a2d0f6b22750931fddfd6511219bcccd3c4f9;hp=dc7af6f59120a61792bc97296ff69b5b744d1291;hpb=4be084408c6d3d7b7f90a2493829c8ce0cebb397;p=src%2Fapp-framework-binder.git diff --git a/include/afb/afb-binding-v1.h b/include/afb/afb-binding-v1.h index dc7af6f5..a36d5e35 100644 --- a/include/afb/afb-binding-v1.h +++ b/include/afb/afb-binding-v1.h @@ -18,7 +18,16 @@ #pragma once struct json_object; -struct afb_service; + +#include "afb-req-itf.h" +#include "afb-event-itf.h" +#include "afb-service-common.h" +#include "afb-daemon-common.h" + +#include "afb-session-v1.h" +#include "afb-service-v1.h" +#include "afb-daemon-v1.h" + struct afb_binding_v1; struct afb_binding_interface_v1; @@ -41,7 +50,7 @@ struct afb_binding_interface_v1; * Be aware that the given 'interface' is not fully functionnal * because no provision is given to the name and description * of the binding. Check the function 'afbBindingV1ServiceInit' - * defined in the file because when + * defined in the file because when * the function 'afbBindingV1ServiceInit' is called, the 'interface' * is fully functionnal. */ @@ -79,7 +88,7 @@ extern void afbBindingV1ServiceEvent(const char *event, struct json_object *obje struct afb_verb_desc_v1 { const char *name; /* name of the verb */ - enum afb_session_flags session; /* authorisation and session requirements of the verb */ + enum afb_session_flags_v1 session; /* authorisation 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 */ }; @@ -117,7 +126,8 @@ struct afb_binding_v1 /* * config mode */ -enum afb_mode_v1 { +enum afb_mode_v1 +{ AFB_MODE_LOCAL = 0, /* run locally */ AFB_MODE_REMOTE, /* run remotely */ AFB_MODE_GLOBAL /* run either remotely or locally (DONT USE! reserved for future) */ @@ -138,18 +148,38 @@ struct afb_binding_interface_v1 */ #if !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO) # if !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_DETAILS) -# define AFB_ERROR_V1(itf,...) do{if(itf->verbosity>=0)afb_daemon_verbose(itf->daemon,3,__FILE__,__LINE__,__VA_ARGS__);}while(0) -# define AFB_WARNING_V1(itf,...) do{if(itf->verbosity>=1)afb_daemon_verbose(itf->daemon,4,__FILE__,__LINE__,__VA_ARGS__);}while(0) -# define AFB_NOTICE_V1(itf,...) do{if(itf->verbosity>=1)afb_daemon_verbose(itf->daemon,5,__FILE__,__LINE__,__VA_ARGS__);}while(0) -# define AFB_INFO_V1(itf,...) do{if(itf->verbosity>=2)afb_daemon_verbose(itf->daemon,6,__FILE__,__LINE__,__VA_ARGS__);}while(0) -# define AFB_DEBUG_V1(itf,...) do{if(itf->verbosity>=3)afb_daemon_verbose(itf->daemon,7,__FILE__,__LINE__,__VA_ARGS__);}while(0) +# define _AFB_LOGGING_V1_(itf,vlevel,llevel,...) \ + do{ \ + if(itf->verbosity>=vlevel) \ + afb_daemon_verbose2_v1(itf->daemon,llevel,__FILE__,__LINE__,__func__,__VA_ARGS__); \ + }while(0) +# define _AFB_REQ_LOGGING_V1_(itf,vlevel,llevel,req,...) \ + do{ \ + if(itf->verbosity>=vlevel) \ + afb_req_verbose(req,llevel,__FILE__,__LINE__,__func__,__VA_ARGS__); \ + }while(0) # else -# define AFB_ERROR_V1(itf,...) do{if(itf->verbosity>=0)afb_daemon_verbose(itf->daemon,3,NULL,0,__VA_ARGS__);}while(0) -# define AFB_WARNING_V1(itf,...) do{if(itf->verbosity>=1)afb_daemon_verbose(itf->daemon,4,NULL,0,__VA_ARGS__);}while(0) -# define AFB_NOTICE_V1(itf,...) do{if(itf->verbosity>=1)afb_daemon_verbose(itf->daemon,5,NULL,0,__VA_ARGS__);}while(0) -# define AFB_INFO_V1(itf,...) do{if(itf->verbosity>=2)afb_daemon_verbose(itf->daemon,6,NULL,0,__VA_ARGS__);}while(0) -# define AFB_DEBUG_V1(itf,...) do{if(itf->verbosity>=3)afb_daemon_verbose(itf->daemon,7,NULL,0,__VA_ARGS__);}while(0) +# define _AFB_LOGGING_V1_(itf,vlevel,llevel,...) \ + do{ \ + if(itf->verbosity>=vlevel) \ + afb_daemon_verbose_v1(itf->daemon,llevel,NULL,0,NULL,__VA_ARGS__); \ + }while(0) +# define _AFB_REQ_LOGGING_V1_(itf,vlevel,llevel,req,...) \ + do{ \ + if(itf->verbosity>=vlevel) \ + afb_req_verbose(req,llevel,NULL,0,NULL,__VA_ARGS__); \ + }while(0) # endif +# define AFB_ERROR_V1(itf,...) _AFB_LOGGING_V1_(itf,0,3,__VA_ARGS__) +# define AFB_WARNING_V1(itf,...) _AFB_LOGGING_V1_(itf,1,4,__VA_ARGS__) +# define AFB_NOTICE_V1(itf,...) _AFB_LOGGING_V1_(itf,1,5,__VA_ARGS__) +# define AFB_INFO_V1(itf,...) _AFB_LOGGING_V1_(itf,2,6,__VA_ARGS__) +# define AFB_DEBUG_V1(itf,...) _AFB_LOGGING_V1_(itf,3,7,__VA_ARGS__) +# define AFB_REQ_ERROR_V1(itf,...) _AFB_REQ_LOGGING_V1_(itf,0,3,__VA_ARGS__) +# define AFB_REQ_WARNING_V1(itf,...) _AFB_REQ_LOGGING_V1_(itf,1,4,__VA_ARGS__) +# define AFB_REQ_NOTICE_V1(itf,...) _AFB_REQ_LOGGING_V1_(itf,1,5,__VA_ARGS__) +# define AFB_REQ_INFO_V1(itf,...) _AFB_REQ_LOGGING_V1_(itf,2,6,__VA_ARGS__) +# define AFB_REQ_DEBUG_V1(itf,...) _AFB_REQ_LOGGING_V1_(itf,3,7,__VA_ARGS__) #endif