Principles of Selective Ion Transport in Channels and Pumps