Theory of guided electromagnetic waves