\doxysection{ss7\+\_\+as.\+h}
\label{ss7__as_8h_source}\index{src/ss7\_as.h@{src/ss7\_as.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{2 }
\DoxyCodeLine{3 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{4 \textcolor{preprocessor}{\#include <osmocom/core/linuxlist.h>}}
\DoxyCodeLine{5 \textcolor{preprocessor}{\#include <osmocom/core/fsm.h>}}
\DoxyCodeLine{6 \textcolor{preprocessor}{\#include <osmocom/core/msgb.h>}}
\DoxyCodeLine{7 \textcolor{preprocessor}{\#include <osmocom/core/tdef.h>}}
\DoxyCodeLine{8 \textcolor{preprocessor}{\#include <osmocom/netif/stream.h>}}
\DoxyCodeLine{9 }
\DoxyCodeLine{10 \textcolor{preprocessor}{\#include <osmocom/sigtran/osmo\_ss7.h>}}
\DoxyCodeLine{11 }
\DoxyCodeLine{12 \textcolor{preprocessor}{\#include "{}ss7\_internal.h"{}}}
\DoxyCodeLine{13 }
\DoxyCodeLine{14 \textcolor{comment}{/***********************************************************************}}
\DoxyCodeLine{15 \textcolor{comment}{ * SS7 Application Server}}
\DoxyCodeLine{16 \textcolor{comment}{ ***********************************************************************/}}
\DoxyCodeLine{17 }
\DoxyCodeLine{18 \textcolor{keyword}{struct }osmo\_ss7\_instance;}
\DoxyCodeLine{19 \textcolor{keyword}{struct }osmo\_ss7\_asp;}
\DoxyCodeLine{20 \textcolor{keyword}{struct }osmo\_mtp\_transfer\_param;}
\DoxyCodeLine{21 }
\DoxyCodeLine{22 \textcolor{keyword}{enum} osmo\_ss7\_as\_patch\_sccp\_mode \{}
\DoxyCodeLine{23         OSMO\_SS7\_PATCH\_NONE, \textcolor{comment}{/* no patching of SCCP */}}
\DoxyCodeLine{24         OSMO\_SS7\_PATCH\_BOTH, \textcolor{comment}{/* patch both OPC and DPC into SCCP addresses */}}
\DoxyCodeLine{25 \};}
\DoxyCodeLine{26 }
\DoxyCodeLine{27 \textcolor{keyword}{enum} ss7\_as\_ctr \{}
\DoxyCodeLine{28         SS7\_AS\_CTR\_RX\_MSU\_DISCARD,}
\DoxyCodeLine{29         SS7\_AS\_CTR\_RX\_MSU\_TOTAL,}
\DoxyCodeLine{30         SS7\_AS\_CTR\_RX\_MSU\_SLS\_0,}
\DoxyCodeLine{31         SS7\_AS\_CTR\_RX\_MSU\_SLS\_1,}
\DoxyCodeLine{32         SS7\_AS\_CTR\_RX\_MSU\_SLS\_2,}
\DoxyCodeLine{33         SS7\_AS\_CTR\_RX\_MSU\_SLS\_3,}
\DoxyCodeLine{34         SS7\_AS\_CTR\_RX\_MSU\_SLS\_4,}
\DoxyCodeLine{35         SS7\_AS\_CTR\_RX\_MSU\_SLS\_5,}
\DoxyCodeLine{36         SS7\_AS\_CTR\_RX\_MSU\_SLS\_6,}
\DoxyCodeLine{37         SS7\_AS\_CTR\_RX\_MSU\_SLS\_7,}
\DoxyCodeLine{38         SS7\_AS\_CTR\_RX\_MSU\_SLS\_8,}
\DoxyCodeLine{39         SS7\_AS\_CTR\_RX\_MSU\_SLS\_9,}
\DoxyCodeLine{40         SS7\_AS\_CTR\_RX\_MSU\_SLS\_10,}
\DoxyCodeLine{41         SS7\_AS\_CTR\_RX\_MSU\_SLS\_11,}
\DoxyCodeLine{42         SS7\_AS\_CTR\_RX\_MSU\_SLS\_12,}
\DoxyCodeLine{43         SS7\_AS\_CTR\_RX\_MSU\_SLS\_13,}
\DoxyCodeLine{44         SS7\_AS\_CTR\_RX\_MSU\_SLS\_14,}
\DoxyCodeLine{45         SS7\_AS\_CTR\_RX\_MSU\_SLS\_15,}
\DoxyCodeLine{46         SS7\_AS\_CTR\_TX\_MSU\_TOTAL,}
\DoxyCodeLine{47         SS7\_AS\_CTR\_TX\_MSU\_SLS\_0,}
\DoxyCodeLine{48         SS7\_AS\_CTR\_TX\_MSU\_SLS\_1,}
\DoxyCodeLine{49         SS7\_AS\_CTR\_TX\_MSU\_SLS\_2,}
\DoxyCodeLine{50         SS7\_AS\_CTR\_TX\_MSU\_SLS\_3,}
\DoxyCodeLine{51         SS7\_AS\_CTR\_TX\_MSU\_SLS\_4,}
\DoxyCodeLine{52         SS7\_AS\_CTR\_TX\_MSU\_SLS\_5,}
\DoxyCodeLine{53         SS7\_AS\_CTR\_TX\_MSU\_SLS\_6,}
\DoxyCodeLine{54         SS7\_AS\_CTR\_TX\_MSU\_SLS\_7,}
\DoxyCodeLine{55         SS7\_AS\_CTR\_TX\_MSU\_SLS\_8,}
\DoxyCodeLine{56         SS7\_AS\_CTR\_TX\_MSU\_SLS\_9,}
\DoxyCodeLine{57         SS7\_AS\_CTR\_TX\_MSU\_SLS\_10,}
\DoxyCodeLine{58         SS7\_AS\_CTR\_TX\_MSU\_SLS\_11,}
\DoxyCodeLine{59         SS7\_AS\_CTR\_TX\_MSU\_SLS\_12,}
\DoxyCodeLine{60         SS7\_AS\_CTR\_TX\_MSU\_SLS\_13,}
\DoxyCodeLine{61         SS7\_AS\_CTR\_TX\_MSU\_SLS\_14,}
\DoxyCodeLine{62         SS7\_AS\_CTR\_TX\_MSU\_SLS\_15,}
\DoxyCodeLine{63 \};}
\DoxyCodeLine{64 }
\DoxyCodeLine{65 \textcolor{preprocessor}{\#define NUM\_AS\_EXT\_SLS 128}}
\DoxyCodeLine{66 \textcolor{keyword}{typedef} uint8\_t as\_ext\_sls\_t; \textcolor{comment}{/* range: 0-\/127, 7 bit */}}
\DoxyCodeLine{67 \textcolor{keyword}{struct }osmo\_ss7\_as\_esls\_entry \{}
\DoxyCodeLine{68         \textcolor{comment}{/* ITU Q.704 4.2.1: "{}normal signallink link"{} */}}
\DoxyCodeLine{69         \textcolor{keyword}{struct }osmo\_ss7\_asp *normal\_asp;}
\DoxyCodeLine{70         \textcolor{comment}{/* ITU Q.704 4.2.1: "{}alternative signallink link"{} */}}
\DoxyCodeLine{71         \textcolor{keyword}{struct }osmo\_ss7\_asp *alt\_asp;}
\DoxyCodeLine{72 \};}
\DoxyCodeLine{73 }
\DoxyCodeLine{74 \textcolor{keyword}{struct }osmo\_ss7\_as \{}
\DoxyCodeLine{76         \textcolor{keyword}{struct }llist\_head list;}
\DoxyCodeLine{77         \textcolor{keyword}{struct }osmo\_ss7\_instance *inst;}
\DoxyCodeLine{78 }
\DoxyCodeLine{80         \textcolor{keyword}{struct }osmo\_fsm\_inst *fi;}
\DoxyCodeLine{81 }
\DoxyCodeLine{83         \textcolor{keywordtype}{bool} rkm\_dyn\_allocated;}
\DoxyCodeLine{84 }
\DoxyCodeLine{86         \textcolor{keywordtype}{bool} simple\_client\_allocated;}
\DoxyCodeLine{87 }
\DoxyCodeLine{89         \textcolor{keyword}{struct }rate\_ctr\_group *ctrg;}
\DoxyCodeLine{90 }
\DoxyCodeLine{91         \textcolor{comment}{/* ASP loadshare: */}}
\DoxyCodeLine{92         \textcolor{keyword}{struct }osmo\_ss7\_as\_esls\_entry aesls\_table[NUM\_AS\_EXT\_SLS];}
\DoxyCodeLine{93 }
\DoxyCodeLine{94         \textcolor{keyword}{struct }\{}
\DoxyCodeLine{95                 \textcolor{keywordtype}{char} *name;}
\DoxyCodeLine{96                 \textcolor{keywordtype}{char} *description;}
\DoxyCodeLine{97                 \textcolor{keyword}{enum} osmo\_ss7\_asp\_protocol proto;}
\DoxyCodeLine{98                 \textcolor{keyword}{struct }osmo\_ss7\_routing\_key routing\_key;}
\DoxyCodeLine{99                 \textcolor{keyword}{enum} osmo\_ss7\_as\_traffic\_mode mode;}
\DoxyCodeLine{100                 \textcolor{comment}{/* traffic mode was configured by VTY / config file */}}
\DoxyCodeLine{101                 \textcolor{keywordtype}{bool} mode\_set\_by\_vty;}
\DoxyCodeLine{102                 \textcolor{comment}{/* traffic mode was configured by RKM (routing key management) or first ASPAC */}}
\DoxyCodeLine{103                 \textcolor{keywordtype}{bool} mode\_set\_by\_peer;}
\DoxyCodeLine{104                 uint32\_t recovery\_timeout\_msec;}
\DoxyCodeLine{105                 uint8\_t qos\_class;}
\DoxyCodeLine{106                 \textcolor{keyword}{struct }\{}
\DoxyCodeLine{107                         \textcolor{keywordtype}{bool} opc\_enabled;}
\DoxyCodeLine{108                         \textcolor{keywordtype}{bool} dpc\_enabled;}
\DoxyCodeLine{109                         uint32\_t opc;}
\DoxyCodeLine{110                         uint32\_t dpc;}
\DoxyCodeLine{111                         \textcolor{keyword}{enum} osmo\_ss7\_as\_patch\_sccp\_mode sccp\_mode;}
\DoxyCodeLine{112                 \} pc\_override;}
\DoxyCodeLine{113 }
\DoxyCodeLine{114                 \textcolor{keyword}{struct }osmo\_ss7\_asp *asps[16];}
\DoxyCodeLine{115                 \textcolor{comment}{/* used for load-\/sharing traffic mode (round robin implementation) */}}
\DoxyCodeLine{116                 uint8\_t last\_asp\_idx\_assigned;}
\DoxyCodeLine{117                 uint8\_t last\_asp\_idx\_sent;}
\DoxyCodeLine{118 }
\DoxyCodeLine{119                 \textcolor{keyword}{struct }\{}
\DoxyCodeLine{120                         \textcolor{comment}{/* How many bits from ITU SLS field (starting from least-\/significant-\/bit)}}
\DoxyCodeLine{121 \textcolor{comment}{                        * to skip for routing decisions.}}
\DoxyCodeLine{122 \textcolor{comment}{                        * range 0-\/3, defaults to 0, which means take all 4 bits. */}}
\DoxyCodeLine{123                         uint8\_t sls\_shift;}
\DoxyCodeLine{124                         \textcolor{comment}{/* Whether to generate a extended-\/SLS with OPC information, see opc\_shift below. */}}
\DoxyCodeLine{125                         \textcolor{keywordtype}{bool} opc\_sls;}
\DoxyCodeLine{126                         \textcolor{comment}{/* How many bits from ITU OPC field (starting from least-\/significant-\/bit)}}
\DoxyCodeLine{127 \textcolor{comment}{                        * to skip for routing decisions (always takes 12 bits).}}
\DoxyCodeLine{128 \textcolor{comment}{                        * range 0-\/2, defaults to 0, which means take least significant 12 bits. */}}
\DoxyCodeLine{129                         uint8\_t opc\_shift;}
\DoxyCodeLine{130                 \} loadshare;}
\DoxyCodeLine{131         \} cfg;}
\DoxyCodeLine{132 \};}
\DoxyCodeLine{133 \textcolor{keyword}{struct }osmo\_ss7\_as *ss7\_as\_alloc(\textcolor{keyword}{struct} osmo\_ss7\_instance *inst, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name,}
\DoxyCodeLine{134                                  \textcolor{keyword}{enum} osmo\_ss7\_asp\_protocol proto);}
\DoxyCodeLine{135 \textcolor{keyword}{struct }osmo\_ss7\_asp *ss7\_as\_select\_asp(\textcolor{keyword}{struct} osmo\_ss7\_as *as, \textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_mtp\_transfer\_param *mtp);}
\DoxyCodeLine{136 }
\DoxyCodeLine{137 \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} osmo\_ss7\_as\_count\_asp(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_as *as);}
\DoxyCodeLine{138 \textcolor{keywordtype}{int} ss7\_as\_add\_asp(\textcolor{keyword}{struct} osmo\_ss7\_as *as, \textcolor{keyword}{struct} osmo\_ss7\_asp *asp);}
\DoxyCodeLine{139 \textcolor{keywordtype}{int} ss7\_as\_get\_local\_role(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_as *as);}
\DoxyCodeLine{140 \textcolor{keywordtype}{void} ss7\_as\_loadshare\_binding\_table\_reset(\textcolor{keyword}{struct} osmo\_ss7\_as *as);}
\DoxyCodeLine{141 }
\DoxyCodeLine{142 \textcolor{preprocessor}{\#define LOGPAS(as, subsys, level, fmt, args ...) \(\backslash\)}}
\DoxyCodeLine{143 \textcolor{preprocessor}{        \_LOGSS7((as)-\/>inst, subsys, level, "{}AS(\%s) "{}} fmt, (as)-\/>cfg.name, \#\# args)}

\end{DoxyCode}
