Protection Functions and their Applications