\hypertarget{classVarRW}{
\section{VarRW Class Reference}
\label{classVarRW}\index{VarRW@{VarRW}}
}


Interface used by policy filters to execute a policy on a route.  




{\ttfamily \#include $<$varrw.hh$>$}

Inheritance diagram for VarRW:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.077922cm]{classVarRW}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
enum \{ \par
{\bfseries VAR\_\-TRACE} =  0, 
{\bfseries VAR\_\-POLICYTAGS}, 
{\bfseries VAR\_\-FILTER\_\-IM}, 
{\bfseries VAR\_\-FILTER\_\-SM}, 
\par
{\bfseries VAR\_\-FILTER\_\-EX}, 
{\bfseries VAR\_\-TAG} =  5, 
{\bfseries VAR\_\-PROTOCOL} =  10, 
{\bfseries VAR\_\-MAX} =  32
 \}
\item 
\hypertarget{classVarRW_a73b6d07d0921ca2ea76c782c367ec582}{
typedef int {\bfseries Id}}
\label{classVarRW_a73b6d07d0921ca2ea76c782c367ec582}

\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
virtual const \hyperlink{classElement}{Element} \& \hyperlink{classVarRW_acb944450b84b487faeb1cbde243f76f4}{read} (const Id \&id)=0
\begin{DoxyCompactList}\small\item\em Read a variable from a route \mbox{[}such as nexthop\mbox{]}. \item\end{DoxyCompactList}\item 
virtual void \hyperlink{classVarRW_ad7447615a7d30de4c5ad847d1f885f25}{write} (const Id \&id, const \hyperlink{classElement}{Element} \&e)=0
\begin{DoxyCompactList}\small\item\em Write a variable to a route. \item\end{DoxyCompactList}\item 
virtual void \hyperlink{classVarRW_a6ae2005b7cb7ca447185c36329bb2a14}{sync} ()
\begin{DoxyCompactList}\small\item\em \hyperlink{classVarRW}{VarRW} must perform all pending writes to \hyperlink{protocolthe-p}{the} route now. \item\end{DoxyCompactList}\item 
\hypertarget{classVarRW_aa00f92fbf528028771aec8a464d2bb22}{
void \hyperlink{classVarRW_aa00f92fbf528028771aec8a464d2bb22}{enable\_\-trace} (bool on)}
\label{classVarRW_aa00f92fbf528028771aec8a464d2bb22}

\begin{DoxyCompactList}\small\item\em Enable/disable generating trace strings / output. \item\end{DoxyCompactList}\item 
const \hyperlink{classElement}{Element} \& \hyperlink{classVarRW_a7b297475236736691ec77c1f4ef325c4}{read\_\-trace} (const Id \&id)
\begin{DoxyCompactList}\small\item\em Support for tracing reads. \item\end{DoxyCompactList}\item 
void \hyperlink{classVarRW_a6396b9f0bffd01ee187aa827d142b3bf}{write\_\-trace} (const Id \&id, const \hyperlink{classElement}{Element} \&e)
\begin{DoxyCompactList}\small\item\em Support for tracing writes. \item\end{DoxyCompactList}\item 
uint32\_\-t \hyperlink{classVarRW_a8f03ed97ac2c405c4ac912cc3d07f64e}{trace} ()
\begin{DoxyCompactList}\small\item\em Obtain \hyperlink{protocolthe-p}{the} final trace value. \item\end{DoxyCompactList}\item 
string \hyperlink{classVarRW_aef32228d742c99a1976fd8591f818bb1}{tracelog} ()
\begin{DoxyCompactList}\small\item\em Obtain \hyperlink{protocolthe-p}{the} actual trace from \hyperlink{protocolthe-p}{the} varrw. \item\end{DoxyCompactList}\item 
virtual string \hyperlink{classVarRW_ad65516d63a33e2cd09fd1dedb562ca2d}{more\_\-tracelog} ()
\begin{DoxyCompactList}\small\item\em Obtain any \hyperlink{classVarRW}{VarRW} specific traces. \item\end{DoxyCompactList}\item 
\hypertarget{classVarRW_a71ba7dd0fd7ecebb11cf72fe3efe2fa1}{
void {\bfseries reset\_\-trace} ()}
\label{classVarRW_a71ba7dd0fd7ecebb11cf72fe3efe2fa1}

\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classVarRW_a394ea870c421494ba651282c4265b21a}{
bool {\bfseries \_\-do\_\-trace}}
\label{classVarRW_a394ea870c421494ba651282c4265b21a}

\item 
\hypertarget{classVarRW_a79210becdbf8e212f11a82c9441d2e02}{
uint32\_\-t {\bfseries \_\-trace}}
\label{classVarRW_a79210becdbf8e212f11a82c9441d2e02}

\item 
\hypertarget{classVarRW_abd93ded77a5b9447d7f1bd29c18f3310}{
ostringstream {\bfseries \_\-tracelog}}
\label{classVarRW_abd93ded77a5b9447d7f1bd29c18f3310}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
Interface used by policy filters to execute a policy on a route. It deals with reading and writing field/variables/attributes of a route \mbox{[}such as nexthop, metric and so on\mbox{]}.

A routing protocol must implement this interface in order to support policy filtering. 

\subsection{Member Function Documentation}
\hypertarget{classVarRW_ad65516d63a33e2cd09fd1dedb562ca2d}{
\index{VarRW@{VarRW}!more\_\-tracelog@{more\_\-tracelog}}
\index{more\_\-tracelog@{more\_\-tracelog}!VarRW@{VarRW}}
\subsubsection[{more\_\-tracelog}]{\setlength{\rightskip}{0pt plus 5cm}string VarRW::more\_\-tracelog (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classVarRW_ad65516d63a33e2cd09fd1dedb562ca2d}


Obtain any \hyperlink{classVarRW}{VarRW} specific traces. 

\begin{DoxyReturn}{Returns}
string representation of specific \hyperlink{classVarRW}{VarRW} traces. 
\end{DoxyReturn}


Reimplemented in \hyperlink{classBGPVarRW_a71e23403bffb96b011a1e49890e3dbda}{BGPVarRW$<$ A $>$}, and \hyperlink{classBGPVarRW_a71e23403bffb96b011a1e49890e3dbda}{BGPVarRW$<$ IPv4 $>$}.

\hypertarget{classVarRW_acb944450b84b487faeb1cbde243f76f4}{
\index{VarRW@{VarRW}!read@{read}}
\index{read@{read}!VarRW@{VarRW}}
\subsubsection[{read}]{\setlength{\rightskip}{0pt plus 5cm}virtual const {\bf Element}\& VarRW::read (
\begin{DoxyParamCaption}
\item[{const Id \&}]{id}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}pure virtual\mbox{]}}}}
\label{classVarRW_acb944450b84b487faeb1cbde243f76f4}


Read a variable from a route \mbox{[}such as nexthop\mbox{]}. 

If \hyperlink{protocolthe-p}{the} protocol doesn't support \hyperlink{protocolthe-p}{the} requested variable, and exception should be thrown.

If \hyperlink{protocolthe-p}{the} variable is not present in \hyperlink{protocolthe-p}{the} current route, then an \hyperlink{classElemNull}{ElemNull} should be returned \mbox{[}for example if ipv6 is requested on a v4 route\mbox{]}.

\hyperlink{classVarRW}{VarRW} is responsible for deleting \hyperlink{protocolthe-p}{the} object read \mbox{[}it owns it\mbox{]}. However care must be taken not to delete objects that were obtained by \hyperlink{classVarRW_ad7447615a7d30de4c5ad847d1f885f25}{write()} even though we pass them to \hyperlink{classVarRW_acb944450b84b487faeb1cbde243f76f4}{read()} later.

\begin{DoxyReturn}{Returns}
\hyperlink{classElement}{Element} requested, or \hyperlink{classElemNull}{ElemNull} of element is not available. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em id} & The variable that is being requested \mbox{[}such as metric\mbox{]}. \\
\hline
\end{DoxyParams}


Implemented in \hyperlink{classSingleVarRW_a136aa72d8ec6cf164bb3ac64bf84cf6e}{SingleVarRW}, \hyperlink{classSemanticVarRW_a44f56ad0b390770b0826b1f3841dab16}{SemanticVarRW}, \hyperlink{classTestVarRW_a3777daabf4ac7a7be3a28e367deb2622}{TestVarRW}, and \hyperlink{classFileVarRW_aee690b6e4308bb2e5ecc38531fec5109}{FileVarRW}.

\hypertarget{classVarRW_a7b297475236736691ec77c1f4ef325c4}{
\index{VarRW@{VarRW}!read\_\-trace@{read\_\-trace}}
\index{read\_\-trace@{read\_\-trace}!VarRW@{VarRW}}
\subsubsection[{read\_\-trace}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf Element} \& VarRW::read\_\-trace (
\begin{DoxyParamCaption}
\item[{const Id \&}]{id}
\end{DoxyParamCaption}
)}}
\label{classVarRW_a7b297475236736691ec77c1f4ef325c4}


Support for tracing reads. 

Executor will call this. This call will then call \hyperlink{classVarRW_acb944450b84b487faeb1cbde243f76f4}{read()}


\begin{DoxyParams}{Parameters}
{\em id} & variable to read. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
variable desired. 
\end{DoxyReturn}
\hypertarget{classVarRW_a6ae2005b7cb7ca447185c36329bb2a14}{
\index{VarRW@{VarRW}!sync@{sync}}
\index{sync@{sync}!VarRW@{VarRW}}
\subsubsection[{sync}]{\setlength{\rightskip}{0pt plus 5cm}void VarRW::sync (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classVarRW_a6ae2005b7cb7ca447185c36329bb2a14}


\hyperlink{classVarRW}{VarRW} must perform all pending writes to \hyperlink{protocolthe-p}{the} route now. 

This is usefull in scenarios where \hyperlink{classVarRW}{VarRW} decides to cache read and writes and perform \hyperlink{protocolthe-p}{the} actual writes at \hyperlink{protocolthe-p}{the} end \mbox{[}i.e. it stores pointers to elements\mbox{]}.

All pointers to elements \mbox{[}by write\mbox{]} may become invalid after a sync. 

Reimplemented in \hyperlink{classSingleVarRW_a4f3382c08ac73832cdd6f235b4cf3e24}{SingleVarRW}, \hyperlink{classSemanticVarRW_a404d1ce8d054fb545e468cd810f44508}{SemanticVarRW}, and \hyperlink{classFileVarRW_a9a64b305189c943c209b035afec1763a}{FileVarRW}.

\hypertarget{classVarRW_a8f03ed97ac2c405c4ac912cc3d07f64e}{
\index{VarRW@{VarRW}!trace@{trace}}
\index{trace@{trace}!VarRW@{VarRW}}
\subsubsection[{trace}]{\setlength{\rightskip}{0pt plus 5cm}uint32\_\-t VarRW::trace (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{classVarRW_a8f03ed97ac2c405c4ac912cc3d07f64e}


Obtain \hyperlink{protocolthe-p}{the} final trace value. 

Should be called after executing \hyperlink{protocolthe-p}{the} policy in case it changes.

\begin{DoxyReturn}{Returns}
trace value. 
\end{DoxyReturn}
\hypertarget{classVarRW_aef32228d742c99a1976fd8591f818bb1}{
\index{VarRW@{VarRW}!tracelog@{tracelog}}
\index{tracelog@{tracelog}!VarRW@{VarRW}}
\subsubsection[{tracelog}]{\setlength{\rightskip}{0pt plus 5cm}string VarRW::tracelog (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{classVarRW_aef32228d742c99a1976fd8591f818bb1}


Obtain \hyperlink{protocolthe-p}{the} actual trace from \hyperlink{protocolthe-p}{the} varrw. 

\begin{DoxyReturn}{Returns}
string representation of what was read and written. 
\end{DoxyReturn}
\hypertarget{classVarRW_ad7447615a7d30de4c5ad847d1f885f25}{
\index{VarRW@{VarRW}!write@{write}}
\index{write@{write}!VarRW@{VarRW}}
\subsubsection[{write}]{\setlength{\rightskip}{0pt plus 5cm}virtual void VarRW::write (
\begin{DoxyParamCaption}
\item[{const Id \&}]{id, }
\item[{const {\bf Element} \&}]{e}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}pure virtual\mbox{]}}}}
\label{classVarRW_ad7447615a7d30de4c5ad847d1f885f25}


Write a variable to a route. 

\hyperlink{classVarRW}{VarRW} does not own \hyperlink{classElement}{Element}, so it must not delete it.


\begin{DoxyParams}{Parameters}
{\em id} & Identifier of variable that must be written to. \\
\hline
{\em e} & Value that must be written to \hyperlink{protocolthe-p}{the} variable. \\
\hline
\end{DoxyParams}


Implemented in \hyperlink{classSingleVarRW_a6ae40fd0ed6596f9d371a950a13e974c}{SingleVarRW}, \hyperlink{classSemanticVarRW_adff85700d425e866acbcb304c1fd6a1f}{SemanticVarRW}, \hyperlink{classTestVarRW_a7eea5d3beaaa1dc1583e64f5b0aeaf0c}{TestVarRW}, and \hyperlink{classFileVarRW_a986d4b101c0ec1971794f89ff2864656}{FileVarRW}.

\hypertarget{classVarRW_a6396b9f0bffd01ee187aa827d142b3bf}{
\index{VarRW@{VarRW}!write\_\-trace@{write\_\-trace}}
\index{write\_\-trace@{write\_\-trace}!VarRW@{VarRW}}
\subsubsection[{write\_\-trace}]{\setlength{\rightskip}{0pt plus 5cm}void VarRW::write\_\-trace (
\begin{DoxyParamCaption}
\item[{const Id \&}]{id, }
\item[{const {\bf Element} \&}]{e}
\end{DoxyParamCaption}
)}}
\label{classVarRW_a6396b9f0bffd01ee187aa827d142b3bf}


Support for tracing writes. 

Executor will call this. This will then call \hyperlink{classVarRW_ad7447615a7d30de4c5ad847d1f885f25}{write()}

@ param id variable to write to. 
\begin{DoxyParams}{Parameters}
{\em e} & value to write. \\
\hline
\end{DoxyParams}


The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
/home/greearb/git/xorp.ct.github/xorp/policy/common/varrw.hh\item 
/home/greearb/git/xorp.ct.github/xorp/policy/common/varrw.cc\end{DoxyCompactItemize}
