api.h 473 B

12345678910111213141516171819202122232425262728
  1. #ifndef _MQUEUE_EXT_API_H_
  2. #define _MQUEUE_EXT_API_H_
  3. typedef int (*mq_add_f)(str*, str*, str*);
  4. typedef struct mq_api {
  5. mq_add_f add;
  6. } mq_api_t;
  7. typedef int (*bind_mq_f)(mq_api_t* api);
  8. static inline int load_mq_api(mq_api_t *api)
  9. {
  10. bind_mq_f bindmq;
  11. bindmq = (bind_mq_f)find_export("bind_mq", 1, 0);
  12. if(bindmq == 0) {
  13. LM_ERR("cannot find bind_mq\n");
  14. return -1;
  15. }
  16. if(bindmq(api)<0)
  17. {
  18. LM_ERR("cannot bind mq api\n");
  19. return -1;
  20. }
  21. return 0;
  22. }
  23. #endif