summaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/prim.h
blob: e892c62caf76f7ded5ead322a8692f3aeea4fd90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef OSMO_PRIMITIVE_H
#define OSMO_PRIMITIVE_H

#include <stdint.h>
#include <osmocom/core/msgb.h>

enum osmo_prim_operation {
	PRIM_OP_REQUEST,
	PRIM_OP_RESPONSE,
	PRIM_OP_INDICATION,
	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;
	enum osmo_prim_operation operation;
	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