libosmocore  0.9.3
Osmocom core library
prim.h
Go to the documentation of this file.
1 #pragma once
2 
9 #include <stdint.h>
10 #include <osmocom/core/msgb.h>
11 
12 #define OSMO_PRIM(prim, op) ((prim << 8) | (op & 0xFF))
13 #define OSMO_PRIM_HDR(oph) OSMO_PRIM((oph)->primitive, (oph)->operation)
14 
21 };
22 
23 #define _SAP_GSM_SHIFT 24
24 
25 #define _SAP_GSM_BASE (0x01 << _SAP_GSM_SHIFT)
26 #define _SAP_TETRA_BASE (0x02 << _SAP_GSM_SHIFT)
27 
29 struct osmo_prim_hdr {
30  unsigned int sap;
31  unsigned int primitive;
32  enum osmo_prim_operation operation;
33  struct msgb *msg;
34 };
35 
43 static inline void
44 osmo_prim_init(struct osmo_prim_hdr *oph, unsigned int sap,
45  unsigned int primitive, enum osmo_prim_operation operation,
46  struct msgb *msg)
47 {
48  oph->sap = sap;
49  oph->primitive = primitive;
50  oph->operation = operation;
51  oph->msg = msg;
52 }
53 
55 typedef int (*osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx);
56