\doxysection{ss7\+\_\+route.\+h}
\label{ss7__route_8h_source}\index{src/ss7\_route.h@{src/ss7\_route.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00002\ }
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#include\ <stdint.h>}}
\DoxyCodeLine{00004\ \textcolor{preprocessor}{\#include\ <stdbool.h>}}
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ <osmocom/core/linuxlist.h>}}
\DoxyCodeLine{00006\ }
\DoxyCodeLine{00007\ \textcolor{comment}{/***********************************************************************}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ SS7\ Routes}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ ***********************************************************************/}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00011\ \textcolor{keyword}{struct\ }osmo\_ss7\_instance;}
\DoxyCodeLine{00012\ \textcolor{keyword}{struct\ }osmo\_ss7\_route\_table;}
\DoxyCodeLine{00013\ \textcolor{keyword}{struct\ }osmo\_ss7\_linkset;}
\DoxyCodeLine{00014\ \textcolor{keyword}{struct\ }osmo\_ss7\_as;}
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#define\ OSMO\_SS7\_ROUTE\_PRIO\_DEFAULT\ 5}}
\DoxyCodeLine{00017\ }
\DoxyCodeLine{00018\ \textcolor{comment}{/*\ ITU\ Q.704\ 3.4\ Status\ of\ signalling\ routes\ */}}
\DoxyCodeLine{00019\ \textcolor{keyword}{enum}\ osmo\_ss7\_route\_status\ \{}
\DoxyCodeLine{00020\ \ \ \ \ \ \ \ \ OSMO\_SS7\_ROUTE\_STATUS\_UNAVAILABLE,}
\DoxyCodeLine{00021\ \ \ \ \ \ \ \ \ OSMO\_SS7\_ROUTE\_STATUS\_AVAILABLE,}
\DoxyCodeLine{00022\ \ \ \ \ \ \ \ \ OSMO\_SS7\_ROUTE\_STATUS\_RESTRICTED,}
\DoxyCodeLine{00023\ \};}
\DoxyCodeLine{00024\ \textcolor{keyword}{extern}\ \textcolor{keyword}{const}\ \textcolor{keyword}{struct\ }value\_string\ ss7\_route\_status\_names[];}
\DoxyCodeLine{00025\ \textcolor{keyword}{static}\ \textcolor{keyword}{inline}\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *ss7\_route\_status\_name(\textcolor{keyword}{enum}\ osmo\_ss7\_route\_status\ val)}
\DoxyCodeLine{00026\ \{\ \textcolor{keywordflow}{return}\ get\_value\_string(ss7\_route\_status\_names,\ val);\ \}}
\DoxyCodeLine{00027\ }
\DoxyCodeLine{00028\ \textcolor{keyword}{struct\ }osmo\_ss7\_route\ \{}
\DoxyCodeLine{00030\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }llist\_head\ list;}
\DoxyCodeLine{00032\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }osmo\_ss7\_route\_table\ *rtable;}
\DoxyCodeLine{00033\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Combined\ linkset\ this\ route\ is\ part\ of\ */}}
\DoxyCodeLine{00034\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }osmo\_ss7\_combined\_linkset\ *clset;}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ \ \ \ \ \ \ \ \ \textcolor{keyword}{enum}\ osmo\_ss7\_route\_status\ status;}
\DoxyCodeLine{00037\ }
\DoxyCodeLine{00038\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{00040\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }osmo\_ss7\_linkset\ *linkset;}
\DoxyCodeLine{00042\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }osmo\_ss7\_as\ *as;}
\DoxyCodeLine{00043\ \ \ \ \ \ \ \ \ \}\ dest;}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00045\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{00046\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ FIXME:\ presence?\ */}}
\DoxyCodeLine{00047\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint32\_t\ pc;}
\DoxyCodeLine{00048\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint32\_t\ mask;}
\DoxyCodeLine{00050\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{char}\ *linkset\_name;}
\DoxyCodeLine{00052\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint32\_t\ priority;}
\DoxyCodeLine{00053\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint8\_t\ qos\_class;}
\DoxyCodeLine{00054\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ dyn\_allocated;}
\DoxyCodeLine{00055\ \ \ \ \ \ \ \ \ \}\ cfg;}
\DoxyCodeLine{00056\ \};}
\DoxyCodeLine{00057\ }
\DoxyCodeLine{00058\ \textcolor{keyword}{struct\ }osmo\_ss7\_route\ *}
\DoxyCodeLine{00059\ ss7\_route\_alloc(\textcolor{keyword}{struct}\ osmo\_ss7\_route\_table\ *rtbl,\ uint32\_t\ pc,\ uint32\_t\ mask,\ \textcolor{keywordtype}{bool}\ dynamic);}
\DoxyCodeLine{00060\ \textcolor{keyword}{struct\ }osmo\_ss7\_route\ *}
\DoxyCodeLine{00061\ ss7\_route\_create(\textcolor{keyword}{struct}\ osmo\_ss7\_route\_table\ *rtbl,\ uint32\_t\ dpc,}
\DoxyCodeLine{00062\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint32\_t\ mask,\ \textcolor{keywordtype}{bool}\ dynamic,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *linkset\_name);}
\DoxyCodeLine{00063\ \textcolor{keywordtype}{void}\ ss7\_route\_destroy(\textcolor{keyword}{struct}\ osmo\_ss7\_route\ *rt);}
\DoxyCodeLine{00064\ }
\DoxyCodeLine{00065\ \textcolor{keyword}{struct\ }osmo\_ss7\_route\ *}
\DoxyCodeLine{00066\ ss7\_route\_find\_dpc(\textcolor{keyword}{struct}\ osmo\_ss7\_route\_table\ *rtbl,\ uint32\_t\ dpc);}
\DoxyCodeLine{00067\ \textcolor{keyword}{struct\ }osmo\_ss7\_route\ *}
\DoxyCodeLine{00068\ ss7\_route\_find\_dpc\_mask(\textcolor{keyword}{struct}\ osmo\_ss7\_route\_table\ *rtbl,\ uint32\_t\ dpc,}
\DoxyCodeLine{00069\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint32\_t\ mask);}
\DoxyCodeLine{00070\ }
\DoxyCodeLine{00071\ \textcolor{keywordtype}{int}\ ss7\_route\_set\_linkset(\textcolor{keyword}{struct}\ osmo\_ss7\_route\ *rt,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *linkset\_name);}
\DoxyCodeLine{00072\ \textcolor{keywordtype}{int}\ ss7\_route\_insert(\textcolor{keyword}{struct}\ osmo\_ss7\_route\ *rt);}
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00074\ \textcolor{keywordtype}{bool}\ ss7\_route\_dest\_is\_available(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ osmo\_ss7\_route\ *rt);}
\DoxyCodeLine{00075\ \textcolor{keywordtype}{bool}\ ss7\_route\_is\_available(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ osmo\_ss7\_route\ *rt);}
\DoxyCodeLine{00076\ }
\DoxyCodeLine{00077\ \textcolor{keywordtype}{bool}\ ss7\_route\_is\_fully\_qualified(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ osmo\_ss7\_route\ *rt);}
\DoxyCodeLine{00078\ \textcolor{keyword}{static}\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{bool}\ ss7\_route\_is\_summary(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ osmo\_ss7\_route\ *rt)}
\DoxyCodeLine{00079\ \{}
\DoxyCodeLine{00080\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ !ss7\_route\_is\_fully\_qualified(rt);}
\DoxyCodeLine{00081\ \}}
\DoxyCodeLine{00082\ }
\DoxyCodeLine{00083\ \textcolor{keywordtype}{void}\ ss7\_route\_update\_route\_status(\textcolor{keyword}{struct}\ osmo\_ss7\_route\ *rt,\ \textcolor{keyword}{enum}\ osmo\_ss7\_route\_status\ status);}
\DoxyCodeLine{00084\ }
\DoxyCodeLine{00085\ \textcolor{preprocessor}{\#define\ LOGPRT(rt,\ subsys,\ level,\ fmt,\ args\ ...)\ do\ \{\ \(\backslash\)}}
\DoxyCodeLine{00086\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ char\ \_pc\_str[MAX\_PC\_STR\_LEN];\ \(\backslash\)}}
\DoxyCodeLine{00087\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ char\ \_mask\_str[MAX\_PC\_STR\_LEN];\ \(\backslash\)}}
\DoxyCodeLine{00088\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \_LOGSS7((rt)-\/>rtable-\/>inst,\ subsys,\ level,\ \(\backslash\)}}
\DoxyCodeLine{00089\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "{}RT(dpc=\%u=\%s,mask=0x\%x=\%s,prio=\%u,via=\%s,st=\%s)\ "{}\ fmt,\ \(\backslash\)}}
\DoxyCodeLine{00090\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (rt)-\/>cfg.pc,\ osmo\_ss7\_pointcode\_print\_buf(\_pc\_str,\ MAX\_PC\_STR\_LEN,\ (rt)-\/>rtable-\/>inst,\ (rt)-\/>cfg.pc),\ \(\backslash\)}}
\DoxyCodeLine{00091\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (rt)-\/>cfg.mask,\ osmo\_ss7\_pointcode\_print\_buf(\_mask\_str,\ MAX\_PC\_STR\_LEN,\ (rt)-\/>rtable-\/>inst,\ (rt)-\/>cfg.mask),\ \(\backslash\)}}
\DoxyCodeLine{00092\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (rt)-\/>cfg.priority,\ \(\backslash\)}}
\DoxyCodeLine{00093\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (rt)-\/>cfg.linkset\_name\ ?\ (rt)-\/>cfg.linkset\_name\ :\ "{}"{},\ \(\backslash\)}}
\DoxyCodeLine{00094\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ss7\_route\_status\_name((rt)-\/>status),\ \(\backslash\)}}
\DoxyCodeLine{00095\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \#\#\ args);\ \(\backslash\)}}
\DoxyCodeLine{00096\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \}\ while\ (0)}}

\end{DoxyCode}
