\doxysection{ss7\+\_\+asp.\+h}
\label{ss7__asp_8h_source}\index{src/ss7\_asp.h@{src/ss7\_asp.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 "{}config.h"{}}}
\DoxyCodeLine{4 }
\DoxyCodeLine{5 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{6 \textcolor{preprocessor}{\#include <osmocom/core/linuxlist.h>}}
\DoxyCodeLine{7 \textcolor{preprocessor}{\#include <osmocom/core/fsm.h>}}
\DoxyCodeLine{8 \textcolor{preprocessor}{\#include <osmocom/core/msgb.h>}}
\DoxyCodeLine{9 \textcolor{preprocessor}{\#include <osmocom/core/tdef.h>}}
\DoxyCodeLine{10 \textcolor{preprocessor}{\#include <osmocom/netif/stream.h>}}
\DoxyCodeLine{11 }
\DoxyCodeLine{12 \textcolor{preprocessor}{\#include <osmocom/sigtran/osmo\_ss7.h>}}
\DoxyCodeLine{13 }
\DoxyCodeLine{14 \textcolor{preprocessor}{\#include "{}ss7\_asp\_peer.h"{}}}
\DoxyCodeLine{15 \textcolor{preprocessor}{\#include "{}ss7\_internal.h"{}}}
\DoxyCodeLine{16 }
\DoxyCodeLine{17 \textcolor{comment}{/***********************************************************************}}
\DoxyCodeLine{18 \textcolor{comment}{ * SS7 Application Server Processes}}
\DoxyCodeLine{19 \textcolor{comment}{ ***********************************************************************/}}
\DoxyCodeLine{20 }
\DoxyCodeLine{21 \textcolor{keyword}{struct }osmo\_ss7\_instance;}
\DoxyCodeLine{22 \textcolor{keyword}{struct }osmo\_xua\_layer\_manager;}
\DoxyCodeLine{23 }
\DoxyCodeLine{24 \textcolor{keyword}{enum} ss7\_asp\_xua\_timer \{}
\DoxyCodeLine{25         \textcolor{comment}{/* 0 kept unused on purpose since it's handled specially by osmo\_fsm */}}
\DoxyCodeLine{26         SS7\_ASP\_XUA\_T\_ACK = 1, \textcolor{comment}{/* RFC3868 \& RFC4666 timer T(ack) */}}
\DoxyCodeLine{27         SS7\_ASP\_XUA\_T\_BEAT, \textcolor{comment}{/* RFC3868 \& RFC4666 timer T(beat) */}}
\DoxyCodeLine{28         \textcolor{comment}{/* This must remain the last item: */}}
\DoxyCodeLine{29         SS7\_ASP\_XUA\_TIMERS\_LEN}
\DoxyCodeLine{30 \};}
\DoxyCodeLine{31 \textcolor{keyword}{extern} \textcolor{keyword}{const} \textcolor{keyword}{struct }value\_string ss7\_asp\_xua\_timer\_names[];}
\DoxyCodeLine{32 \textcolor{keyword}{extern} \textcolor{keyword}{const} \textcolor{keyword}{struct }osmo\_tdef ss7\_asp\_xua\_timer\_defaults[SS7\_ASP\_XUA\_TIMERS\_LEN];}
\DoxyCodeLine{33 \textcolor{comment}{/* According to SUA RFC3868 Section 8, M3UA RFC4666 Section 4.3.4.1 */}}
\DoxyCodeLine{34 \textcolor{preprocessor}{\#define SS7\_ASP\_XUA\_DEFAULT\_T\_ACK\_SEC   2}}
\DoxyCodeLine{35 \textcolor{comment}{/* According to SUA RFC3868 Section 8 */}}
\DoxyCodeLine{36 \textcolor{preprocessor}{\#define SS7\_ASP\_XUA\_DEFAULT\_T\_BEAT\_SEC  30}}
\DoxyCodeLine{37 }
\DoxyCodeLine{38 \textcolor{keyword}{enum} ss7\_asp\_ctr \{}
\DoxyCodeLine{39         SS7\_ASP\_CTR\_PKT\_RX\_TOTAL,}
\DoxyCodeLine{40         SS7\_ASP\_CTR\_PKT\_RX\_UNKNOWN,}
\DoxyCodeLine{41         SS7\_ASP\_CTR\_PKT\_RX\_NI\_MISMATCH,}
\DoxyCodeLine{42         SS7\_ASP\_CTR\_PKT\_TX\_TOTAL,}
\DoxyCodeLine{43 \};}
\DoxyCodeLine{44 }
\DoxyCodeLine{45 \textcolor{keyword}{struct }osmo\_ss7\_asp \{}
\DoxyCodeLine{47         \textcolor{keyword}{struct }llist\_head list;}
\DoxyCodeLine{48         \textcolor{keyword}{struct }osmo\_ss7\_instance *inst;}
\DoxyCodeLine{49 }
\DoxyCodeLine{51         \textcolor{keyword}{struct }osmo\_fsm\_inst *fi;}
\DoxyCodeLine{52 }
\DoxyCodeLine{54         \textcolor{keyword}{struct }osmo\_xua\_server *xua\_server;}
\DoxyCodeLine{55         \textcolor{keyword}{struct }llist\_head siblings;}
\DoxyCodeLine{56 }
\DoxyCodeLine{58         \textcolor{keyword}{struct }osmo\_stream\_cli *client;}
\DoxyCodeLine{59         \textcolor{keyword}{struct }osmo\_stream\_srv *server;}
\DoxyCodeLine{61         \textcolor{keywordtype}{char} *sock\_name;}
\DoxyCodeLine{62 }
\DoxyCodeLine{63         \textcolor{comment}{/* ASP Identifier for ASP-\/UP + NTFY, as received by the peer.}}
\DoxyCodeLine{64 \textcolor{comment}{         * (In IPA ASPs it's used internally to hold 4-\/bit SLS).}}
\DoxyCodeLine{65 \textcolor{comment}{         * FIXME: This should actually be stored in a AS-\/ASP relation, since it}}
\DoxyCodeLine{66 \textcolor{comment}{         *        can be different per AS, see RFC4666 3.5.1}}
\DoxyCodeLine{67 \textcolor{comment}{         * "{}The optional ASP Identifier parameter contains a unique value that}}
\DoxyCodeLine{68 \textcolor{comment}{         *  is locally significant among the ASPs that support an AS"{}.}}
\DoxyCodeLine{69 \textcolor{comment}{         */}}
\DoxyCodeLine{70         uint32\_t remote\_asp\_id;}
\DoxyCodeLine{71         \textcolor{keywordtype}{bool} remote\_asp\_id\_present;}
\DoxyCodeLine{72 }
\DoxyCodeLine{73         \textcolor{comment}{/* Layer Manager to which we talk */}}
\DoxyCodeLine{74         \textcolor{keyword}{const} \textcolor{keyword}{struct }osmo\_xua\_layer\_manager *lm;}
\DoxyCodeLine{75         \textcolor{keywordtype}{void} *lm\_priv;}
\DoxyCodeLine{76 }
\DoxyCodeLine{78         \textcolor{keywordtype}{bool} dyn\_allocated;}
\DoxyCodeLine{79 }
\DoxyCodeLine{81         \textcolor{keywordtype}{bool} simple\_client\_allocated;}
\DoxyCodeLine{82 }
\DoxyCodeLine{84         \textcolor{keyword}{struct }rate\_ctr\_group *ctrg;}
\DoxyCodeLine{85 }
\DoxyCodeLine{87         \textcolor{keyword}{struct }msgb *pending\_msg;}
\DoxyCodeLine{88 }
\DoxyCodeLine{89         \textcolor{comment}{/* IPA proto ASP specific fields. */}}
\DoxyCodeLine{90         \textcolor{keyword}{struct }\{}
\DoxyCodeLine{91                 \textcolor{comment}{/* Incoming IPA PDUs have no SLS field, hence a potentially}}
\DoxyCodeLine{92 \textcolor{comment}{                 * unique one within AS is assigned to this ASP and applied}}
\DoxyCodeLine{93 \textcolor{comment}{                 * manually when received. */}}
\DoxyCodeLine{94                 uint8\_t sls:4;}
\DoxyCodeLine{95                 \textcolor{keywordtype}{bool} sls\_assigned;}
\DoxyCodeLine{96         \} ipa;}
\DoxyCodeLine{97 }
\DoxyCodeLine{98 \textcolor{preprocessor}{\#ifdef WITH\_TCAP\_LOADSHARING}}
\DoxyCodeLine{99         \textcolor{keyword}{struct }\{}
\DoxyCodeLine{100                 \textcolor{keywordtype}{bool} enabled;}
\DoxyCodeLine{101         \} tcap;}
\DoxyCodeLine{102 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* WITH\_TCAP\_LOADSHARING */}\textcolor{preprocessor}{}}
\DoxyCodeLine{103 }
\DoxyCodeLine{104         \textcolor{keyword}{struct }\{}
\DoxyCodeLine{105                 \textcolor{keywordtype}{char} *name;}
\DoxyCodeLine{106                 \textcolor{keywordtype}{char} *description;}
\DoxyCodeLine{107                 \textcolor{keyword}{enum} osmo\_ss7\_asp\_protocol proto;}
\DoxyCodeLine{108                 \textcolor{keyword}{enum} osmo\_ss7\_asp\_admin\_state adm\_state;}
\DoxyCodeLine{109                 \textcolor{keywordtype}{bool} is\_server;}
\DoxyCodeLine{110                 \textcolor{keyword}{enum} osmo\_ss7\_asp\_role role;}
\DoxyCodeLine{111                 \textcolor{keywordtype}{bool} role\_set\_by\_vty;}
\DoxyCodeLine{112                 \textcolor{keywordtype}{bool} trans\_role\_set\_by\_vty;}
\DoxyCodeLine{113                 \textcolor{comment}{/* Used internally by "{}asp"{} node to figure out if "{}no shutdown"{}}}
\DoxyCodeLine{114 \textcolor{comment}{                 * was done explicitly, in order to avoid automatic asp}}
\DoxyCodeLine{115 \textcolor{comment}{                 * reconfiguring/restart at go\_parent().}}
\DoxyCodeLine{116 \textcolor{comment}{                 * Can be dropped in the future once we make sure everybody uses}}
\DoxyCodeLine{117 \textcolor{comment}{                 * "{}[no] shutdown"{} explicitly in cfg files. */}}
\DoxyCodeLine{118                 \textcolor{keywordtype}{bool} explicit\_shutdown\_state\_by\_vty\_since\_node\_enter;}
\DoxyCodeLine{119 }
\DoxyCodeLine{120                 \textcolor{keyword}{struct }osmo\_ss7\_asp\_peer local;}
\DoxyCodeLine{121                 \textcolor{keyword}{struct }osmo\_ss7\_asp\_peer remote;}
\DoxyCodeLine{122                 uint8\_t qos\_class;}
\DoxyCodeLine{123                 uint32\_t quirks;}
\DoxyCodeLine{124 }
\DoxyCodeLine{125                 \textcolor{comment}{/* Whether to Tx xUA DAUD during ASP activation when in ASP role. */}}
\DoxyCodeLine{126                 \textcolor{keywordtype}{bool} daud\_act;}
\DoxyCodeLine{127 }
\DoxyCodeLine{128                 \textcolor{comment}{/* T\_defs used by the default\_lm: */}}
\DoxyCodeLine{129                 \textcolor{keyword}{struct }osmo\_tdef *T\_defs\_xua;}
\DoxyCodeLine{130 }
\DoxyCodeLine{131                 \textcolor{comment}{/* T\_defs used by the default\_lm: */}}
\DoxyCodeLine{132                 \textcolor{keyword}{struct }osmo\_tdef *T\_defs\_lm;}
\DoxyCodeLine{133 }
\DoxyCodeLine{134                 \textcolor{keyword}{struct }\{}
\DoxyCodeLine{135                         \textcolor{keywordtype}{bool} num\_ostreams\_present;}
\DoxyCodeLine{136                         \textcolor{keywordtype}{bool} max\_instreams\_present;}
\DoxyCodeLine{137                         \textcolor{keywordtype}{bool} max\_attempts\_present;}
\DoxyCodeLine{138                         \textcolor{keywordtype}{bool} max\_init\_timeo\_present;}
\DoxyCodeLine{139                         uint16\_t num\_ostreams\_value;}
\DoxyCodeLine{140                         uint16\_t max\_instreams\_value;}
\DoxyCodeLine{141                         uint16\_t max\_attempts\_value;}
\DoxyCodeLine{142                         uint16\_t max\_init\_timeo\_value; \textcolor{comment}{/* ms */}}
\DoxyCodeLine{143                 \} sctp\_init;}
\DoxyCodeLine{144 }
\DoxyCodeLine{145                 \textcolor{keyword}{struct }\{}
\DoxyCodeLine{146                         \textcolor{keywordtype}{bool} keepalive\_enable;}
\DoxyCodeLine{147                         \textcolor{keywordtype}{bool} keepalive\_time\_present;}
\DoxyCodeLine{148                         \textcolor{keywordtype}{bool} keepalive\_intvl\_present;}
\DoxyCodeLine{149                         \textcolor{keywordtype}{bool} keepalive\_probes\_present;}
\DoxyCodeLine{150                         \textcolor{keywordtype}{bool} user\_timeout\_present;}
\DoxyCodeLine{151                         \textcolor{keywordtype}{int} keepalive\_time\_value; \textcolor{comment}{/* seconds */}}
\DoxyCodeLine{152                         \textcolor{keywordtype}{int} keepalive\_intvl\_value; \textcolor{comment}{/* seconds */}}
\DoxyCodeLine{153                         \textcolor{keywordtype}{int} keepalive\_probes\_value;}
\DoxyCodeLine{154                         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} user\_timeout\_value; \textcolor{comment}{/* milliseconds */}}
\DoxyCodeLine{155                 \} tcp;}
\DoxyCodeLine{156 }
\DoxyCodeLine{158                 \textcolor{keywordtype}{int} trans\_proto;}
\DoxyCodeLine{159         \} cfg;}
\DoxyCodeLine{160 \};}
\DoxyCodeLine{161 }
\DoxyCodeLine{162 \textcolor{keyword}{struct }osmo\_ss7\_asp *ss7\_asp\_alloc(\textcolor{keyword}{struct} osmo\_ss7\_instance *inst, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name,}
\DoxyCodeLine{163                                    uint16\_t remote\_port, uint16\_t local\_port,}
\DoxyCodeLine{164                                    \textcolor{keywordtype}{int} trans\_proto, \textcolor{keyword}{enum} osmo\_ss7\_asp\_protocol proto);}
\DoxyCodeLine{165 \textcolor{keywordtype}{bool} ss7\_asp\_set\_default\_peer\_hosts(\textcolor{keyword}{struct} osmo\_ss7\_asp *asp);}
\DoxyCodeLine{166 \textcolor{keywordtype}{bool} ss7\_asp\_is\_started(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_asp *asp);}
\DoxyCodeLine{167 \textcolor{keywordtype}{int} ss7\_asp\_get\_fd(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_asp *asp);}
\DoxyCodeLine{168 \textcolor{keywordtype}{int} ss7\_asp\_disconnect\_stream(\textcolor{keyword}{struct} osmo\_ss7\_asp *asp);}
\DoxyCodeLine{169 }
\DoxyCodeLine{170 \textcolor{keywordtype}{int} ss7\_asp\_apply\_tcp\_pars(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_asp *asp);}
\DoxyCodeLine{171 \textcolor{keywordtype}{int} ss7\_asp\_apply\_peer\_primary\_address(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_asp *asp);}
\DoxyCodeLine{172 \textcolor{keywordtype}{int} ss7\_asp\_apply\_primary\_address(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_asp *asp);}
\DoxyCodeLine{173 \textcolor{keywordtype}{int} ss7\_asp\_apply\_new\_local\_address(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_asp *asp, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} loc\_idx);}
\DoxyCodeLine{174 \textcolor{keywordtype}{int} ss7\_asp\_apply\_drop\_local\_address(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_asp *asp, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} loc\_idx);}
\DoxyCodeLine{175 }
\DoxyCodeLine{176 \textcolor{keywordtype}{void} ss7\_asp\_restart\_after\_reconfigure(\textcolor{keyword}{struct} osmo\_ss7\_asp *asp);}
\DoxyCodeLine{177 \textcolor{keywordtype}{void} osmo\_ss7\_asp\_remove\_default\_lm(\textcolor{keyword}{struct} osmo\_ss7\_asp *asp);}
\DoxyCodeLine{178 }
\DoxyCodeLine{179 \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} ss7\_asp\_get\_all\_rctx(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_asp *asp, uint32\_t *rctx, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} rctx\_size,}
\DoxyCodeLine{180                                   \textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_as *excl\_as);}
\DoxyCodeLine{181 \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} ss7\_asp\_get\_all\_rctx\_be(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_asp *asp, uint32\_t *rctx, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} rctx\_size,}
\DoxyCodeLine{182                                   \textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_as *excl\_as);}
\DoxyCodeLine{183 }
\DoxyCodeLine{184 \textcolor{keywordtype}{int} ss7\_asp\_determine\_traf\_mode(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_ss7\_asp *asp);}
\DoxyCodeLine{185 }
\DoxyCodeLine{186 \textcolor{preprocessor}{\#define LOGPASP(asp, subsys, level, fmt, args ...) \(\backslash\)}}
\DoxyCodeLine{187 \textcolor{preprocessor}{        \_LOGSS7((asp)-\/>inst, subsys, level, "{}ASP(\%s) "{}} fmt, (asp)-\/>cfg.name, \#\# args)}

\end{DoxyCode}
