HMS Glasgow used to salute the Country where she went with 21 guns, but only if she was sure that her salute could be returned by a ship or a fort, in this case the Brazilian ship Barroza. She also saluted the Admiral or any other high ranking officer present in harbour. This can be a very noisy arrival as every gun fired is returned. In this case: 34 guns were fired on each side.
The Admiral of the Fleet is to be saluted with 19 guns
The Admiral with 17 guns
The Vice-Admiral 15 guns
The Rear-Admiral 13 guns
The Commodore 11 guns.
If a member of the Royal family visits the ship she/he has to be saluted with 21 guns (Royal Salute), so does any Head of state visiting the ship.