blob: 3f48b5bf9d2cec8cdb2ef4bd8ee122344be22fbe [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file gprs_msgb.h */
2
Sylvain Munaut12ba7782014-06-16 10:13:40 +02003#pragma once
Harald Welte605ac5d2012-06-16 16:09:52 +08004
5#include <stdint.h>
Harald Welte79f92702019-02-23 14:38:23 +01006/*! the data structure stored in msgb->cb for libgb apps */
Harald Welte605ac5d2012-06-16 16:09:52 +08007struct libgb_msgb_cb {
8 unsigned char *bssgph;
9 unsigned char *llch;
10
Harald Welte79f92702019-02-23 14:38:23 +010011 /*! Cell Identifier */
Harald Welte605ac5d2012-06-16 16:09:52 +080012 unsigned char *bssgp_cell_id;
13
Harald Welte79f92702019-02-23 14:38:23 +010014 /*! Identifiers of a BTS, equal to 'struct bssgp_bts_ctx' */
Harald Welte605ac5d2012-06-16 16:09:52 +080015 uint16_t nsei;
16 uint16_t bvci;
17
Harald Welte79f92702019-02-23 14:38:23 +010018 /*! Identifier of a MS (inside BTS), equal to 'struct sgsn_mm_ctx' */
Harald Welte605ac5d2012-06-16 16:09:52 +080019 uint32_t tlli;
Jacob Erlbeck42e0dc02013-10-08 12:04:41 +020020} __attribute__((packed, may_alias));
Harald Welte605ac5d2012-06-16 16:09:52 +080021#define LIBGB_MSGB_CB(__msgb) ((struct libgb_msgb_cb *)&((__msgb)->cb[0]))
22#define msgb_tlli(__x) LIBGB_MSGB_CB(__x)->tlli
23#define msgb_nsei(__x) LIBGB_MSGB_CB(__x)->nsei
24#define msgb_bvci(__x) LIBGB_MSGB_CB(__x)->bvci
25#define msgb_gmmh(__x) (__x)->l3h
26#define msgb_bssgph(__x) LIBGB_MSGB_CB(__x)->bssgph
27#define msgb_bssgp_len(__x) ((__x)->tail - (uint8_t *)msgb_bssgph(__x))
28#define msgb_bcid(__x) LIBGB_MSGB_CB(__x)->bssgp_cell_id
29#define msgb_llch(__x) LIBGB_MSGB_CB(__x)->llch
30
Harald Welte8eda90d2012-06-17 12:58:46 +080031#include <osmocom/core/logging.h>
32int gprs_log_filter_fn(const struct log_context *ctx,
33 struct log_target *tar);