我们从Python开源项目中,提取了以下23个代码示例,用于说明如何使用utils.encode_name()。
def requestNMBSession(self): my_name_encoded = encode_name(self.my_name, TYPE_WORKSTATION) remote_name_encoded = encode_name(self.remote_name, self.host_type) self.sendNMBPacket(SESSION_REQUEST, remote_name_encoded + my_name_encoded) # # Protected Methods #
def prepareNameQuery(self, trn_id, name, is_broadcast = True): header = struct.pack(self.HEADER_STRUCT_FORMAT, trn_id, (is_broadcast and 0x0110) or 0x0100, 1, 0, 0, 0) payload = encode_name(name, 0x20) + '\x00\x20\x00\x01' return header + payload # # Contributed by Jason Anderson #
def prepareNetNameQuery(self, trn_id, is_broadcast = True): header = struct.pack(self.HEADER_STRUCT_FORMAT, trn_id, (is_broadcast and 0x0010) or 0x0000, 1, 0, 0, 0) payload = encode_name('*', 0) + '\x00\x21\x00\x01' return header + payload