indexing description: "Represents a peer id" license: "MIT license (see ../license.txt)" author: "Beat Strasser " date: "$Date$" revision: "$Revision$" class P2P_PEER_ID inherit P2P_ID_UUID create make_from_urn, make, make_new_with_group feature {NONE} -- Initialization make (peer_uuid, group_uuid: like bytes) is -- Create peer with given `peer_uuid' in `group_uuid' group require Peer_uuid_valid: peer_uuid /= Void and peer_uuid.count = uuid_bytes_count Group_uuid_valid: group_uuid /= Void and group_uuid.count = uuid_bytes_count do initialize_bytes bytes.subcopy (group_uuid, 0, uuid_bytes_count - 1, peer_group_uuid_msb) bytes.subcopy (peer_uuid, 0, uuid_bytes_count - 1, peer_uuid_msb) build_uuidformat end make_new_with_group (group_uuid: like bytes) is -- Create new peer id in `group_uuid' group with new uuid require Group_uuid_valid: group_uuid /= Void and group_uuid.count = uuid_bytes_count do initialize_bytes bytes.subcopy (group_uuid, 0, uuid_bytes_count - 1, peer_group_uuid_msb) create_random_uuid (bytes, peer_uuid_msb) build_uuidformat end feature -- Access Flag_id_type: NATURAL_8 is 3 peer_group_id: P2P_PEERGROUP_UUID is -- Create peer group id do create Result.make_with_uuid (subbytes (peer_group_uuid_msb, peer_group_uuid_lsb)) end feature {NONE} -- Implementation Peer_group_uuid_msb: INTEGER is 0 Peer_group_uuid_lsb: INTEGER is 15 Peer_uuid_msb, Characteristic_uuid_msb: INTEGER is 16 Peer_uuid_lsb, Characteristic_uuid_lsb: INTEGER is 31 end