\hypertarget{classASPath}{
\section{ASPath Class Reference}
\label{classASPath}\index{ASPath@{ASPath}}
}


An \hyperlink{classASPath}{ASPath} is a list of ASSegments, each of which can be an AS\_\-SET, AS\_\-CONFED\_\-SET, AS\_\-SEQUENCE, or an AS\_\-CONFED\_\-SEQUENCE.  




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

Inheritance diagram for ASPath:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classASPath}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classASPath_a3fde84b6fb1b954839461323f0e981fe}{
typedef list$<$ \hyperlink{classASSegment}{ASSegment} $>$::const\_\-iterator {\bfseries const\_\-iterator}}
\label{classASPath_a3fde84b6fb1b954839461323f0e981fe}

\item 
\hypertarget{classASPath_a7b12320223ac2285cace028ea3b0442a}{
typedef list$<$ \hyperlink{classASSegment}{ASSegment} $>$::iterator {\bfseries iterator}}
\label{classASPath_a7b12320223ac2285cace028ea3b0442a}

\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classASPath_aa5d4a4fadc28f1ec1e27b8ac76357133}{ASPath} (const char $\ast$as\_\-path)  throw (InvalidString)
\begin{DoxyCompactList}\small\item\em Initialize from a string in \hyperlink{protocolthe-p}{the} format 1,2,(3,4,5),6,7,8,(9,10,11),12,13. \item\end{DoxyCompactList}\item 
\hypertarget{classASPath_a4cd0f04c3103caec64c3f7f271165996}{
\hyperlink{classASPath_a4cd0f04c3103caec64c3f7f271165996}{ASPath} (const uint8\_\-t $\ast$d, size\_\-t len)  throw (CorruptMessage)}
\label{classASPath_a4cd0f04c3103caec64c3f7f271165996}

\begin{DoxyCompactList}\small\item\em construct from received data \item\end{DoxyCompactList}\item 
\hyperlink{classASPath_a69125783dafd3d86efd31551e9b915aa}{ASPath} (const \hyperlink{classASPath}{ASPath} \&asp1, const \hyperlink{classASPath}{ASPath} \&asp2)
\begin{DoxyCompactList}\small\item\em construct an aggregate from two ASPaths \item\end{DoxyCompactList}\item 
\hypertarget{classASPath_af545a742d17bf5e1f8d0d03d09c49e1e}{
\hyperlink{classASPath_af545a742d17bf5e1f8d0d03d09c49e1e}{ASPath} (const \hyperlink{classASPath}{ASPath} \&a)}
\label{classASPath_af545a742d17bf5e1f8d0d03d09c49e1e}

\begin{DoxyCompactList}\small\item\em Copy constructor. \item\end{DoxyCompactList}\item 
\hypertarget{classASPath_ace9d3b5ae7d530e3584af21008631e38}{
void {\bfseries add\_\-segment} (const \hyperlink{classASSegment}{ASSegment} \&s)}
\label{classASPath_ace9d3b5ae7d530e3584af21008631e38}

\item 
\hypertarget{classASPath_aab926dfc92d18bdb034e930c7af8d6da}{
void {\bfseries prepend\_\-segment} (const \hyperlink{classASSegment}{ASSegment} \&s)}
\label{classASPath_aab926dfc92d18bdb034e930c7af8d6da}

\item 
\hypertarget{classASPath_a6c22ba9bd08bc796b82e84f6d44c16a3}{
size\_\-t {\bfseries path\_\-length} () const }
\label{classASPath_a6c22ba9bd08bc796b82e84f6d44c16a3}

\item 
\hypertarget{classASPath_a18fcedf8607616d0fe824825cf60f7b6}{
bool {\bfseries contains} (const \hyperlink{classAsNum}{AsNum} \&as\_\-num) const }
\label{classASPath_a18fcedf8607616d0fe824825cf60f7b6}

\item 
\hypertarget{classASPath_a8c11a1688f12929243e3f613408cc6cf}{
const \hyperlink{classAsNum}{AsNum} \& {\bfseries first\_\-asnum} () const }
\label{classASPath_a8c11a1688f12929243e3f613408cc6cf}

\item 
\hypertarget{classASPath_ac0ef39e2b041057ef6258442e57975ff}{
string {\bfseries str} () const }
\label{classASPath_ac0ef39e2b041057ef6258442e57975ff}

\item 
\hypertarget{classASPath_a4c0605b26c42282b0284764b18fb6f1c}{
string {\bfseries short\_\-str} () const }
\label{classASPath_a4c0605b26c42282b0284764b18fb6f1c}

\item 
\hypertarget{classASPath_a07715ae2fd586bb0e51a7322bf679806}{
const \hyperlink{classASSegment}{ASSegment} \& {\bfseries segment} (size\_\-t n) const }
\label{classASPath_a07715ae2fd586bb0e51a7322bf679806}

\item 
\hypertarget{classASPath_a4c2f15e2cb67177565a05ef02aad1a32}{
size\_\-t {\bfseries num\_\-segments} () const }
\label{classASPath_a4c2f15e2cb67177565a05ef02aad1a32}

\item 
const uint8\_\-t $\ast$ \hyperlink{classASPath_a4d0f732b6f520de59d19120067e48226}{encode} (size\_\-t \&len, uint8\_\-t $\ast$buf) const 
\begin{DoxyCompactList}\small\item\em Convert from internal to external representation, with \hyperlink{protocolthe-p}{the} correct representation for \hyperlink{protocolthe-p}{the} original AS\_\-PATH attribute. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classASPath_aaa74300bf1584a07c971dba25a281cef}{wire\_\-size} () const 
\item 
\hypertarget{classASPath_a00a41a28cde27880cdbef604edffa4a3}{
void \hyperlink{classASPath_a00a41a28cde27880cdbef604edffa4a3}{prepend\_\-as} (const \hyperlink{classAsNum}{AsNum} \&asn)}
\label{classASPath_a00a41a28cde27880cdbef604edffa4a3}

\begin{DoxyCompactList}\small\item\em Add \hyperlink{protocolthe-p}{the} As number to \hyperlink{protocolthe-p}{the} begining of \hyperlink{protocolthe-p}{the} AS\_\-SEQUENCE that starts \hyperlink{protocolthe-p}{the} As path, or if \hyperlink{protocolthe-p}{the} \hyperlink{classASPath}{ASPath} starts with an AS\_\-SET, then add a new AS\_\-SEQUENCE with \hyperlink{protocolthe-p}{the} new \hyperlink{classAsNum}{AsNum} to \hyperlink{protocolthe-p}{the} start of \hyperlink{protocolthe-p}{the} \hyperlink{classASPath}{ASPath}. \item\end{DoxyCompactList}\item 
\hypertarget{classASPath_a4bb2271e4047d0e32edcd18ee27d2895}{
void \hyperlink{classASPath_a4bb2271e4047d0e32edcd18ee27d2895}{prepend\_\-confed\_\-as} (const \hyperlink{classAsNum}{AsNum} \&asn)}
\label{classASPath_a4bb2271e4047d0e32edcd18ee27d2895}

\begin{DoxyCompactList}\small\item\em Add \hyperlink{protocolthe-p}{the} As number to \hyperlink{protocolthe-p}{the} begining of \hyperlink{protocolthe-p}{the} AS\_\-CONFED\_\-SEQUENCE that starts \hyperlink{protocolthe-p}{the} As path, or if \hyperlink{protocolthe-p}{the} \hyperlink{classASPath}{ASPath} does not start with an AS\_\-CONFED\_\-SEQUENCE, then add a new AS\_\-CONFED\_\-SEQUENCE with \hyperlink{protocolthe-p}{the} new \hyperlink{classAsNum}{AsNum} to \hyperlink{protocolthe-p}{the} start of \hyperlink{protocolthe-p}{the} \hyperlink{classASPath}{ASPath}. \item\end{DoxyCompactList}\item 
\hypertarget{classASPath_acdacfdd05afddbb83d4fddf5f2084753}{
void \hyperlink{classASPath_acdacfdd05afddbb83d4fddf5f2084753}{remove\_\-confed\_\-segments} ()}
\label{classASPath_acdacfdd05afddbb83d4fddf5f2084753}

\begin{DoxyCompactList}\small\item\em remove all confederation segments from aspath \item\end{DoxyCompactList}\item 
bool \hyperlink{classASPath_a71abbf5e8a7335695acc3b832417855f}{contains\_\-confed\_\-segments} () const 
\item 
\hypertarget{classASPath_aeb33752238c10284b2414d1356150981}{
\hyperlink{classASPath}{ASPath} \& {\bfseries operator=} (const \hyperlink{classASPath}{ASPath} \&him)}
\label{classASPath_aeb33752238c10284b2414d1356150981}

\item 
\hypertarget{classASPath_af75662ff1b7b3f0ab5b4b9252bed601b}{
bool {\bfseries operator==} (const \hyperlink{classASPath}{ASPath} \&him) const }
\label{classASPath_af75662ff1b7b3f0ab5b4b9252bed601b}

\item 
\hypertarget{classASPath_a73bb986414b04c08aea7b58fd8188721}{
bool {\bfseries operator$<$} (const \hyperlink{classASPath}{ASPath} \&him) const }
\label{classASPath_a73bb986414b04c08aea7b58fd8188721}

\item 
\hypertarget{classASPath_a2c0e25f75cf974ff3cc30aeae35e2bd6}{
void {\bfseries encode\_\-for\_\-mib} (vector$<$ uint8\_\-t $>$ \&aspath) const }
\label{classASPath_a2c0e25f75cf974ff3cc30aeae35e2bd6}

\item 
\hypertarget{classASPath_a4d5c179e781fab29baa22b891518b6f8}{
bool \hyperlink{classASPath_a4d5c179e781fab29baa22b891518b6f8}{two\_\-byte\_\-compatible} () const }
\label{classASPath_a4d5c179e781fab29baa22b891518b6f8}

\begin{DoxyCompactList}\small\item\em returns true if \hyperlink{protocolthe-p}{the} AS path does not lose information when represented entirely as two-\/byte AS numbers \item\end{DoxyCompactList}\item 
void \hyperlink{classASPath_a6d03b3fb8c966d1df57c4c863b5349d0}{merge\_\-as4\_\-path} (\hyperlink{classAS4Path}{AS4Path} \&as4\_\-path)
\begin{DoxyCompactList}\small\item\em Merge an \hyperlink{classAS4Path}{AS4Path} into a 2-\/byte AS Path. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classASPath_a42b703ca19113d0c6d722092ac0b15d8}{
list$<$ \hyperlink{classASSegment}{ASSegment} $>$ \hyperlink{classASPath_a42b703ca19113d0c6d722092ac0b15d8}{\_\-segments}}
\label{classASPath_a42b703ca19113d0c6d722092ac0b15d8}

\begin{DoxyCompactList}\small\item\em internal representation \item\end{DoxyCompactList}\item 
\hypertarget{classASPath_a4e5ebbbd24f8a65eaf5163eed32cde1e}{
size\_\-t {\bfseries \_\-num\_\-segments}}
\label{classASPath_a4e5ebbbd24f8a65eaf5163eed32cde1e}

\item 
\hypertarget{classASPath_a22ffd80dc6473bfeeb7c1965f2f63bbe}{
size\_\-t {\bfseries \_\-path\_\-len}}
\label{classASPath_a22ffd80dc6473bfeeb7c1965f2f63bbe}

\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{classASPath_a7e0bb77fa48865fdee926cc270a6a970}{decode} (const uint8\_\-t $\ast$d, size\_\-t len)  throw (CorruptMessage)
\begin{DoxyCompactList}\small\item\em populate an \hyperlink{classASPath}{ASPath} from received data. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
An \hyperlink{classASPath}{ASPath} is a list of ASSegments, each of which can be an AS\_\-SET, AS\_\-CONFED\_\-SET, AS\_\-SEQUENCE, or an AS\_\-CONFED\_\-SEQUENCE. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classASPath_aa5d4a4fadc28f1ec1e27b8ac76357133}{
\index{ASPath@{ASPath}!ASPath@{ASPath}}
\index{ASPath@{ASPath}!ASPath@{ASPath}}
\subsubsection[{ASPath}]{\setlength{\rightskip}{0pt plus 5cm}ASPath::ASPath (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{as\_\-path}
\end{DoxyParamCaption}
)  throw ({\bf InvalidString})}}
\label{classASPath_aa5d4a4fadc28f1ec1e27b8ac76357133}


Initialize from a string in \hyperlink{protocolthe-p}{the} format 1,2,(3,4,5),6,7,8,(9,10,11),12,13. 

\hyperlink{classASPath}{ASPath} constructor by parsing strings.

Input strings should have \hyperlink{protocolthe-p}{the} form

\char`\"{}segment, segment, segment, ... ,segment\char`\"{}

where segments are parsed as

AS\_\-SEQUENCE: \mbox{[}comma-\/separated-\/asn-\/list\mbox{]} or comma-\/separated-\/asn-\/list AS\_\-SET: \{comma-\/separated-\/asn-\/list\} AS\_\-CONFED\_\-SEQUENCE: (comma-\/separated-\/asn-\/list) AS\_\-CONFED\_\-SET: $<$comma-\/separated-\/asn-\/list$>$

blank spaces \char`\"{} \char`\"{} can appear at any point in \hyperlink{protocolthe-p}{the} string. \hypertarget{classASPath_a69125783dafd3d86efd31551e9b915aa}{
\index{ASPath@{ASPath}!ASPath@{ASPath}}
\index{ASPath@{ASPath}!ASPath@{ASPath}}
\subsubsection[{ASPath}]{\setlength{\rightskip}{0pt plus 5cm}ASPath::ASPath (
\begin{DoxyParamCaption}
\item[{const {\bf ASPath} \&}]{asp1, }
\item[{const {\bf ASPath} \&}]{asp2}
\end{DoxyParamCaption}
)}}
\label{classASPath_a69125783dafd3d86efd31551e9b915aa}


construct an aggregate from two ASPaths 

construct a new aggregate \hyperlink{classASPath}{ASPath} from two ASPaths 

\subsection{Member Function Documentation}
\hypertarget{classASPath_a71abbf5e8a7335695acc3b832417855f}{
\index{ASPath@{ASPath}!contains\_\-confed\_\-segments@{contains\_\-confed\_\-segments}}
\index{contains\_\-confed\_\-segments@{contains\_\-confed\_\-segments}!ASPath@{ASPath}}
\subsubsection[{contains\_\-confed\_\-segments}]{\setlength{\rightskip}{0pt plus 5cm}bool ASPath::contains\_\-confed\_\-segments (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classASPath_a71abbf5e8a7335695acc3b832417855f}
\begin{DoxyReturn}{Returns}
true if \hyperlink{protocolthe-p}{the} AS\_\-PATH Contains confederation segments. 
\end{DoxyReturn}
\hypertarget{classASPath_a7e0bb77fa48865fdee926cc270a6a970}{
\index{ASPath@{ASPath}!decode@{decode}}
\index{decode@{decode}!ASPath@{ASPath}}
\subsubsection[{decode}]{\setlength{\rightskip}{0pt plus 5cm}void ASPath::decode (
\begin{DoxyParamCaption}
\item[{const uint8\_\-t $\ast$}]{d, }
\item[{size\_\-t}]{len}
\end{DoxyParamCaption}
)  throw ({\bf CorruptMessage})\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classASPath_a7e0bb77fa48865fdee926cc270a6a970}


populate an \hyperlink{classASPath}{ASPath} from received data. 

populate an \hyperlink{classASPath}{ASPath} from \hyperlink{protocolthe-p}{the} received data representation

Only used in \hyperlink{protocolthe-p}{the} constructor. 

Reimplemented in \hyperlink{classAS4Path_a3e562fe9cee697f9dd39355f4437384b}{AS4Path}.

\hypertarget{classASPath_a4d0f732b6f520de59d19120067e48226}{
\index{ASPath@{ASPath}!encode@{encode}}
\index{encode@{encode}!ASPath@{ASPath}}
\subsubsection[{encode}]{\setlength{\rightskip}{0pt plus 5cm}const uint8\_\-t $\ast$ ASPath::encode (
\begin{DoxyParamCaption}
\item[{size\_\-t \&}]{len, }
\item[{uint8\_\-t $\ast$}]{buf}
\end{DoxyParamCaption}
) const}}
\label{classASPath_a4d0f732b6f520de59d19120067e48226}


Convert from internal to external representation, with \hyperlink{protocolthe-p}{the} correct representation for \hyperlink{protocolthe-p}{the} original AS\_\-PATH attribute. 

If there are any 4-\/byte AS numbers, they will be encoded as AS\_\-TRAN.

If we do not pass a buffer (buf = 0), then \hyperlink{protocolthe-p}{the} routine will allocate a new one; otherwise, len indicates \hyperlink{protocolthe-p}{the} size of \hyperlink{protocolthe-p}{the} input buffer, which must be large enough to store \hyperlink{protocolthe-p}{the} encoding. \begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} pointer to \hyperlink{protocolthe-p}{the} buffer, len is \hyperlink{protocolthe-p}{the} actual size. 
\end{DoxyReturn}


Reimplemented in \hyperlink{classAS4Path_a5db6015fbfafc0f8141a31144fc79ac5}{AS4Path}.

\hypertarget{classASPath_a6d03b3fb8c966d1df57c4c863b5349d0}{
\index{ASPath@{ASPath}!merge\_\-as4\_\-path@{merge\_\-as4\_\-path}}
\index{merge\_\-as4\_\-path@{merge\_\-as4\_\-path}!ASPath@{ASPath}}
\subsubsection[{merge\_\-as4\_\-path}]{\setlength{\rightskip}{0pt plus 5cm}void ASPath::merge\_\-as4\_\-path (
\begin{DoxyParamCaption}
\item[{{\bf AS4Path} \&}]{as4\_\-path}
\end{DoxyParamCaption}
)}}
\label{classASPath_a6d03b3fb8c966d1df57c4c863b5349d0}


Merge an \hyperlink{classAS4Path}{AS4Path} into a 2-\/byte AS Path. 

Both paths will end up containing \hyperlink{protocolthe-p}{the} same data

param as4path \hyperlink{protocolthe-p}{the} AS4\_\-PATH to be merged. \hypertarget{classASPath_aaa74300bf1584a07c971dba25a281cef}{
\index{ASPath@{ASPath}!wire\_\-size@{wire\_\-size}}
\index{wire\_\-size@{wire\_\-size}!ASPath@{ASPath}}
\subsubsection[{wire\_\-size}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t ASPath::wire\_\-size (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classASPath_aaa74300bf1584a07c971dba25a281cef}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} size of \hyperlink{protocolthe-p}{the} list on \hyperlink{protocolthe-p}{the} wire. XXX this should be made more efficient. 
\end{DoxyReturn}


Reimplemented in \hyperlink{classAS4Path_a798a1a9ed962b2f5eb597160e7a415ab}{AS4Path}.



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