RTI Connext Micro  Version 2.4.1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
rtps_rtps_impl.h
1 /*
2  * FILE: rtps_rtps_impl.h
3  *
4  * Copyright 2004-2014 Real-Time Innovations, Inc.
5  *
6  * No duplications, whole or partial, manual or electronic, may be made
7  * without express written permission. Any such copies, or
8  * revisions thereof, must display this notice unaltered.
9  * This code contains trade secrets of Real-Time Innovations, Inc.
10  *
11  * Modification History
12  * --------------------
13  * 09may2014,eh MICRO-261 (Verocel PR#1421): remove RTPS_SubmessageId_toString
14  * for Cert
15  * 22oct2008,rmw Added well-known ports
16  * 26jun2008,rmw Added new functions for RTPS 2.0 support
17  * 01dec2004,cc Created, based on Waveworks tree.
18  */
19 
20 #ifndef rtps_rtps_impl_h
21 #define rtps_rtps_impl_h
22 
23 
24 #ifndef reda_sequenceNumber_h
25 #include "reda/reda_sequenceNumber.h"
26 #endif
27 
28 /* -------------------------------------------------------------------------- */
29 /*ci \brief Returns true with equal GUIDs */
30 #define RTPS_Guid_equals(a, b) \
31  ((a)->prefix.hostId == (b)->prefix.hostId && \
32  (a)->prefix.appId == (b)->prefix.appId && \
33  (a)->prefix.instanceId == (b)->prefix.instanceId && \
34  (a)->objectId == (b)->objectId)
35 
36 /*ci \brief Returns true with equal GUID prefixes */
37 #define RTPS_Guid_prefix_equals(a, b) \
38 ((a)->prefix.hostId == (b)->prefix.hostId && \
39 (a)->prefix.appId == (b)->prefix.appId && \
40 (a)->prefix.instanceId == (b)->prefix.instanceId)
41 
42 /*ci \brief Returns true with equal GUID suffixes */
43 #define RTPS_Guid_suffix_equals(a, b) \
44 ((a)->objectId == (b)->objectId)
45 
46 /* --------------------------------------------------------- */
47 /*ci \brief Get major field of vendor ID */
48 #define RTPS_VendorId_getMajor(vendor) (*(vendor) >> 8)
49 
50 /*ci \brief Get minor field of vendor ID */
51 #define RTPS_VendorId_getMinor(vendor) (*(vendor) & 0x00ff)
52 
53 /* --------------------------------------------------------- */
54 /*ci \brief Get lead SN of bitmap */
55 #define RTPS_Bitmap_getLead(a) (&(a)->_lead)
56 
57 /*ci \brief Get bitCount of bitmap */
58 #define RTPS_Bitmap_getBitCount(a) (a)->_bitCount
59 
60 /*ci \brief Reset bitmap with specified lead SN and bitCount */
61 #define RTPS_Bitmap_resetMacro(a, seqNum, bitCount) \
62 { \
63  register int RTPS_Bitmap_g_resetI = 0; \
64  (a)->_lead = *(seqNum); \
65  (a)->_bitCount = (bitCount); \
66  for (RTPS_Bitmap_g_resetI=0; \
67  RTPS_Bitmap_g_resetI<RTPS_BITMAP_32BITS_ARRAY_SIZE_MAX; \
68  ++RTPS_Bitmap_g_resetI) { \
69  (a)->_32bits[RTPS_Bitmap_g_resetI] = 0; \
70  } \
71 }
72 
73 /*ci \brief Macroize non-debug bitmap reset operation */
74 #ifndef RTI_PRECONDITION_TEST
75 #define RTPS_Bitmap_reset RTPS_Bitmap_resetMacro
76 #endif
77 
78 /* -------------------------------------------------------------------------- */
79 /*ci \brief Return RTPS spec multicast port: PB + DG*domainId + dX */
80 #define RTPS_getWellKnownMulticastPort(domain_id, port_base, domain_id_gain, port_offset) \
81  (port_base + (domain_id_gain*domain_id) + port_offset)
82 
83 /*ci \brief Return RTPS spec unicast port: PB + DG*domainId + PG*participantId + dX */
84 #define RTPS_getWellKnownUnicastPort(domain_id, participant_id, port_base, domain_id_gain, participant_id_gain, port_offset) \
85  (port_base + (domain_id_gain*domain_id) + (participant_id_gain*participant_id) + port_offset)
86 
87 /* -------------------------------------------------------------------------- */
88 /*ci \brief Deserialize epoch of HEARTBEAT or ACKNACK from stream buffer */
89 #define RTPS_Epoch_deserialize(me, streamPtr, needByteSwap) \
90  ( \
91  needByteSwap ? ( \
92  *(((char *)(me)) + 3) = *((*(streamPtr))++), \
93  *(((char *)(me)) + 2) = *((*(streamPtr))++), \
94  *(((char *)(me)) + 1) = *((*(streamPtr))++), \
95  *(((char *)(me)) ) = *((*(streamPtr))++), \
96  RTI_TRUE \
97  ) : ( \
98  *(me) = *((REDA_Epoch_T*)(*(streamPtr))), *(streamPtr) += 4, \
99  RTI_TRUE \
100  ) \
101  )
102 
103 /*ci \brief Deserialize sequence number from stream buffer */
104 #define RTPS_SequenceNumber_deserialize(__buf,__inst,_b) \
105  CDR_deserialize_Long(__buf, (RTI_UINT32*)&(__inst)->high, _b); \
106  CDR_deserialize_UnsignedLong(__buf, (RTI_UINT32*)&(__inst)->low, _b)
107 
108 /*ci \brief Serialized size of 2 octets */
109 #define RTPS_get2OctetsMaxSizeSerialized(size_) (2)
110 
111 #endif /* rtps_rtps_impl_h */

RTI Connext Micro Version 2.4.1.0 Copyright © Thu Nov 20 2014 Real-Time Innovations, Inc