prim.h
Go to the documentation of this file.
#pragma once
#include <stdint.h>
#include <osmocom/core/msgb.h>
#define OSMO_PRIM(prim, op) ((prim << 8) | (op & 0xFF))
#define OSMO_PRIM_HDR(oph) OSMO_PRIM((oph)->primitive, (oph)->operation)
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;
};
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);
PRIM_OP_CONFIRM
cofirm
Definition: prim.h:20
PRIM_OP_RESPONSE
response
Definition: prim.h:18
msgb
Osmocom message buffer.
Definition: msgb.h:42
PRIM_OP_REQUEST
request
Definition: prim.h:17
PRIM_OP_INDICATION
indication
Definition: prim.h:19
msgb.h
Osmocom message buffers The Osmocom message buffers are modelled after the &#39;struct skb&#39; inside the Li...
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:44
osmo_prim_hdr::primitive
unsigned int primitive
Primitive number.
Definition: prim.h:31
osmo_prim_hdr::sap
unsigned int sap
Service Access Point.
Definition: prim.h:30
osmo_prim_operation
osmo_prim_operation
primitive operation
Definition: prim.h:16
osmo_prim_cb
int(* osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx)
primitive handler callback type
Definition: prim.h:55
osmo_prim_hdr
primitive header
Definition: prim.h:29
osmo_prim_hdr::msg
struct msgb * msg
Primitive Operation.
Definition: prim.h:33