| 270 | |
| 271 | |
| 272 | class GuidEntityPrinter(GuidPrinterBase): |
| 273 | |
| 274 | def __init__(self, value=None, entity_key=None, entity_kind=None): |
| 275 | if value is not None: |
| 276 | self.entity_key = get_byte_array(value['entityKey']) |
| 277 | self.entity_kind = int(value['entityKind']) |
| 278 | else: |
| 279 | self.entity_key = entity_key |
| 280 | self.entity_kind = entity_kind |
| 281 | GuidPrinterBase.__init__(self, self.entity_key + (self.entity_kind,)) |
| 282 | |
| 283 | builtins = { |
| 284 | (0x00, 0x00, 0x02): 'SEDP topic', |
| 285 | (0x00, 0x00, 0x03): 'SEDP publications', |
| 286 | (0xff, 0x00, 0x03): 'secure SEDP publications', |
| 287 | (0x00, 0x00, 0x04): 'SEDP subscriptions', |
| 288 | (0xff, 0x00, 0x04): 'secure SEDP subscriptions', |
| 289 | (0x00, 0x01, 0x00): 'SPDP participant', |
| 290 | (0xff, 0x01, 0x01): 'secure SPDP reliable participant', |
| 291 | (0x00, 0x02, 0x00): 'P2P participant message', |
| 292 | (0xff, 0x02, 0x00): 'secure P2P participant message', |
| 293 | (0x00, 0x02, 0x01): 'P2P participant stateless', |
| 294 | (0xff, 0x02, 0x02): 'secure P2P participant volatile message', |
| 295 | (0x00, 0x03, 0x00): 'type lookup request', |
| 296 | (0xff, 0x03, 0x00): 'secure type lookup request', |
| 297 | (0x00, 0x03, 0x01): 'type lookup reply', |
| 298 | (0xff, 0x03, 0x01): 'secure type lookup reply', |
| 299 | } |
| 300 | |
| 301 | kinds = { |
| 302 | 0xc0: 'builtin unknown', |
| 303 | 0xc1: 'participant', |
| 304 | 0xc2: 'writer', # (builtin keyed writer) |
| 305 | 0xc3: 'writer', # (builtin unkeyed writer) |
| 306 | 0xc4: 'reader', # (builtin unkeyed reader) |
| 307 | 0xc7: 'reader', # (builtin keyed reader) |
| 308 | 0xc5: 'builtin topic', |
| 309 | 0x00: 'user unknown', |
| 310 | 0x02: 'keyed writer', |
| 311 | 0x03: 'unkeyed writer', |
| 312 | 0x04: 'unkeyed reader', |
| 313 | 0x07: 'keyed reader', |
| 314 | 0x41: 'OpenDDS subscriber', |
| 315 | 0x42: 'OpenDDS publisher', |
| 316 | 0x45: 'OpenDDS topic', |
| 317 | 0x4a: 'OpenDDS user', |
| 318 | } |
| 319 | |
| 320 | def builtin(self): |
| 321 | return self.entity_kind >> 4 == 0xc |
| 322 | |
| 323 | def hint(self): |
| 324 | if self.unknown(): |
| 325 | return 'unknown entity' |
| 326 | hint = self.kinds.get(self.entity_kind, 'unrecognized kind') |
| 327 | if self.builtin() and self.entity_kind != 0xc1: |
| 328 | hint = self.builtins.get(self.entity_key, 'unrecognized builtin') + ' ' + hint |
| 329 | return hint |