Boundary functionals for Levy processes and their applications