mptag.hpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef _DEFTAG
  14. #define _DEFTAG
  15. #ifndef DEFTAG
  16. #define DEFTAG(t) t ,
  17. #define TAGENUM enum mptag_t { MPTAGbase = 100,
  18. #define TAGENUMEND MPTAGend };
  19. #define DEFSTDTAG(t,v) t = v,
  20. #endif
  21. TAGENUM
  22. DEFTAG ( MPTAG_DALI_LOCK_REQUEST )
  23. DEFTAG ( MPTAG_DALI_SESSION_REQUEST )
  24. DEFTAG ( MPTAG_DALI_COVEN_REQUEST )
  25. DEFTAG ( MPTAG_DALI_SUBSCRIPTION_REQUEST )
  26. DEFTAG ( MPTAG_DALI_SDS_REQUEST )
  27. DEFTAG ( MPTAG_RMT_SPAWN )
  28. DEFTAG ( MPTAG_JLOG_CHILD_TO_PARENT )
  29. DEFTAG ( MPTAG_JLOG_PARENT_TO_CHILD )
  30. DEFTAG ( MPTAG_JLOG_CONNECT_TO_PARENT )
  31. DEFTAG ( MPTAG_JLOG_CONNECT_TO_CHILD )
  32. DEFTAG ( MPTAG_DALI_SUBSCRIPTION_FULFILL )
  33. DEFTAG ( MPTAG_DALI_NAMED_QUEUE_REQUEST )
  34. DEFTAG ( MPTAG_FT_SLAVE )
  35. DEFTAG ( MPTAG_DALI_DIAGNOSTICS_REQUEST )
  36. DEFTAG ( MPTAG_TEST ) // for general use when testing
  37. DEFTAG ( MPTAG_DKC_SLAVE )
  38. DEFTAG ( MPTAG_ROXIE_PACKET )
  39. DEFTAG ( MPTAG_PACKET_STORE_REQUEST )
  40. DEFTAG ( MPTAG_DFS_REQUEST )
  41. DEFTAG ( MPTAG_SASHA_REQUEST )
  42. DEFTAG ( MPTAG_FILEVIEW )
  43. DEFTAG ( MPTAG_KEYDIFF )
  44. DEFTAG ( MPTAG_DALI_AUDIT_REQUEST )
  45. DEFTAG ( MPTAG_THORREGISTRATION )
  46. DEFTAG ( MPTAG_THOR )
  47. DEFTAG ( MPTAG_THORRESOURCELOCK )
  48. DEFTAG ( MPTAG_MPTX )
  49. DEFTAG ( MPTAG_THORWATCHDOG )
  50. DEFTAG ( MPTAG_BARRIER )
  51. // new static tags go above here
  52. // Ranges
  53. DEFSTDTAG ( MPTAG_THORGLOBAL_BASE, 0x10000 ) // only allocated in master
  54. //Internal from here on
  55. DEFSTDTAG ( TAG_NULL, (unsigned) -1 )
  56. DEFSTDTAG ( TAG_ALL, (unsigned) -2 )
  57. DEFSTDTAG ( TAG_CANCEL, (unsigned) -3 ) // internal use
  58. DEFSTDTAG ( TAG_SYS_MULTI, (unsigned) -4 )
  59. DEFSTDTAG ( TAG_SYS_PING, (unsigned) -5 )
  60. DEFSTDTAG ( TAG_SYS_PING_REPLY, (unsigned) -6 )
  61. DEFSTDTAG ( TAG_SYS_BCAST, (unsigned) -7 )
  62. DEFSTDTAG ( TAG_SYS_FORWARD, (unsigned) -8 )
  63. DEFSTDTAG ( TAG_SYS_PING_REPLY_ID, (unsigned) -9 )
  64. DEFSTDTAG ( TAG_REPLY_BASE,(unsigned) -1000) // internal use
  65. TAGENUMEND
  66. #endif
  67. // range counts
  68. #define MPTAG_THORPORT_COUNT 0x10000
  69. #define MPTAG_THORGLOBAL_COUNT 0x10000
  70. #ifndef MPTAG_HPP
  71. #define MPTAG_HPP
  72. #ifndef mp_decl
  73. #define mp_decl DECL_IMPORT
  74. #endif
  75. #include "jstring.hpp"
  76. // This is the system wide location for Message Passing Tags
  77. // All MP Tags should be added here in sequence and should not be deleted or reordered
  78. // (mark unwanted tags as legacy for (eventual) reuse)
  79. inline MemoryBuffer &serializeMPtag(MemoryBuffer &mb,mptag_t t) { return mb.append((int)t); }
  80. inline MemoryBuffer &deserializeMPtag(MemoryBuffer &mb,mptag_t &t) { int it; mb.read(it); t = (mptag_t)it; return mb; }
  81. interface IMPtagAllocator: extends IInterface
  82. {
  83. virtual mptag_t alloc()=0;
  84. virtual void release(mptag_t tag)=0;
  85. };
  86. extern mp_decl IMPtagAllocator *createMPtagRangeAllocator(mptag_t base,unsigned count);
  87. #endif