plugin.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // plugin.h :
  2. //
  3. #if !defined(AGD_PLUGIN_H__98AA983E_C855_424B_ADEE_D6A881108474__INCLUDED_)
  4. #define AGD_PLUGIN_H__98AA983E_C855_424B_ADEE_D6A881108474__INCLUDED_
  5. #include <stdint.h>
  6. #include <stdbool.h>
  7. #include <gfa/gfaipc.h>
  8. #ifndef _LIBBUILD
  9. #include <gfa/svc/common/uuid.h>
  10. #else // _LIBBUILD
  11. #include "common/uuid.h"
  12. #endif // _LIBBUILD
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif // __cplusplus
  16. #include <ulfius.h>
  17. /////////////////////////////////////////////////////////////////////////////
  18. // plugin.h - Declarations:
  19. typedef struct _REST_REQUEST_HANDLER
  20. {
  21. const char *pszHandlerName;
  22. const char *pszHttpMethod;
  23. const char *pszVirtPath;
  24. const char *pszContentType;
  25. const char *pszFunctionName;
  26. }REST_REQUEST_HANDLER, *PREST_REQUEST_HANDLER;
  27. typedef const REST_REQUEST_HANDLER *PCREST_REQUEST_HANDLER;
  28. typedef struct _REST_PLUGIN_INFO
  29. {
  30. uuid_t signature; // must be {0x75ed2211, 0x0a25, 0x4a55, 0x96, 0x2b, 0x31, 0xd3, 0xb0, 0xe6, 0x12, 0x3a}
  31. const char *pszPluginName;
  32. size_t nHandlerCnt;
  33. REST_REQUEST_HANDLER handler[1];
  34. }REST_PLUGIN_INFO, *PREST_PLUGIN_INFO;
  35. typedef const REST_PLUGIN_INFO *PCREST_PLUGIN_INFO;
  36. /////////////////////////////////////////////////////////////////////////////
  37. typedef struct _REST_PLUGIN_REQUEST_CONTEXT
  38. {
  39. uuid_t uuidShm;
  40. HSHM hShm;
  41. void *pShm;
  42. void (*pfnLockSHM)(HSHM);
  43. void (*pfnUnlockSHM)(HSHM);
  44. }REST_PLUGIN_REQUEST_CONTEXT, *PREST_PLUGIN_REQUEST_CONTEXT;
  45. typedef const REST_PLUGIN_REQUEST_CONTEXT *PCREST_PLUGIN_REQUEST_CONTEXT;
  46. /////////////////////////////////////////////////////////////////////////////
  47. #define _HTTP_METHOD_GET "GET"
  48. #define _HTTP_METHOD_POST "POST"
  49. /////////////////////////////////////////////////////////////////////////////
  50. typedef PCREST_PLUGIN_INFO (*PFN_GETPLUGININFO)(void);
  51. /*
  52. Prototype example:
  53. extern "C" int PluginRequestHandler(const struct _u_request *pRequ, struct _u_response *pResp, PCREST_PLUGIN_REQUEST_CONTEXT prc)
  54. {
  55. ...
  56. ...
  57. return U_CALLBACK_CONTINUE;
  58. }
  59. */
  60. /////////////////////////////////////////////////////////////////////////////
  61. #ifdef __cplusplus
  62. }
  63. #endif // __cplusplus
  64. #endif // !defined(AGD_PLUGIN_H__98AA983E_C855_424B_ADEE_D6A881108474__INCLUDED_)