MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / decodeResults

Method decodeResults

pager_lib/smb/base.py:525–553  ·  view source on GitHub ↗
(tid, fid, data_bytes)

Source from the content-addressed store, hash-verified

523 errback(OperationFailure('Failed to list shares: Unable to retrieve shared device list', messages_history))
524
525 def decodeResults(tid, fid, data_bytes):
526 shares_count = struct.unpack('<I', data_bytes[36:40])[0]
527 results = [ ] # A list of SharedDevice instances
528 offset = 36 + 12 # You need to study the byte stream to understand the meaning of these constants
529 for i in range(0, shares_count):
530 results.append(SharedDevice(struct.unpack('<I', data_bytes[offset+4:offset+8])[0], None, None))
531 offset += 12
532
533 for i in range(0, shares_count):
534 max_length, _, length = struct.unpack('<III', data_bytes[offset:offset+12])
535 offset += 12
536 results[i].name = DataFaultToleranceStrategy.data_bytes_decode(data_bytes[offset:offset+length*2-2])
537
538 if length % 2 != 0:
539 offset += (length * 2 + 2)
540 else:
541 offset += (length * 2)
542
543 max_length, _, length = struct.unpack('<III', data_bytes[offset:offset+12])
544 offset += 12
545 results[i].comments = DataFaultToleranceStrategy.data_bytes_decode(data_bytes[offset:offset+length*2-2])
546
547 if length % 2 != 0:
548 offset += (length * 2 + 2)
549 else:
550 offset += (length * 2)
551
552 closeFid(tid, fid)
553 callback(results)
554
555 def sendReadRequest(tid, fid, data_bytes):
556 read_count = min(4280, self.max_read_size)

Callers

nothing calls this directly

Calls 5

rangeFunction · 0.85
SharedDeviceClass · 0.85
appendMethod · 0.80
callbackFunction · 0.50
data_bytes_decodeMethod · 0.45

Tested by

no test coverage detected