\doxysection{ss7\+\_\+instance.\+h}
\label{ss7__instance_8h_source}\index{src/ss7\_instance.h@{src/ss7\_instance.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 <stdbool.h>}}
\DoxyCodeLine{5 \textcolor{preprocessor}{\#include <osmocom/core/linuxlist.h>}}
\DoxyCodeLine{6 \textcolor{preprocessor}{\#include <osmocom/core/tdef.h>}}
\DoxyCodeLine{7 \textcolor{preprocessor}{\#include <osmocom/core/timer.h>}}
\DoxyCodeLine{8 \textcolor{preprocessor}{\#include <osmocom/core/timer\_compat.h>}}
\DoxyCodeLine{9 \textcolor{preprocessor}{\#include <osmocom/core/rate\_ctr.h>}}
\DoxyCodeLine{10 }
\DoxyCodeLine{11 \textcolor{preprocessor}{\#include <osmocom/sigtran/protocol/mtp.h>}}
\DoxyCodeLine{12 }
\DoxyCodeLine{13 \textcolor{comment}{/***********************************************************************}}
\DoxyCodeLine{14 \textcolor{comment}{ * SS7 Instances}}
\DoxyCodeLine{15 \textcolor{comment}{ ***********************************************************************/}}
\DoxyCodeLine{16 }
\DoxyCodeLine{17 \textcolor{keyword}{struct }osmo\_ss7\_user;}
\DoxyCodeLine{18 \textcolor{keyword}{struct }osmo\_ss7\_route\_table;}
\DoxyCodeLine{19 \textcolor{keyword}{struct }osmo\_ss7\_route\_label;}
\DoxyCodeLine{20 \textcolor{keyword}{struct }osmo\_sccp\_instance;}
\DoxyCodeLine{21 }
\DoxyCodeLine{22 \textcolor{keyword}{enum} ss7\_instance\_xua\_timer \{}
\DoxyCodeLine{23         \textcolor{comment}{/* 0 kept unused on purpose since it's handled specially by osmo\_fsm */}}
\DoxyCodeLine{24         SS7\_INST\_XUA\_T8 = 1, \textcolor{comment}{/* Q.704 T8 */}}
\DoxyCodeLine{25         \textcolor{comment}{/* This must remain the last item: */}}
\DoxyCodeLine{26         SS7\_INST\_XUA\_TIMERS\_LEN}
\DoxyCodeLine{27 \};}
\DoxyCodeLine{28 \textcolor{keyword}{extern} \textcolor{keyword}{const} \textcolor{keyword}{struct }value\_string ss7\_instance\_xua\_timer\_names[];}
\DoxyCodeLine{29 \textcolor{keyword}{extern} \textcolor{keyword}{const} \textcolor{keyword}{struct }osmo\_tdef ss7\_instance\_xua\_timer\_defaults[SS7\_INST\_XUA\_TIMERS\_LEN];}
\DoxyCodeLine{30 \textcolor{comment}{/* According to SUA RFC3868 Section 8, M3UA RFC4666 Section 4.3.4.1 */}}
\DoxyCodeLine{31 \textcolor{preprocessor}{\#define SS7\_INST\_XUA\_DEFAULT\_T8\_MSEC    1000}}
\DoxyCodeLine{32 }
\DoxyCodeLine{33 \textcolor{keyword}{enum} ss7\_instance\_ctr \{}
\DoxyCodeLine{34         SS7\_INST\_CTR\_PKT\_RX\_TOTAL,}
\DoxyCodeLine{35         SS7\_INST\_CTR\_PKT\_RX\_UNKNOWN,}
\DoxyCodeLine{36         SS7\_INST\_CTR\_PKT\_RX\_NI\_MISMATCH,}
\DoxyCodeLine{37         SS7\_INST\_CTR\_PKT\_TX\_TOTAL,}
\DoxyCodeLine{38 \};}
\DoxyCodeLine{39 }
\DoxyCodeLine{40 \textcolor{keyword}{struct }osmo\_ss7\_pc\_fmt \{}
\DoxyCodeLine{41         \textcolor{keywordtype}{char} delimiter;}
\DoxyCodeLine{42         uint8\_t component\_len[3];}
\DoxyCodeLine{43 \};}
\DoxyCodeLine{44 }
\DoxyCodeLine{45 \textcolor{keyword}{struct }osmo\_ss7\_instance \{}
\DoxyCodeLine{47         \textcolor{keyword}{struct }llist\_head list;}
\DoxyCodeLine{49         \textcolor{keyword}{struct }llist\_head linksets;}
\DoxyCodeLine{51         \textcolor{keyword}{struct }llist\_head as\_list;}
\DoxyCodeLine{53         \textcolor{keyword}{struct }llist\_head asp\_list;}
\DoxyCodeLine{55         \textcolor{keyword}{struct }llist\_head rtable\_list;}
\DoxyCodeLine{57         \textcolor{keyword}{struct }llist\_head xua\_servers;}
\DoxyCodeLine{58         \textcolor{comment}{/* array for faster lookup of user (indexed by service}}
\DoxyCodeLine{59 \textcolor{comment}{         * indicator) */}}
\DoxyCodeLine{60         \textcolor{keyword}{struct }osmo\_ss7\_user *user[16];}
\DoxyCodeLine{61 }
\DoxyCodeLine{62         \textcolor{keyword}{struct }osmo\_ss7\_route\_table *rtable\_system;}
\DoxyCodeLine{63 }
\DoxyCodeLine{64         \textcolor{keyword}{struct }osmo\_sccp\_instance *sccp;}
\DoxyCodeLine{65 }
\DoxyCodeLine{66         \textcolor{keyword}{struct }rate\_ctr\_group *ctrg;}
\DoxyCodeLine{67 }
\DoxyCodeLine{68         \textcolor{comment}{/* Q.704 Figure 44 and section 13.2: List to store remote PCs with T8 started */}}
\DoxyCodeLine{69         \textcolor{keyword}{struct }\{}
\DoxyCodeLine{70                 \textcolor{comment}{/* list of struct t8\_inaccessible\_sp\_entry, sorted by entry-\/>ts\_started */}}
\DoxyCodeLine{71                 \textcolor{keyword}{struct }llist\_head list;}
\DoxyCodeLine{72                 \textcolor{keyword}{struct }osmo\_timer\_list timer;}
\DoxyCodeLine{73         \} t8\_inaccessible\_sp;}
\DoxyCodeLine{74 }
\DoxyCodeLine{75         \textcolor{keyword}{struct }\{}
\DoxyCodeLine{76                 uint32\_t id;}
\DoxyCodeLine{77                 \textcolor{keywordtype}{char} *name;}
\DoxyCodeLine{78                 \textcolor{keywordtype}{char} *description;}
\DoxyCodeLine{79                 uint32\_t primary\_pc;}
\DoxyCodeLine{80                 \textcolor{comment}{/* capability PCs */}}
\DoxyCodeLine{81                 \textcolor{keyword}{enum} mtp\_network\_indicator network\_indicator;}
\DoxyCodeLine{82                 \textcolor{keyword}{struct }osmo\_ss7\_pc\_fmt pc\_fmt;}
\DoxyCodeLine{83                 \textcolor{keywordtype}{bool} permit\_dyn\_rkm\_alloc;}
\DoxyCodeLine{84                 \textcolor{keyword}{struct }llist\_head sccp\_address\_book;}
\DoxyCodeLine{85                 uint32\_t secondary\_pc;}
\DoxyCodeLine{86                 \textcolor{comment}{/* How many bits from ITU OPC/DPC field (starting from least-\/significant-\/bit)}}
\DoxyCodeLine{87 \textcolor{comment}{                 * to skip for routing decisions (always takes 6 bits).}}
\DoxyCodeLine{88 \textcolor{comment}{                 * range 0-\/8, defaults to 0, which means take least significant 6 bits. */}}
\DoxyCodeLine{89                 uint8\_t opc\_shift;}
\DoxyCodeLine{90                 uint8\_t dpc\_shift;}
\DoxyCodeLine{91                 \textcolor{comment}{/* How many bits from ITU SLS field (starting from least-\/significant-\/bit)}}
\DoxyCodeLine{92 \textcolor{comment}{                 * to skip for routing decisions.}}
\DoxyCodeLine{93 \textcolor{comment}{                 * range 0-\/3, defaults to 0, which means take all 4 bits. */}}
\DoxyCodeLine{94                 uint8\_t sls\_shift;}
\DoxyCodeLine{95 }
\DoxyCodeLine{96                 \textcolor{comment}{/* T\_defs defined at instance level: */}}
\DoxyCodeLine{97                 \textcolor{keyword}{struct }osmo\_tdef *T\_defs\_xua;}
\DoxyCodeLine{98         \} cfg;}
\DoxyCodeLine{99 \};}
\DoxyCodeLine{100 }
\DoxyCodeLine{101 \textcolor{keyword}{struct }osmo\_ss7\_instance *}
\DoxyCodeLine{102 ss7\_instance\_alloc(\textcolor{keywordtype}{void} *ctx, uint32\_t \textcolor{keywordtype}{id});}
\DoxyCodeLine{103 }
\DoxyCodeLine{104 uint32\_t ss7\_find\_free\_l\_rk\_id(\textcolor{keyword}{struct} osmo\_ss7\_instance *inst);}
\DoxyCodeLine{105 \textcolor{keyword}{struct }osmo\_ss7\_route *}
\DoxyCodeLine{106 ss7\_instance\_lookup\_route(\textcolor{keyword}{struct} osmo\_ss7\_instance *inst, \textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_route\_label *rtlabel);}
\DoxyCodeLine{107 }
\DoxyCodeLine{108 \textcolor{preprocessor}{\#define \_LOGSS7(inst, subsys, level, fmt, args ...) \(\backslash\)}}
\DoxyCodeLine{109 \textcolor{preprocessor}{        LOGP(subsys, level, "{}\%u: "{}} fmt, inst ? (inst)-\/>cfg.id : 0, \#\# args)}
\DoxyCodeLine{110 \textcolor{preprocessor}{\#define LOGSS7(inst, level, fmt, args ...) \(\backslash\)}}
\DoxyCodeLine{111 \textcolor{preprocessor}{        \_LOGSS7(inst, DLSS7, level, fmt, \#\# args)}}
\DoxyCodeLine{112 }
\DoxyCodeLine{113 }
\DoxyCodeLine{114 \textcolor{comment}{/***********************************************************************}}
\DoxyCodeLine{115 \textcolor{comment}{ * ITUQ.704 13.2.2: Timer T8 concerning one SP}}
\DoxyCodeLine{116 \textcolor{comment}{ ***********************************************************************/}}
\DoxyCodeLine{117 \textcolor{keyword}{struct }t8\_inaccessible\_sp\_entry \{}
\DoxyCodeLine{118         \textcolor{keyword}{struct }llist\_head entry; \textcolor{comment}{/* item in (struct osmo\_ss7\_instance)-\/>t8\_inaccessible\_sp.list */}}
\DoxyCodeLine{119         uint32\_t dpc; \textcolor{comment}{/* SP inaccessible */}}
\DoxyCodeLine{120         \textcolor{keyword}{struct }timespec ts\_started; \textcolor{comment}{/* Timestamp T8 was started for this SP */}}
\DoxyCodeLine{121 \};}
\DoxyCodeLine{122 \textcolor{keywordtype}{bool} ss7\_instance\_t8\_inaccessible\_sp\_running(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_instance *inst, uint32\_t dpc);}
\DoxyCodeLine{123 \textcolor{keywordtype}{void} ss7\_instance\_t8\_inaccessible\_sp\_start(\textcolor{keyword}{struct} osmo\_ss7\_instance *inst, uint32\_t dpc);}

\end{DoxyCode}
