libosmocore 0.9.6-23.20170220git32ee5af8.fc42
Osmocom core library
Loading...
Searching...
No Matches
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
22
23extern const struct value_string osmo_prim_op_names[5];
24
25#define _SAP_GSM_SHIFT 24
26
27#define _SAP_GSM_BASE (0x01 << _SAP_GSM_SHIFT)
28#define _SAP_TETRA_BASE (0x02 << _SAP_GSM_SHIFT)
29#define _SAP_SS7_BASE (0x03 << _SAP_GSM_SHIFT)
30
33 unsigned int sap;
34 unsigned int primitive;
35 enum osmo_prim_operation operation;
36 struct msgb *msg;
37};
38
46static inline void
47osmo_prim_init(struct osmo_prim_hdr *oph, unsigned int sap,
48 unsigned int primitive, enum osmo_prim_operation operation,
49 struct msgb *msg)
50{
51 oph->sap = sap;
52 oph->primitive = primitive;
53 oph->operation = operation;
54 oph->msg = msg;
55}
56
58typedef int (*osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx);
59
osmo_prim_operation
primitive operation
Definition prim.h:16
const struct value_string osmo_prim_op_names[5]
human-readable string mapping for osmo_prim_operation
Definition prim.c:6
int(* osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx)
primitive handler callback type
Definition prim.h:58
static void osmo_prim_init(struct osmo_prim_hdr *oph, unsigned int sap, unsigned int primitive, enum osmo_prim_operation operation, struct msgb *msg)
initialize a primitive header
Definition prim.h:47
@ PRIM_OP_INDICATION
indication
Definition prim.h:19
@ PRIM_OP_CONFIRM
confirm
Definition prim.h:20
@ PRIM_OP_REQUEST
request
Definition prim.h:17
@ PRIM_OP_RESPONSE
response
Definition prim.h:18
Osmocom message buffers The Osmocom message buffers are modelled after the 'struct skb' inside the Li...
Osmocom message buffer.
Definition msgb.h:43
primitive header
Definition prim.h:32
struct msgb * msg
Primitive Operation.
Definition prim.h:36
unsigned int primitive
Primitive number.
Definition prim.h:34
unsigned int sap
Service Access Point.
Definition prim.h:33
A mapping between human-readable string and numeric value.
Definition utils.h:27