libosmocore
0.9.6-13.20170220git32ee5af8.fc33
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
16
enum
osmo_prim_operation
{
17
PRIM_OP_REQUEST
,
18
PRIM_OP_RESPONSE
,
19
PRIM_OP_INDICATION
,
20
PRIM_OP_CONFIRM
,
21
};
22
23
extern
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
32
struct
osmo_prim_hdr
{
33
unsigned
int
sap
;
34
unsigned
int
primitive
;
35
enum
osmo_prim_operation
operation;
36
struct
msgb
*
msg
;
37
};
38
46
static
inline
void
47
osmo_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
58
typedef
int (*
osmo_prim_cb
)(
struct
osmo_prim_hdr
*oph,
void
*ctx);
59
osmo_prim_cb
int(* osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx)
primitive handler callback type
Definition:
prim.h:58
osmo_prim_operation
osmo_prim_operation
primitive operation
Definition:
prim.h:16
osmo_prim_hdr
primitive header
Definition:
prim.h:32
osmo_prim_init
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
@ PRIM_OP_INDICATION
indication
Definition:
prim.h:19
PRIM_OP_REQUEST
@ PRIM_OP_REQUEST
request
Definition:
prim.h:17
msgb
Osmocom message buffer.
Definition:
msgb.h:43
osmo_prim_hdr::msg
struct msgb * msg
Primitive Operation.
Definition:
prim.h:36
osmo_prim_op_names
const struct value_string osmo_prim_op_names[5]
human-readable string mapping for osmo_prim_operation
Definition:
prim.c:6
msgb.h
Osmocom message buffers The Osmocom message buffers are modelled after the 'struct skb' inside the Li...
value_string
A mapping between human-readable string and numeric value.
Definition:
utils.h:27
osmo_prim_hdr::primitive
unsigned int primitive
Primitive number.
Definition:
prim.h:34
PRIM_OP_CONFIRM
@ PRIM_OP_CONFIRM
confirm
Definition:
prim.h:20
osmo_prim_hdr::sap
unsigned int sap
Service Access Point.
Definition:
prim.h:33
PRIM_OP_RESPONSE
@ PRIM_OP_RESPONSE
response
Definition:
prim.h:18
include
osmocom
core
prim.h
Generated on Thu Feb 27 2020 00:00:00 for libosmocore by
1.8.17