\hypertarget{classASSegment}{
\section{ASSegment Class Reference}
\label{classASSegment}\index{ASSegment@{ASSegment}}
}


Parent class for \hyperlink{classASPath}{ASPath} elements, which can be either ASSet or ASSequence.  




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

Inheritance diagram for ASSegment:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classASSegment}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classASSegment_a2a09bb183ab0b73adf5e90ec958b8e20}{
typedef list$<$ \hyperlink{classAsNum}{AsNum} $>$ {\bfseries ASLIST}}
\label{classASSegment_a2a09bb183ab0b73adf5e90ec958b8e20}

\item 
\hypertarget{classASSegment_af90656d8876336e9311ca804f0fe9c42}{
typedef ASLIST::iterator {\bfseries iterator}}
\label{classASSegment_af90656d8876336e9311ca804f0fe9c42}

\item 
\hypertarget{classASSegment_af92e5e02495508d8310a96cd76f71882}{
typedef ASLIST::const\_\-iterator {\bfseries const\_\-iterator}}
\label{classASSegment_af92e5e02495508d8310a96cd76f71882}

\item 
\hypertarget{classASSegment_ab7191cf932caa4bf671d5837149d40be}{
typedef ASLIST::const\_\-reverse\_\-iterator {\bfseries const\_\-reverse\_\-iterator}}
\label{classASSegment_ab7191cf932caa4bf671d5837149d40be}

\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classASSegment_ae068f2471fdfa3814d2658702f9aafdb}{
\hyperlink{classASSegment_ae068f2471fdfa3814d2658702f9aafdb}{ASSegment} (ASPathSegType t=AS\_\-NONE)}
\label{classASSegment_ae068f2471fdfa3814d2658702f9aafdb}

\begin{DoxyCompactList}\small\item\em Constructor of an empty \hyperlink{classASSegment}{ASSegment}. \item\end{DoxyCompactList}\item 
\hyperlink{classASSegment_af77bf20b6e437884b3435e37b765a4af}{ASSegment} (const uint8\_\-t $\ast$d)  throw (CorruptMessage)
\begin{DoxyCompactList}\small\item\em constructor from external representation will just decode \hyperlink{protocolthe-p}{the} chunk of data received, and convert to internal representation. \item\end{DoxyCompactList}\item 
\hypertarget{classASSegment_a51082a0ddd53fbedd96819e207df4d6a}{
\hyperlink{classASSegment_a51082a0ddd53fbedd96819e207df4d6a}{ASSegment} (const \hyperlink{classASSegment}{ASSegment} \&a)}
\label{classASSegment_a51082a0ddd53fbedd96819e207df4d6a}

\begin{DoxyCompactList}\small\item\em Copy constructor. \item\end{DoxyCompactList}\item 
\hypertarget{classASSegment_ae03615ea2a51a0946d9d83384fab645d}{
\hyperlink{classASSegment_ae03615ea2a51a0946d9d83384fab645d}{$\sim$ASSegment} ()}
\label{classASSegment_ae03615ea2a51a0946d9d83384fab645d}

\begin{DoxyCompactList}\small\item\em The destructor has nothing to do, \hyperlink{protocolthe-p}{the} underlying container will take care of \hyperlink{protocolthe-p}{the} thing. \item\end{DoxyCompactList}\item 
\hypertarget{classASSegment_acafec211aca03800c9bab0105ed0180c}{
void \hyperlink{classASSegment_acafec211aca03800c9bab0105ed0180c}{clear} ()}
\label{classASSegment_acafec211aca03800c9bab0105ed0180c}

\begin{DoxyCompactList}\small\item\em reset whatever is currently contained in \hyperlink{protocolthe-p}{the} object. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classASSegment_a26429678522ec77a32a9b88b46166482}{path\_\-length} () const 
\item 
\hypertarget{classASSegment_a0066b8477d83231fd327ef3702f33f63}{
size\_\-t {\bfseries as\_\-size} () const }
\label{classASSegment_a0066b8477d83231fd327ef3702f33f63}

\item 
\hypertarget{classASSegment_a87b440d75672c71c015e532ccd16c054}{
void \hyperlink{classASSegment_a87b440d75672c71c015e532ccd16c054}{add\_\-as} (const \hyperlink{classAsNum}{AsNum} \&n)}
\label{classASSegment_a87b440d75672c71c015e532ccd16c054}

\begin{DoxyCompactList}\small\item\em Add \hyperlink{classAsNum}{AsNum} at \hyperlink{protocolthe-p}{the} end of \hyperlink{protocolthe-p}{the} segment (order is irrelevant for AS\_\-SET but important for AS\_\-SEQUENCE) This is used when initializing from a string. \item\end{DoxyCompactList}\item 
void \hyperlink{classASSegment_a69c692c4a3c06e3243133433c3f800b8}{prepend\_\-as} (const \hyperlink{classAsNum}{AsNum} \&n)
\begin{DoxyCompactList}\small\item\em Add \hyperlink{classAsNum}{AsNum} at \hyperlink{protocolthe-p}{the} beginning of \hyperlink{protocolthe-p}{the} segment (order is irrelevant for AS\_\-SET but important for AS\_\-SEQUENCE). \item\end{DoxyCompactList}\item 
\hypertarget{classASSegment_af1d16e74b0e7a876107aa424b6fb65e5}{
bool \hyperlink{classASSegment_af1d16e74b0e7a876107aa424b6fb65e5}{contains} (const \hyperlink{classAsNum}{AsNum} \&as\_\-num) const }
\label{classASSegment_af1d16e74b0e7a876107aa424b6fb65e5}

\begin{DoxyCompactList}\small\item\em Check if a given \hyperlink{classAsNum}{AsNum} is contained in \hyperlink{protocolthe-p}{the} segment. \item\end{DoxyCompactList}\item 
\hypertarget{classASSegment_ae6eb94e608575aecdb4d4490db3b827d}{
const \hyperlink{classAsNum}{AsNum} \& {\bfseries first\_\-asnum} () const }
\label{classASSegment_ae6eb94e608575aecdb4d4490db3b827d}

\item 
\hypertarget{classASSegment_afe60d334a8004a9178f811f7d0679e2c}{
const \hyperlink{classAsNum}{AsNum} \& \hyperlink{classASSegment_afe60d334a8004a9178f811f7d0679e2c}{as\_\-num} (int n) const }
\label{classASSegment_afe60d334a8004a9178f811f7d0679e2c}

\begin{DoxyCompactList}\small\item\em find \hyperlink{protocolthe-p}{the} n'th AS number in \hyperlink{protocolthe-p}{the} segment \item\end{DoxyCompactList}\item 
void \hyperlink{classASSegment_a08b64d8b0a219d7d6e99e493baddf9ce}{decode} (const uint8\_\-t $\ast$d)  throw (CorruptMessage)
\begin{DoxyCompactList}\small\item\em Convert \hyperlink{protocolthe-p}{the} external representation into \hyperlink{protocolthe-p}{the} internal one. \item\end{DoxyCompactList}\item 
const uint8\_\-t $\ast$ \hyperlink{classASSegment_a1ad670f929375a3d98cdd9710438a14e}{encode} (size\_\-t \&len, uint8\_\-t $\ast$buf) const 
\begin{DoxyCompactList}\small\item\em Convert from internal to external representation. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classASSegment_a4e7dbd94c81c53ca29db098fed09c58d}{wire\_\-size} () const 
\item 
string \hyperlink{classASSegment_adaaaf751a9c7e128d988bf5ec03225a2}{str} () const 
\begin{DoxyCompactList}\small\item\em prints ASSegments as \item\end{DoxyCompactList}\item 
string \hyperlink{classASSegment_a5c6ba5b8cf1341601f78e5221f8279d8}{short\_\-str} () const 
\begin{DoxyCompactList}\small\item\em prints ASSegments as \item\end{DoxyCompactList}\item 
\hypertarget{classASSegment_a95f1b62bf148868ce44092d08c364511}{
bool \hyperlink{classASSegment_a95f1b62bf148868ce44092d08c364511}{operator==} (const \hyperlink{classASSegment}{ASSegment} \&him) const }
\label{classASSegment_a95f1b62bf148868ce44092d08c364511}

\begin{DoxyCompactList}\small\item\em compares internal representations for equality. \item\end{DoxyCompactList}\item 
\hypertarget{classASSegment_ae204ffac7a6fbe1fc25bd44d4717abaa}{
bool \hyperlink{classASSegment_ae204ffac7a6fbe1fc25bd44d4717abaa}{operator$<$} (const \hyperlink{classASSegment}{ASSegment} \&him) const }
\label{classASSegment_ae204ffac7a6fbe1fc25bd44d4717abaa}

\begin{DoxyCompactList}\small\item\em Compares internal representations for $<$. \item\end{DoxyCompactList}\item 
\hypertarget{classASSegment_ae24b78c2c787a24da79fe5417274abb5}{
ASPathSegType {\bfseries type} () const }
\label{classASSegment_ae24b78c2c787a24da79fe5417274abb5}

\item 
\hypertarget{classASSegment_ab651cc3060bf5c7cf65caf55bbabbc8c}{
void {\bfseries set\_\-type} (ASPathSegType t)}
\label{classASSegment_ab651cc3060bf5c7cf65caf55bbabbc8c}

\item 
\hypertarget{classASSegment_a5a14d042f7007352058c4a2acd63920d}{
size\_\-t {\bfseries encode\_\-for\_\-mib} (uint8\_\-t $\ast$buf, size\_\-t buf\_\-size) const }
\label{classASSegment_a5a14d042f7007352058c4a2acd63920d}

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

\begin{DoxyCompactList}\small\item\em returns true if \hyperlink{protocolthe-p}{the} AS segment does not lose information when represented entirely as two-\/byte AS numbers \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classASSegment_a21898dfdbeb2e47002ba096eab67caf7}{
ASPathSegType {\bfseries \_\-type}}
\label{classASSegment_a21898dfdbeb2e47002ba096eab67caf7}

\item 
\hypertarget{classASSegment_adf9886bb7d91f0161735c92e45eeeafc}{
ASLIST {\bfseries \_\-aslist}}
\label{classASSegment_adf9886bb7d91f0161735c92e45eeeafc}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
Parent class for \hyperlink{classASPath}{ASPath} elements, which can be either ASSet or ASSequence. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classASSegment_af77bf20b6e437884b3435e37b765a4af}{
\index{ASSegment@{ASSegment}!ASSegment@{ASSegment}}
\index{ASSegment@{ASSegment}!ASSegment@{ASSegment}}
\subsubsection[{ASSegment}]{\setlength{\rightskip}{0pt plus 5cm}ASSegment::ASSegment (
\begin{DoxyParamCaption}
\item[{const uint8\_\-t $\ast$}]{d}
\end{DoxyParamCaption}
)  throw ({\bf CorruptMessage})\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classASSegment_af77bf20b6e437884b3435e37b765a4af}


constructor from external representation will just decode \hyperlink{protocolthe-p}{the} chunk of data received, and convert to internal representation. 

In fact, \hyperlink{protocolthe-p}{the} external representation is quite simple and effective.

\_\-type is d\mbox{[}0\mbox{]}, l is d\mbox{[}1\mbox{]}, entries follow. 

\subsection{Member Function Documentation}
\hypertarget{classASSegment_a08b64d8b0a219d7d6e99e493baddf9ce}{
\index{ASSegment@{ASSegment}!decode@{decode}}
\index{decode@{decode}!ASSegment@{ASSegment}}
\subsubsection[{decode}]{\setlength{\rightskip}{0pt plus 5cm}void ASSegment::decode (
\begin{DoxyParamCaption}
\item[{const uint8\_\-t $\ast$}]{d}
\end{DoxyParamCaption}
)  throw ({\bf CorruptMessage})}}
\label{classASSegment_a08b64d8b0a219d7d6e99e493baddf9ce}


Convert \hyperlink{protocolthe-p}{the} external representation into \hyperlink{protocolthe-p}{the} internal one. 

\_\-type is d\mbox{[}0\mbox{]}, \_\-entries is d\mbox{[}1\mbox{]}, entries follow. 

Reimplemented in \hyperlink{classAS4Segment_a4fb3dc0d5f4669892995eba37b4e2b54}{AS4Segment}.

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


Convert from internal to external representation. 

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{classAS4Segment_aa374cd7c49b69de32bd88ad73335249d}{AS4Segment}.

\hypertarget{classASSegment_a26429678522ec77a32a9b88b46166482}{
\index{ASSegment@{ASSegment}!path\_\-length@{path\_\-length}}
\index{path\_\-length@{path\_\-length}!ASSegment@{ASSegment}}
\subsubsection[{path\_\-length}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t ASSegment::path\_\-length (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classASSegment_a26429678522ec77a32a9b88b46166482}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} path length, which is 1 for an AS\_\-SET, and \hyperlink{protocolthe-p}{the} length of \hyperlink{protocolthe-p}{the} sequence for an AS\_\-SEQUENCE 
\end{DoxyReturn}
\hypertarget{classASSegment_a69c692c4a3c06e3243133433c3f800b8}{
\index{ASSegment@{ASSegment}!prepend\_\-as@{prepend\_\-as}}
\index{prepend\_\-as@{prepend\_\-as}!ASSegment@{ASSegment}}
\subsubsection[{prepend\_\-as}]{\setlength{\rightskip}{0pt plus 5cm}void ASSegment::prepend\_\-as (
\begin{DoxyParamCaption}
\item[{const {\bf AsNum} \&}]{n}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classASSegment_a69c692c4a3c06e3243133433c3f800b8}


Add \hyperlink{classAsNum}{AsNum} at \hyperlink{protocolthe-p}{the} beginning of \hyperlink{protocolthe-p}{the} segment (order is irrelevant for AS\_\-SET but important for AS\_\-SEQUENCE). 

This is used e.g. when a node is adding its \hyperlink{classAsNum}{AsNum} to \hyperlink{protocolthe-p}{the} sequence. \hypertarget{classASSegment_a5c6ba5b8cf1341601f78e5221f8279d8}{
\index{ASSegment@{ASSegment}!short\_\-str@{short\_\-str}}
\index{short\_\-str@{short\_\-str}!ASSegment@{ASSegment}}
\subsubsection[{short\_\-str}]{\setlength{\rightskip}{0pt plus 5cm}string ASSegment::short\_\-str (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classASSegment_a5c6ba5b8cf1341601f78e5221f8279d8}


prints ASSegments as 

\begin{DoxyReturn}{Returns}
compact string representation of \hyperlink{protocolthe-p}{the} segment
\end{DoxyReturn}
AS\_\-SEQUENCE: comma-\/separated-\/asn-\/list AS\_\-SET: \{comma-\/separated-\/asn-\/list\} AS\_\-CONFED\_\-SEQUENCE: (comma-\/separated-\/asn-\/list) AS\_\-CONFED\_\-SET: $<$comma-\/separated-\/asn-\/list$>$ \hypertarget{classASSegment_adaaaf751a9c7e128d988bf5ec03225a2}{
\index{ASSegment@{ASSegment}!str@{str}}
\index{str@{str}!ASSegment@{ASSegment}}
\subsubsection[{str}]{\setlength{\rightskip}{0pt plus 5cm}string ASSegment::str (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{classASSegment_adaaaf751a9c7e128d988bf5ec03225a2}


prints ASSegments as 

\begin{DoxyReturn}{Returns}
fancy string representation of \hyperlink{protocolthe-p}{the} segment
\end{DoxyReturn}
AS\_\-SEQUENCE: \mbox{[}comma-\/separated-\/asn-\/list\mbox{]} AS\_\-SET: \{comma-\/separated-\/asn-\/list\} AS\_\-CONFED\_\-SEQUENCE: (comma-\/separated-\/asn-\/list) AS\_\-CONFED\_\-SET: $<$comma-\/separated-\/asn-\/list$>$ \hypertarget{classASSegment_a4e7dbd94c81c53ca29db098fed09c58d}{
\index{ASSegment@{ASSegment}!wire\_\-size@{wire\_\-size}}
\index{wire\_\-size@{wire\_\-size}!ASSegment@{ASSegment}}
\subsubsection[{wire\_\-size}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t ASSegment::wire\_\-size (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classASSegment_a4e7dbd94c81c53ca29db098fed09c58d}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} size of \hyperlink{protocolthe-p}{the} list on \hyperlink{protocolthe-p}{the} wire. 
\end{DoxyReturn}


Reimplemented in \hyperlink{classAS4Segment_a3a0532e5348f9512536943d16242e022}{AS4Segment}.



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}
