We present a formal model of network protocols and their application to modeling firewall policies. The formalization is based on the \emph{Unified Policy Framework} (UPF)~\cite{brucker.ea:upf:2014}. The formalization was originally developed with for generating test cases (see~\cite{brucker.ea:formal-fw-testing:2014} for details) for testing the security configuration actual firewall and router (middle-boxes) using HOL-TestGen~\cite{brucker.ea:formal-fw-testing:2014}. Our work focuses on modeling application level protocols on top of tcp/ip. Thus, its abstraction level differs from Diekmann's Network Security Policy Verification formalization~\cite{Network_Security_Policy_Verification-AFP}.