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