1 /** @file message_formats.h 2 * Message format structures. 3 */ 4 #ifndef RAZORBACK_MESSAGES_FORMATS_H 5 #define RAZORBACK_MESSAGES_FORMATS_H 6 7 #include <razorback/visibility.h> 8 #include <razorback/types.h> 9 10 /** Message header 11 */ 12 struct MessageHeader 13 { 14 char *sName; ///< Header name 15 char *sValue; ///< Header value 16 }; 17 18 struct Message 19 { 20 uint32_t type; ///< Message type 21 size_t length; ///< Message length 22 uint32_t version; ///< Message version 23 struct List *headers; ///< Message headers list 24 void *message; ///< Message structure 25 uint8_t *serialized; ///< Serialized message string 26 bool (*serialize)(struct Message *, int); ///< Pointer to message serialization function 27 bool (*deserialize)(struct Message *, int); ///< Pointer to message deserialization function 28 void (*destroy)(struct Message *); ///< Pointer to message destructor 29 }; 30 31 32 33 /** Command and Control Messages 34 * @{ 35 */ 36 37 38 /** Error Message 39 */ 40 struct MessageError 41 { 42 uint8_t *sMessage; ///< Error Message Text 43 }; 44 45 /** Hello Message 46 * This message is a broadcast message. 47 */ 48 struct MessageHello 49 { 50 uuid_t uuidNuggetType; ///< Nugget Type 51 uuid_t uuidApplicationType; ///< Type of nugget sending the hello. 52 uint8_t locality; ///< Nugget Locality 53 uint8_t priority; ///< Dispatcher priority 54 uint32_t flags; ///< Dispatcher flags 55 struct List *addressList; ///< Dispatcher address list. 56 uint8_t protocol; ///< Dispatcher transfer protocol. 57 uint16_t port; ///< Dispatcher transfer server port. 58 }; 59 60 /** Registration Request Message 61 * This message is a broadcase message. 62 */ 63 struct MessageRegistrationRequest 64 { 65 uuid_t uuidNuggetType; ///< Nugget Type 66 uuid_t uuidApplicationType; ///< Application Type 67 uint32_t iDataTypeCount; ///< Number of supported data types. 68 uuid_t *pDataTypeList; ///< Supported data type list. 69 }; 70 71 /** Configuration Update Message 72 */ 73 struct MessageConfigurationUpdate 74 { 75 struct List *ntlvTypes; ///< List of NTLV Type UUIDs 76 struct List *ntlvNames; ///< List of NTLV Name UUIDs 77 struct List *dataTypes; ///< List of data type UUIDs 78 }; 79 80 /** Configuration Update Success 81 */ 82 struct MessageConfigurationAck 83 { 84 uuid_t uuidNuggetType; ///< Nugget Type 85 uuid_t uuidApplicationType; ///< Type of nugget sending the config ack. 86 }; 87 88 /** Terminate Message 89 */ 90 struct MessageTerminate 91 { 92 uint8_t *sTerminateReason; ///< String with termination reason in. 93 }; 94 /// @} 95 // 96 // End of Command and Control Messages 97 98 /** Cache Control Messages 99 * @{ 100 */ 101 102 /** Glocal Cache Request Message 103 */ 104 struct MessageCacheReq 105 { 106 uuid_t uuidRequestor; ///< UUID of the nugget requesting the data. 107 struct BlockId *pId; ///< Data Block ID 108 }; 109 110 /** Global Cache Response Message 111 */ 112 struct MessageCacheResp 113 { 114 struct BlockId *pId; ///< Data Block ID 115 uint32_t iSfFlags; ///< Data block code 116 uint32_t iEntFlags; ///< Data block code 117 }; 118 119 120 /// @} 121 // End Cache Control Messages 122 123 /** Submission Messages 124 * @{ 125 */ 126 127 /** Block Submission Message 128 */ 129 struct MessageBlockSubmission 130 { 131 uint32_t iReason; ///< Submission Reason 132 struct Event *pEvent; ///< Event data 133 uint8_t storedLocality; ///< Locality the block was stored in. 134 }; 135 136 137 /** Judgment Submission Message 138 */ 139 struct MessageJudgmentSubmission 140 { 141 uint8_t iReason; ///< Alert, Error, Done, Log 142 struct Judgment *pJudgment; ///< Judgment data 143 }; 144 145 /** Log Submission Message 146 */ 147 struct MessageLogSubmission 148 { 149 uuid_t uuidNuggetId; ///< who wrote it 150 uint8_t iPriority; ///< Meh, Dodgy, YF, YRF 151 struct EventId *pEventId; ///< The event id. 152 uint8_t *sMessage; ///< The message. 153 }; 154 155 /** Inspection Submission Message 156 */ 157 struct MessageInspectionSubmission 158 { 159 uint32_t iReason; ///< Submisson Reason 160 struct Block *pBlock; ///< Datablock 161 struct EventId *eventId; ///< Triggering event id 162 struct List *pEventMetadata; ///< Event metadata list 163 uint32_t localityCount; ///< Number of localities the block is stored in 164 uint8_t *localityList; ///< Array of localities that block is stored in 165 }; 166 /// @} 167 // End Submission Messages 168 169 /** Output Messages 170 * @{ 171 */ 172 173 /** Primary Alert Message 174 */ 175 struct MessageAlertPrimary 176 { 177 struct Nugget *nugget; ///< Generating nugget 178 struct Block *block; ///< The block 179 struct Event *event; ///< The event 180 uint32_t gid; ///< Alert GID 181 uint32_t sid; ///< Alert SID 182 struct List *metadata; ///< Alert Metadata 183 uint8_t priority; ///< Alert Priority 184 char *message; ///< Alert message string 185 uint64_t seconds; ///< Timestamp (Seconds) 186 uint64_t nanosecs; ///< Timestamp (Nano Seconds) 187 uint32_t SF_Flags; ///< Current SF Flags 188 uint32_t Ent_Flags; ///< Current Enterprise Flags 189 uint32_t Old_SF_Flags; ///< Previous SF Flags 190 uint32_t Old_Ent_Flags; ///< Previous Enterprise Flags 191 }; 192 193 /** Primary Alert Message 194 */ 195 struct MessageAlertChild 196 { 197 struct Nugget *nugget; ///< Generating nugget 198 struct Block *block; ///< The block 199 struct Block *child; ///< The child block which caused this alert 200 uint64_t eventCount; ///< Number of events for this block 201 uint64_t parentCount; ///< Number of parents of this block 202 uint32_t SF_Flags; ///< Current SF Flags 203 uint32_t Ent_Flags; ///< Current Enterprise Flags 204 uint32_t Old_SF_Flags; ///< Previous SF Flags 205 uint32_t Old_Ent_Flags; ///< Previous Enterprise Flags 206 }; 207 208 /** Event Output 209 */ 210 struct MessageOutputEvent 211 { 212 struct Nugget *nugget; ///< Generating nugget 213 struct Event *event; ///< Event data 214 }; 215 216 /** Log Output 217 */ 218 struct MessageOutputLog 219 { 220 struct Nugget *nugget; ///< Generating nugget 221 char *message; ///< Log message 222 uint8_t priority; ///< Priority 223 struct Event *event; ///< Event data (optional: NULL if not present) 224 uint64_t seconds; ///< Timestamp (Seconds) 225 uint64_t nanosecs; ///< Timestamp (Nano Seconds) 226 }; 227 228 /** Inspection Output 229 */ 230 struct MessageOutputInspection 231 { 232 struct Nugget *nugget; ///< Generating nugget 233 uint64_t seconds; ///< Timestamp (Seconds) 234 uint64_t nanosecs; ///< Timestamp (Nano Seconds) 235 struct BlockId *blockId; ///< Block ID 236 uint8_t status; ///< Inspection Status 237 bool final; ///< Final inspection notice. 238 }; 239 240 241 #endif 242