blob: e892c62caf76f7ded5ead322a8692f3aeea4fd90 [file] [log] [blame]
Harald Welte9b21e882011-06-23 14:14:20 +02001#ifndef OSMO_PRIMITIVE_H
2#define OSMO_PRIMITIVE_H
3
4#include <stdint.h>
Harald Welte5e924a32011-06-23 15:04:47 +02005#include <osmocom/core/msgb.h>
Harald Welte9b21e882011-06-23 14:14:20 +02006
7enum osmo_prim_operation {
8 PRIM_OP_REQUEST,
9 PRIM_OP_RESPONSE,
10 PRIM_OP_INDICATION,
11 PRIM_OP_CONFIRM,
12};
13
Harald Welte5e924a32011-06-23 15:04:47 +020014#define _SAP_GSM_SHIFT 24
15
16#define _SAP_GSM_BASE (0x01 << _SAP_GSM_SHIFT)
17#define _SAP_TETRA_BASE (0x02 << _SAP_GSM_SHIFT)
18
Harald Welte9b21e882011-06-23 14:14:20 +020019struct osmo_prim_hdr {
20 unsigned int sap;
21 unsigned int primitive;
22 enum osmo_prim_operation operation;
23 struct msgb *msg; /* message containing associated data */
24};
25
Harald Welte5e924a32011-06-23 15:04:47 +020026static inline void
27osmo_prim_init(struct osmo_prim_hdr *oph, unsigned int sap,
28 unsigned int primitive, enum osmo_prim_operation operation,
29 struct msgb *msg)
30{
31 oph->sap = sap;
32 oph->primitive = primitive;
33 oph->operation = operation;
34 oph->msg = msg;
35}
36
37typedef int (*osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx);
Harald Welte9b21e882011-06-23 14:14:20 +020038#endif