Application of a Layered Hidden Markov Model in the Detection of Network Attacks