\doxysection{prim.\+h}
\label{prim_8h_source}\index{include/osmocom/core/prim.h@{include/osmocom/core/prim.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{2 }
\DoxyCodeLine{19 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{20 \textcolor{preprocessor}{\#include <osmocom/core/msgb.h>}}
\DoxyCodeLine{21 }
\DoxyCodeLine{22 \textcolor{preprocessor}{\#define OSMO\_PRIM(prim, op)     ((prim << 8) | (op \& 0xFF))}}
\DoxyCodeLine{23 \textcolor{preprocessor}{\#define OSMO\_PRIM\_HDR(oph)      OSMO\_PRIM((oph)-\/>primitive, (oph)-\/>operation)}}
\DoxyCodeLine{24 }
\DoxyCodeLine{26 \textcolor{keyword}{enum} osmo\_prim\_operation \{}
\DoxyCodeLine{27         PRIM\_OP\_REQUEST, }
\DoxyCodeLine{28         PRIM\_OP\_RESPONSE,       }
\DoxyCodeLine{29         PRIM\_OP\_INDICATION,   }
\DoxyCodeLine{30         PRIM\_OP\_CONFIRM, }
\DoxyCodeLine{31 \};}
\DoxyCodeLine{32 }
\DoxyCodeLine{33 \textcolor{keyword}{extern} \textcolor{keyword}{const} \textcolor{keyword}{struct }value\_string osmo\_prim\_op\_names[];}
\DoxyCodeLine{34 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *osmo\_prim\_operation\_name(\textcolor{keyword}{enum} osmo\_prim\_operation val)}
\DoxyCodeLine{35 \{}
\DoxyCodeLine{36         \textcolor{keywordflow}{return} get\_value\_string(osmo\_prim\_op\_names, val);}
\DoxyCodeLine{37 \}}
\DoxyCodeLine{38 }
\DoxyCodeLine{40 \textcolor{preprocessor}{\#define \_SAP\_GSM\_SHIFT  24}}
\DoxyCodeLine{41 }
\DoxyCodeLine{42 \textcolor{preprocessor}{\#define \_SAP\_GSM\_BASE   (0x01 << \_SAP\_GSM\_SHIFT)}}
\DoxyCodeLine{43 \textcolor{preprocessor}{\#define \_SAP\_TETRA\_BASE (0x02 << \_SAP\_GSM\_SHIFT)}}
\DoxyCodeLine{44 \textcolor{preprocessor}{\#define \_SAP\_SS7\_BASE   (0x03 << \_SAP\_GSM\_SHIFT)}}
\DoxyCodeLine{45 }
\DoxyCodeLine{47 \textcolor{keyword}{struct }osmo\_prim\_hdr \{}
\DoxyCodeLine{48         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} sap;    }
\DoxyCodeLine{49         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} primitive;        }
\DoxyCodeLine{50         \textcolor{keyword}{enum} osmo\_prim\_operation operation; }
\DoxyCodeLine{51         \textcolor{keyword}{struct }msgb *msg;        }
\DoxyCodeLine{58 \};}
\DoxyCodeLine{59 }
\DoxyCodeLine{67 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void}}
\DoxyCodeLine{68 osmo\_prim\_init(\textcolor{keyword}{struct} osmo\_prim\_hdr *oph, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} sap,}
\DoxyCodeLine{69                 \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} primitive, \textcolor{keyword}{enum} osmo\_prim\_operation operation,}
\DoxyCodeLine{70                 \textcolor{keyword}{struct} msgb *msg)}
\DoxyCodeLine{71 \{}
\DoxyCodeLine{72         oph-\/>sap = sap;}
\DoxyCodeLine{73         oph-\/>primitive = primitive;}
\DoxyCodeLine{74         oph-\/>operation = operation;}
\DoxyCodeLine{75         oph-\/>msg = msg;}
\DoxyCodeLine{76 \}}
\DoxyCodeLine{77 }
\DoxyCodeLine{79 \textcolor{keyword}{typedef} int (*osmo\_prim\_cb)(\textcolor{keyword}{struct }osmo\_prim\_hdr *oph, \textcolor{keywordtype}{void} *ctx);}
\DoxyCodeLine{80 }
\DoxyCodeLine{83 \textcolor{preprocessor}{\#define OSMO\_NO\_EVENT   0xFFFFFFFF}}
\DoxyCodeLine{84 }
\DoxyCodeLine{86 \textcolor{keyword}{struct }osmo\_prim\_event\_map \{}
\DoxyCodeLine{87         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} sap;    }
\DoxyCodeLine{88         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} primitive;        }
\DoxyCodeLine{89         \textcolor{keyword}{enum} osmo\_prim\_operation operation; }
\DoxyCodeLine{90         uint32\_t event;            }
\DoxyCodeLine{91 \};}
\DoxyCodeLine{92 }
\DoxyCodeLine{93 uint32\_t osmo\_event\_for\_prim(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_prim\_hdr *oph,}
\DoxyCodeLine{94                              \textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_prim\_event\_map *maps);}

\end{DoxyCode}
