\doxysection{lapdm.\+h}
\label{lapdm_8h_source}\index{include/osmocom/gsm/lapdm.h@{include/osmocom/gsm/lapdm.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 <osmocom/gsm/l1sap.h>}}
\DoxyCodeLine{4 \textcolor{preprocessor}{\#include <osmocom/gsm/gsm\_utils.h>}}
\DoxyCodeLine{5 \textcolor{preprocessor}{\#include <osmocom/gsm/lapd\_core.h>}}
\DoxyCodeLine{6 }
\DoxyCodeLine{12 \textcolor{keyword}{enum} lapdm\_mode \{}
\DoxyCodeLine{13         LAPDM\_MODE\_MS,             }
\DoxyCodeLine{14         LAPDM\_MODE\_BTS,           }
\DoxyCodeLine{15 \};}
\DoxyCodeLine{16 }
\DoxyCodeLine{17 \textcolor{keyword}{struct }lapdm\_entity;}
\DoxyCodeLine{18 }
\DoxyCodeLine{20 \textcolor{keyword}{struct }lapdm\_msg\_ctx \{}
\DoxyCodeLine{21         \textcolor{keyword}{struct }lapdm\_datalink *dl;}
\DoxyCodeLine{22         \textcolor{keywordtype}{int} lapdm\_fmt;}
\DoxyCodeLine{23         uint8\_t chan\_nr;}
\DoxyCodeLine{24         uint8\_t link\_id;}
\DoxyCodeLine{25         uint8\_t ta\_ind;           \textcolor{comment}{/* TA indicated by network */}}
\DoxyCodeLine{26         uint8\_t tx\_power\_ind;       \textcolor{comment}{/* MS power indicated by network */}}
\DoxyCodeLine{27         uint32\_t fn;}
\DoxyCodeLine{28 \};}
\DoxyCodeLine{29 }
\DoxyCodeLine{31 \textcolor{keyword}{struct }lapdm\_datalink \{}
\DoxyCodeLine{32         \textcolor{keyword}{struct }lapd\_datalink dl; \textcolor{comment}{/* common LAPD */}}
\DoxyCodeLine{33         \textcolor{keyword}{struct }lapdm\_msg\_ctx mctx; }
\DoxyCodeLine{35         \textcolor{keyword}{struct }lapdm\_entity *entity; }
\DoxyCodeLine{37         \textcolor{keyword}{struct }llist\_head tx\_ui\_queue; }
\DoxyCodeLine{38         uint32\_t t200\_fn;        }
\DoxyCodeLine{39         uint32\_t t200\_timeout;      }
\DoxyCodeLine{40 \};}
\DoxyCodeLine{41 }
\DoxyCodeLine{43 \textcolor{keyword}{enum} lapdm\_dl\_sapi \{}
\DoxyCodeLine{44         DL\_SAPI0        = 0,    }
\DoxyCodeLine{45         DL\_SAPI3        = 1,    }
\DoxyCodeLine{46         \_NR\_DL\_SAPI}
\DoxyCodeLine{47 \};}
\DoxyCodeLine{48 }
\DoxyCodeLine{49 \textcolor{keyword}{typedef} int (*lapdm\_cb\_t)(\textcolor{keyword}{struct }msgb *msg, \textcolor{keyword}{struct }lapdm\_entity *le, \textcolor{keywordtype}{void} *ctx);}
\DoxyCodeLine{50 }
\DoxyCodeLine{51 \textcolor{preprocessor}{\#define LAPDM\_ENT\_F\_EMPTY\_FRAME         0x0001}}
\DoxyCodeLine{52 \textcolor{preprocessor}{\#define LAPDM\_ENT\_F\_POLLING\_ONLY        0x0002}}
\DoxyCodeLine{53 \textcolor{preprocessor}{\#define LAPDM\_ENT\_F\_DROP\_2ND\_REJ        0x0004}}
\DoxyCodeLine{54 \textcolor{preprocessor}{\#define LAPDM\_ENT\_F\_RTS                 0x0008}}
\DoxyCodeLine{55 }
\DoxyCodeLine{57 \textcolor{keyword}{struct }lapdm\_entity \{}
\DoxyCodeLine{59         \textcolor{keyword}{struct }lapdm\_datalink datalink[\_NR\_DL\_SAPI];}
\DoxyCodeLine{60         \textcolor{keywordtype}{int} last\_tx\_dequeue; }
\DoxyCodeLine{61         \textcolor{keywordtype}{int} tx\_pending; }
\DoxyCodeLine{62         \textcolor{keyword}{enum} lapdm\_mode mode; }
\DoxyCodeLine{63         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} flags;}
\DoxyCodeLine{64 }
\DoxyCodeLine{65         \textcolor{keywordtype}{void} *l1\_ctx;     }
\DoxyCodeLine{66         \textcolor{keywordtype}{void} *l3\_ctx;     }
\DoxyCodeLine{68         osmo\_prim\_cb l1\_prim\_cb;}
\DoxyCodeLine{69         lapdm\_cb\_t l3\_cb;        }
\DoxyCodeLine{72         \textcolor{keyword}{struct }lapdm\_channel *lapdm\_ch;}
\DoxyCodeLine{73 }
\DoxyCodeLine{74         uint8\_t ta;           \textcolor{comment}{/* TA used and indicated to network */}}
\DoxyCodeLine{75         uint8\_t tx\_power;       \textcolor{comment}{/* MS power used and indicated to network */}}
\DoxyCodeLine{76 \};}
\DoxyCodeLine{77 }
\DoxyCodeLine{79 \textcolor{keyword}{struct }lapdm\_channel \{}
\DoxyCodeLine{80         \textcolor{keyword}{struct }llist\_head list;           }
\DoxyCodeLine{81         \textcolor{keywordtype}{char} *name;                 }
\DoxyCodeLine{82         \textcolor{keyword}{struct }lapdm\_entity lapdm\_acch;   }
\DoxyCodeLine{83         \textcolor{keyword}{struct }lapdm\_entity lapdm\_dcch;   }
\DoxyCodeLine{84 \};}
\DoxyCodeLine{85 }
\DoxyCodeLine{86 \textcolor{keyword}{const} \textcolor{keywordtype}{char} *get\_rsl\_name(\textcolor{keywordtype}{int} value);}
\DoxyCodeLine{87 \textcolor{keyword}{extern} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *lapdm\_state\_names[];}
\DoxyCodeLine{88 }
\DoxyCodeLine{89 \textcolor{keyword}{struct }lapdm\_datalink *lapdm\_datalink\_for\_sapi(\textcolor{keyword}{struct} lapdm\_entity *le, uint8\_t sapi);}
\DoxyCodeLine{90 }
\DoxyCodeLine{91 \textcolor{comment}{/* initialize a LAPDm entity */}}
\DoxyCodeLine{92 \textcolor{keywordtype}{void} lapdm\_entity\_init(\textcolor{keyword}{struct} lapdm\_entity *le, \textcolor{keyword}{enum} lapdm\_mode mode, \textcolor{keywordtype}{int} t200)}
\DoxyCodeLine{93         OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Use lapdm\_entity\_init3() instead"{}});}
\DoxyCodeLine{94 \textcolor{keywordtype}{void} lapdm\_entity\_init2(\textcolor{keyword}{struct} lapdm\_entity *le, \textcolor{keyword}{enum} lapdm\_mode mode,}
\DoxyCodeLine{95                         \textcolor{keyword}{const} \textcolor{keywordtype}{int} *t200\_ms, \textcolor{keywordtype}{int} n200)}
\DoxyCodeLine{96         OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Use lapdm\_entity\_init3() instead"{}});}
\DoxyCodeLine{97 \textcolor{keywordtype}{void} lapdm\_entity\_init3(\textcolor{keyword}{struct} lapdm\_entity *le, \textcolor{keyword}{enum} lapdm\_mode mode,}
\DoxyCodeLine{98                         \textcolor{keyword}{const} \textcolor{keywordtype}{int} *t200\_ms, \textcolor{keywordtype}{int} n200, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name\_pfx);}
\DoxyCodeLine{99 \textcolor{keywordtype}{void} lapdm\_channel\_init(\textcolor{keyword}{struct} lapdm\_channel *lc, \textcolor{keyword}{enum} lapdm\_mode mode)}
\DoxyCodeLine{100         OSMO\_DEPRECATED\_OUTSIDE(\textcolor{stringliteral}{"{}Use lapdm\_channel\_init3() instead"{}});}
\DoxyCodeLine{101 \textcolor{keywordtype}{int} lapdm\_channel\_init2(\textcolor{keyword}{struct} lapdm\_channel *lc, \textcolor{keyword}{enum} lapdm\_mode mode,}
\DoxyCodeLine{102                         \textcolor{keyword}{const} \textcolor{keywordtype}{int} *t200\_ms\_dcch, \textcolor{keyword}{const} \textcolor{keywordtype}{int} *t200\_ms\_acch, \textcolor{keyword}{enum} gsm\_chan\_t chan\_t);}
\DoxyCodeLine{103 \textcolor{keywordtype}{int} lapdm\_channel\_init3(\textcolor{keyword}{struct} lapdm\_channel *lc, \textcolor{keyword}{enum} lapdm\_mode mode,}
\DoxyCodeLine{104                         \textcolor{keyword}{const} \textcolor{keywordtype}{int} *t200\_ms\_dcch, \textcolor{keyword}{const} \textcolor{keywordtype}{int} *t200\_ms\_acch, \textcolor{keyword}{enum} gsm\_chan\_t chan\_t,}
\DoxyCodeLine{105                         \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name\_pfx);}
\DoxyCodeLine{106 \textcolor{comment}{/* deinitialize a LAPDm entity */}}
\DoxyCodeLine{107 \textcolor{keywordtype}{void} lapdm\_entity\_exit(\textcolor{keyword}{struct} lapdm\_entity *le);}
\DoxyCodeLine{108 \textcolor{keywordtype}{void} lapdm\_channel\_exit(\textcolor{keyword}{struct} lapdm\_channel *lc);}
\DoxyCodeLine{109 }
\DoxyCodeLine{110 \textcolor{comment}{/* input into layer2 (from layer 1) */}}
\DoxyCodeLine{111 \textcolor{keywordtype}{int} lapdm\_phsap\_up(\textcolor{keyword}{struct} osmo\_prim\_hdr *oph, \textcolor{keyword}{struct} lapdm\_entity *le);}
\DoxyCodeLine{112 }
\DoxyCodeLine{113 \textcolor{comment}{/* input into layer2 (from layer 3) */}}
\DoxyCodeLine{114 \textcolor{keywordtype}{int} lapdm\_rslms\_recvmsg(\textcolor{keyword}{struct} msgb *msg, \textcolor{keyword}{struct} lapdm\_channel *lc);}
\DoxyCodeLine{115 }
\DoxyCodeLine{116 \textcolor{keywordtype}{void} lapdm\_channel\_set\_l3(\textcolor{keyword}{struct} lapdm\_channel *lc, lapdm\_cb\_t cb, \textcolor{keywordtype}{void} *ctx);}
\DoxyCodeLine{117 \textcolor{keywordtype}{void} lapdm\_channel\_set\_l1(\textcolor{keyword}{struct} lapdm\_channel *lc, osmo\_prim\_cb cb, \textcolor{keywordtype}{void} *ctx);}
\DoxyCodeLine{118 }
\DoxyCodeLine{119 \textcolor{keywordtype}{int} lapdm\_entity\_set\_mode(\textcolor{keyword}{struct} lapdm\_entity *le, \textcolor{keyword}{enum} lapdm\_mode mode);}
\DoxyCodeLine{120 \textcolor{keywordtype}{int} lapdm\_channel\_set\_mode(\textcolor{keyword}{struct} lapdm\_channel *lc, \textcolor{keyword}{enum} lapdm\_mode mode);}
\DoxyCodeLine{121 }
\DoxyCodeLine{122 \textcolor{keywordtype}{void} lapdm\_entity\_reset(\textcolor{keyword}{struct} lapdm\_entity *le);}
\DoxyCodeLine{123 \textcolor{keywordtype}{void} lapdm\_channel\_reset(\textcolor{keyword}{struct} lapdm\_channel *lc);}
\DoxyCodeLine{124 }
\DoxyCodeLine{125 \textcolor{keywordtype}{void} lapdm\_entity\_set\_flags(\textcolor{keyword}{struct} lapdm\_entity *le, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} flags);}
\DoxyCodeLine{126 \textcolor{keywordtype}{void} lapdm\_channel\_set\_flags(\textcolor{keyword}{struct} lapdm\_channel *lc, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} flags);}
\DoxyCodeLine{127 }
\DoxyCodeLine{128 \textcolor{keywordtype}{void} lapdm\_entity\_set\_t200\_fn(\textcolor{keyword}{struct} lapdm\_entity *le, \textcolor{keyword}{const} uint32\_t *t200\_fn);}
\DoxyCodeLine{129 \textcolor{keywordtype}{void} lapdm\_channel\_set\_t200\_fn(\textcolor{keyword}{struct} lapdm\_channel *lc, \textcolor{keyword}{const} uint32\_t *t200\_fn\_dcch, \textcolor{keyword}{const} uint32\_t *t200\_fn\_acch);}
\DoxyCodeLine{130 }
\DoxyCodeLine{131 \textcolor{keywordtype}{int} lapdm\_phsap\_dequeue\_prim(\textcolor{keyword}{struct} lapdm\_entity *le, \textcolor{keyword}{struct} osmo\_phsap\_prim *pp);}
\DoxyCodeLine{132 \textcolor{keywordtype}{int} lapdm\_phsap\_dequeue\_prim\_fn(\textcolor{keyword}{struct} lapdm\_entity *le, \textcolor{keyword}{struct} osmo\_phsap\_prim *pp, uint32\_t fn);}
\DoxyCodeLine{133 \textcolor{keywordtype}{void} lapdm\_t200\_fn(\textcolor{keyword}{struct} lapdm\_entity *le, uint32\_t fn);}
\DoxyCodeLine{134 }

\end{DoxyCode}
