For the standard classes, you can use the tocloft package; using \cftaftertoctitle you can place some material (a rule and some vertical space, in this case) after the ToC title and before the entries; after the ToC is typeset a rule is inserted using \hrulefill:
\documentclass{book}
\usepackage{tocloft}
\renewcommand\cftaftertoctitle{\par\noindent\hrulefill\par\vskip-4.3em}
\begin{document}
\tableofcontents
\noindent\hrulefill
\chapter{Test Chapter One}
\section{Test Section One One}
\subsection{Test Subsection One One One}
\section{Test Section One Two}
\subsection{Test Subsection One Two One}
\chapter{Test Chapter Two}
\section{Test Section Two One}
\subsection{Test Subsection Two One One}
\section{Test Section Two Two}
\subsection{Test Subsection Two Two One}
\end{document}

Without additional packages, you can redefine the \tableofcontents command as implemented in the document class used. For example, using book, such a redefinition might look like this (the changes were marked with %NEW):
\documentclass{book}
\makeatletter
\renewcommand\tableofcontents{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\contentsname
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\par\noindent\hrulefill\par%NEW
\@starttoc{toc}%
\noindent\hrulefill%NEW
\if@restonecol\twocolumn\fi
}
\makeatother
\begin{document}
\tableofcontents
\chapter{Test Chapter One}
\section{Test Section One One}
\subsection{Test Subsection One One One}
\section{Test Section One Two}
\subsection{Test Subsection One Two One}
\chapter{Test Chapter Two}
\section{Test Section Two One}
\subsection{Test Subsection Two One One}
\section{Test Section Two Two}
\subsection{Test Subsection Two Two One}
\end{document}
The memoir document class offers you the built-in command \aftertoctitle to add material after the ToC title:
\documentclass{memoir}
\renewcommand\aftertoctitle{\par\noindent\hrulefill\par}
\begin{document}
\tableofcontents*
\noindent\hrulefill
\chapter{Test Chapter One}
\section{Test Section One One}
\subsection{Test Subsection One One One}
\section{Test Section One Two}
\subsection{Test Subsection One Two One}
\chapter{Test Chapter Two}
\section{Test Section Two One}
\subsection{Test Subsection Two One One}
\section{Test Section Two Two}
\subsection{Test Subsection Two Two One}
\end{document}