xrp_report.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2018 Cadence Design Systems Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining
  5. * a copy of this software and associated documentation files (the
  6. * "Software"), to deal in the Software without restriction, including
  7. * without limitation the rights to use, copy, modify, merge, publish,
  8. * distribute, sublicense, and/or sell copies of the Software, and to
  9. * permit persons to whom the Software is furnished to do so, subject to
  10. * the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included
  13. * in all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  18. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  19. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  20. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  21. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. */
  23. #ifndef _XRP_REPORT_H
  24. #define _XRP_REPORT_H
  25. struct xrp_report_entry {
  26. struct xrp_report_entry * next;
  27. };
  28. struct xrp_report_item {
  29. struct xrp_report_entry entry;
  30. int report_id;
  31. void *buf;
  32. int size;
  33. void (*fn)( void *context,void * data);
  34. void * context;
  35. };
  36. struct xrp_report_list{
  37. struct {
  38. struct xrp_report_entry *head;
  39. } queue;
  40. };
  41. extern void xrp_process_report(struct xrp_report_list *list,void* data,unsigned int id);
  42. extern int xrp_add_report(struct xrp_report_list *list,
  43. struct xrp_report_item *item);
  44. extern int xrp_remove_report(struct xrp_report_list *list,int id);
  45. extern int xrp_alloc_report_id(struct xrp_report_list *list);
  46. extern struct xrp_report_item* xrp_get_report_entry(struct xrp_report_list *list,int id);
  47. #endif