summaryrefslogtreecommitdiffstats
path: root/include/osmocom/core
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-06-23 15:04:47 +0200
committerHarald Welte <laforge@gnumonks.org>2011-06-23 15:04:47 +0200
commit5e924a31a0b6c73f297a61a1e4cb8b40b6f2946c (patch)
treef9ca1e02e196e2a7e0b556fa45fbd95bfbbd0904 /include/osmocom/core
parent9b21e88367eea8cdf200cf06fae99dec06e712a7 (diff)
introduce GSM primitive definitions
The idea here is to use the osmocom core primitive code ot abstract out primitives for inter-layer comunication in GSM.
Diffstat (limited to 'include/osmocom/core')
-rw-r--r--include/osmocom/core/prim.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/osmocom/core/prim.h b/include/osmocom/core/prim.h
index 5494f3c3..e892c62c 100644
--- a/include/osmocom/core/prim.h
+++ b/include/osmocom/core/prim.h
@@ -2,6 +2,7 @@
#define OSMO_PRIMITIVE_H
#include <stdint.h>
+#include <osmocom/core/msgb.h>
enum osmo_prim_operation {
PRIM_OP_REQUEST,
@@ -10,6 +11,11 @@ enum osmo_prim_operation {
PRIM_OP_CONFIRM,
};
+#define _SAP_GSM_SHIFT 24
+
+#define _SAP_GSM_BASE (0x01 << _SAP_GSM_SHIFT)
+#define _SAP_TETRA_BASE (0x02 << _SAP_GSM_SHIFT)
+
struct osmo_prim_hdr {
unsigned int sap;
unsigned int primitive;
@@ -17,4 +23,16 @@ struct osmo_prim_hdr {
struct msgb *msg; /* message containing associated data */
};
+static inline void
+osmo_prim_init(struct osmo_prim_hdr *oph, unsigned int sap,
+ unsigned int primitive, enum osmo_prim_operation operation,
+ struct msgb *msg)
+{
+ oph->sap = sap;
+ oph->primitive = primitive;
+ oph->operation = operation;
+ oph->msg = msg;
+}
+
+typedef int (*osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx);
#endif