libosmocore 1.13.1.1-afb4 Osmocom core library

Files | Data Structures | Functions | Variables
GSMTAP

GSMTAP utility routines. More...

## Files
file | gsmtap_util.h
file | gsmtap_util.c
| GSMTAP support code in libosmocore.

## Data Structures
struct | gsmtap_inst
| one gsmtap instance More...

## Functions
uint8_t | chantype_rsl2gsmtap2 (uint8_t rsl_chantype, uint8_t link_id, bool user_plane)
| convert RSL channel number to GSMTAP channel type More...
uint8_t | chantype_rsl2gsmtap (uint8_t rsl_chantype, uint8_t link_id)
| convert RSL channel number to GSMTAP channel type More...
void | chantype_gsmtap2rsl (uint8_t gsmtap_chantype, uint8_t *rsl_chantype, uint8_t *link_id)
| convert GSMTAP channel type to RSL channel number + Link ID More...
struct msgb * | gsmtap_makemsg_ex (uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn, int8_t signal_dbm, int8_t snr, const uint8_t *data, unsigned int len)
| create an arbitrary type GSMTAP message More...
struct msgb * | gsmtap_makemsg (uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn, int8_t signal_dbm, int8_t snr, const uint8_t *data, unsigned int len)
| create L1/L2 data and put it into GSMTAP More...
int | gsmtap_inst_fd (struct gsmtap_inst *gti)
| Deprecated, use gsmtap_inst_fd2() instead. More...
int | gsmtap_inst_fd2 (const struct gsmtap_inst *gti)
| obtain the file descriptor associated with a gsmtap instance More...
int | gsmtap_source_init_fd (const char *host, uint16_t port)
int | gsmtap_source_init_fd2 (const char *local_host, uint16_t local_port, const char *rem_host, uint16_t rem_port)
int | gsmtap_source_add_sink_fd (int gsmtap_fd)
struct gsmtap_inst * | gsmtap_source_init (const char *host, uint16_t port, int ofd_wq_mode)
struct gsmtap_inst * | gsmtap_source_init2 (const char *local_host, uint16_t local_port, const char *rem_host, uint16_t rem_port, int ofd_wq_mode)
void | gsmtap_source_free (struct gsmtap_inst *gti)
int | gsmtap_source_set_nonblock (struct gsmtap_inst *gti, int on)
int | gsmtap_source_add_sink (struct gsmtap_inst *gti)
bool | gsmtap_source_using_wq (const struct gsmtap_inst *gti)
int | gsmtap_sendmsg (struct gsmtap_inst *gti, struct msgb *msg)
int | gsmtap_sendmsg_free (struct gsmtap_inst *gti, struct msgb *msg)
int | gsmtap_send_ex (struct gsmtap_inst *gti, uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn, int8_t signal_dbm, int8_t snr, const uint8_t *data, unsigned int len)
int | gsmtap_send (struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn, int8_t signal_dbm, int8_t snr, const uint8_t *data, unsigned int len)

## Variables
const struct value_string | gsmtap_gsm_channel_names []
const struct value_string | gsmtap_type_names []
const struct value_string | gsmtap_gsm_channel_names []
const struct value_string | gsmtap_type_names []

## Detailed Description

GSMTAP utility routines.

Encapsulates GSM messages over UDP.

## Function Documentation

## ◆ chantype_gsmtap2rsl()

void chantype_gsmtap2rsl | ( | uint8_t | gsmtap_chantype,
|  | uint8_t * | rsl_chantype,
|  | uint8_t * | link_id
| ) |  |

convert GSMTAP channel type to RSL channel number + Link ID

Parameters

  [in] | gsmtap_chantype | GSMTAP channel type
  [out] | rsl_chantype | RSL channel mumber
  [out] | link_id | RSL link identifier

References GSMTAP_CHANNEL_ACCH, GSMTAP_CHANNEL_AGCH, GSMTAP_CHANNEL_BCCH, GSMTAP_CHANNEL_FACCH_F, GSMTAP_CHANNEL_FACCH_H, GSMTAP_CHANNEL_PCH, GSMTAP_CHANNEL_PDCH, GSMTAP_CHANNEL_RACH, GSMTAP_CHANNEL_SDCCH4, GSMTAP_CHANNEL_SDCCH8, GSMTAP_CHANNEL_VOICE_F, GSMTAP_CHANNEL_VOICE_H, link_id, RSL_CHAN_BCCH, RSL_CHAN_Bm_ACCHs, RSL_CHAN_Lm_ACCHs, RSL_CHAN_OSMO_PDCH, RSL_CHAN_PCH_AGCH, RSL_CHAN_RACH, RSL_CHAN_SDCCH4_ACCH, and RSL_CHAN_SDCCH8_ACCH.

## ◆ chantype_rsl2gsmtap()

uint8_t chantype_rsl2gsmtap | ( | uint8_t | rsl_chantype,
|  | uint8_t | link_id
| ) |  |

convert RSL channel number to GSMTAP channel type

Parameters

  [in] | rsl_chantype | RSL channel type
  [in] | link_id | RSL link identifier

Returns
  GSMTAP channel type

References chantype_rsl2gsmtap2(), and link_id.

## ◆ chantype_rsl2gsmtap2()

uint8_t chantype_rsl2gsmtap2 | ( | uint8_t | rsl_chantype,
|  | uint8_t | link_id,
|  | bool | user_plane
| ) |  |

convert RSL channel number to GSMTAP channel type

Parameters

  [in] | rsl_chantype | RSL channel type
  [in] | link_id | RSL link identifier
  [in] | user_plane | Is this voice/csd user plane (1) or signaling (0)

Returns
  GSMTAP channel type

References GSMTAP_CHANNEL_ACCH, GSMTAP_CHANNEL_BCCH, GSMTAP_CHANNEL_CBCH51, GSMTAP_CHANNEL_CBCH52, GSMTAP_CHANNEL_FACCH_F, GSMTAP_CHANNEL_FACCH_H, GSMTAP_CHANNEL_PCH, GSMTAP_CHANNEL_PDCH, GSMTAP_CHANNEL_RACH, GSMTAP_CHANNEL_SDCCH4, GSMTAP_CHANNEL_SDCCH8, GSMTAP_CHANNEL_UNKNOWN, GSMTAP_CHANNEL_VOICE_F, GSMTAP_CHANNEL_VOICE_H, link_id, RSL_CHAN_BCCH, RSL_CHAN_Bm_ACCHs, RSL_CHAN_Lm_ACCHs, RSL_CHAN_OSMO_CBCH4, RSL_CHAN_OSMO_CBCH8, RSL_CHAN_OSMO_PDCH, RSL_CHAN_OSMO_VAMOS_Bm_ACCHs, RSL_CHAN_OSMO_VAMOS_Lm_ACCHs, RSL_CHAN_PCH_AGCH, RSL_CHAN_RACH, RSL_CHAN_SDCCH4_ACCH, and RSL_CHAN_SDCCH8_ACCH.

Referenced by chantype_rsl2gsmtap().

## ◆ gsmtap_inst_fd()

int gsmtap_inst_fd | ( | struct gsmtap_inst * | gti | ) |

Deprecated, use gsmtap_inst_fd2() instead.

Parameters

  [in] | gti | GSMTAP instance

Returns
  file descriptor of GSMTAP instance

References gsmtap_inst_fd2().

## ◆ gsmtap_inst_fd2()

int gsmtap_inst_fd2 | ( | const struct gsmtap_inst * | gti | ) |

obtain the file descriptor associated with a gsmtap instance

Parameters

  [in] | gti | GSMTAP instance

Returns
  file descriptor of GSMTAP instance

References gsmtap_inst::source_fd.

Referenced by gsmtap_inst_fd().

## ◆ gsmtap_makemsg()

struct msgb * gsmtap_makemsg | ( | uint16_t | arfcn,
|  | uint8_t | ts,
|  | uint8_t | chan_type,
|  | uint8_t | ss,
|  | uint32_t | fn,
|  | int8_t | signal_dbm,
|  | int8_t | snr,
|  | const uint8_t * | data,
|  | unsigned int | len
| ) |  |

create L1/L2 data and put it into GSMTAP

Parameters

  [in] | arfcn | GSM ARFCN (Channel Number)
  [in] | ts | GSM time slot
  [in] | chan_type | Channel Type
  [in] | ss | Sub-slot
  [in] | fn | GSM Frame Number
  [in] | signal_dbm | Signal Strength (dBm)
  [in] | snr | Signal/Noise Ratio (SNR)
  [in] | data | Pointer to data buffer
  [in] | len | Length of data

Returns
  message buffer or NULL in case of error

This function will allocate a new msgb and fill it with a GSMTAP header containing the information

References arfcn, data, gsmtap_makemsg_ex(), GSMTAP_TYPE_UM, len(), signal_dbm, and ts.

## ◆ gsmtap_makemsg_ex()

struct msgb * gsmtap_makemsg_ex | ( | uint8_t | type,
|  | uint16_t | arfcn,
|  | uint8_t | ts,
|  | uint8_t | chan_type,
|  | uint8_t | ss,
|  | uint32_t | fn,
|  | int8_t | signal_dbm,
|  | int8_t | snr,
|  | const uint8_t * | data,
|  | unsigned int | len
| ) |  |

create an arbitrary type GSMTAP message

Parameters

  [in] | type | The GSMTAP_TYPE_xxx constant of the message to create
  [in] | arfcn | GSM ARFCN (Channel Number)
  [in] | ts | GSM time slot
  [in] | chan_type | Channel Type
  [in] | ss | Sub-slot
  [in] | fn | GSM Frame Number
  [in] | signal_dbm | Signal Strength (dBm)
  [in] | snr | Signal/Noise Ratio (SNR)
  [in] | data | Pointer to data buffer
  [in] | len | Length of data

Returns
  dynamically allocated message buffer containing data

This function will allocate a new msgb and fill it with a GSMTAP header containing the information

References gsmtap_hdr::antenna_nr, arfcn, gsmtap_hdr::arfcn, data, gsmtap_hdr::frame_number, GSMTAP_VERSION, gsmtap_hdr::hdr_len, len(), msg, msgb_alloc(), msgb_put(), osmo_htonl, osmo_htons, signal_dbm, gsmtap_hdr::signal_dbm, gsmtap_hdr::snr_db, gsmtap_hdr::sub_slot, gsmtap_hdr::sub_type, gsmtap_hdr::timeslot, ts, type, gsmtap_hdr::type, and gsmtap_hdr::version.

Referenced by gsmtap_makemsg().

## ◆ gsmtap_send()

int gsmtap_send | ( | struct gsmtap_inst * | gti,
|  | uint16_t | arfcn,
|  | uint8_t | ts,
|  | uint8_t | chan_type,
|  | uint8_t | ss,
|  | uint32_t | fn,
|  | int8_t | signal_dbm,
|  | int8_t | snr,
|  | const uint8_t * | data,
|  | unsigned int | len
| ) |  |

## ◆ gsmtap_send_ex()

int gsmtap_send_ex | ( | struct gsmtap_inst * | gti,
|  | uint8_t | type,
|  | uint16_t | arfcn,
|  | uint8_t | ts,
|  | uint8_t | chan_type,
|  | uint8_t | ss,
|  | uint32_t | fn,
|  | int8_t | signal_dbm,
|  | int8_t | snr,
|  | const uint8_t * | data,
|  | unsigned int | len
| ) |  |

## ◆ gsmtap_sendmsg()

int gsmtap_sendmsg | ( | struct gsmtap_inst * | gti,
|  | struct msgb * | msg
| ) |  |

Referenced by _gsmtap_raw_output().

## ◆ gsmtap_sendmsg_free()

int gsmtap_sendmsg_free | ( | struct gsmtap_inst * | gti,
|  | struct msgb * | msg
| ) |  |

## ◆ gsmtap_source_add_sink()

int gsmtap_source_add_sink | ( | struct gsmtap_inst * | gti | ) |

Referenced by log_target_create_gsmtap().

## ◆ gsmtap_source_add_sink_fd()

int gsmtap_source_add_sink_fd | ( | int | gsmtap_fd | ) |

## ◆ gsmtap_source_free()

void gsmtap_source_free | ( | struct gsmtap_inst * | gti | ) |

Referenced by log_target_destroy().

## ◆ gsmtap_source_init()

struct gsmtap_inst * gsmtap_source_init | ( | const char * | host,
|  | uint16_t | port,
|  | int | ofd_wq_mode
| ) |  |

Referenced by log_target_create_gsmtap().

## ◆ gsmtap_source_init2()

struct gsmtap_inst * gsmtap_source_init2 | ( | const char * | local_host,
|  | uint16_t | local_port,
|  | const char * | rem_host,
|  | uint16_t | rem_port,
|  | int | ofd_wq_mode
| ) |  |

## ◆ gsmtap_source_init_fd()

int gsmtap_source_init_fd | ( | const char * | host,
|  | uint16_t | port
| ) |  |

## ◆ gsmtap_source_init_fd2()

int gsmtap_source_init_fd2 | ( | const char * | local_host,
|  | uint16_t | local_port,
|  | const char * | rem_host,
|  | uint16_t | rem_port
| ) |  |

## ◆ gsmtap_source_set_nonblock()

int gsmtap_source_set_nonblock | ( | struct gsmtap_inst * | gti,
|  | int | on
| ) |  |

## ◆ gsmtap_source_using_wq()

bool gsmtap_source_using_wq | ( | const struct gsmtap_inst * | gti | ) |

## Variable Documentation

## ◆ gsmtap_gsm_channel_names [1/2]

const struct value_string gsmtap_gsm_channel_names[]
| extern

## ◆ gsmtap_gsm_channel_names [2/2]

const struct value_string gsmtap_gsm_channel_names[]

Initial value:
= {
{ GSMTAP_CHANNEL_UNKNOWN, "UNKNOWN" },
{ GSMTAP_CHANNEL_BCCH, "BCCH" },
{ GSMTAP_CHANNEL_CCCH, "CCCH" },
{ GSMTAP_CHANNEL_RACH, "RACH" },
{ GSMTAP_CHANNEL_AGCH, "AGCH" },
{ GSMTAP_CHANNEL_PCH, "PCH" },
{ GSMTAP_CHANNEL_SDCCH, "SDCCH" },
{ GSMTAP_CHANNEL_SDCCH4, "SDCCH/4" },
{ GSMTAP_CHANNEL_SDCCH8, "SDCCH/8" },
{ GSMTAP_CHANNEL_FACCH_F, "FACCH/F" },
{ GSMTAP_CHANNEL_FACCH_H, "FACCH/H" },
{ GSMTAP_CHANNEL_PACCH, "PACCH" },
{ GSMTAP_CHANNEL_CBCH52, "CBCH" },
{ GSMTAP_CHANNEL_PDCH, "PDCH" } ,
{ GSMTAP_CHANNEL_PTCCH, "PTTCH" },
{ GSMTAP_CHANNEL_CBCH51, "CBCH" },
{ GSMTAP_CHANNEL_ACCH | GSMTAP_CHANNEL_SDCCH, "LSACCH" },
{ GSMTAP_CHANNEL_ACCH | GSMTAP_CHANNEL_SDCCH4, "SACCH/4" },
{ GSMTAP_CHANNEL_ACCH | GSMTAP_CHANNEL_SDCCH8, "SACCH/8" },
{ GSMTAP_CHANNEL_ACCH | GSMTAP_CHANNEL_FACCH_F, "SACCH/F" },
{ GSMTAP_CHANNEL_ACCH | GSMTAP_CHANNEL_FACCH_H, "SACCH/H" },
{ GSMTAP_CHANNEL_VOICE_F, "TCH/F" },
{ GSMTAP_CHANNEL_VOICE_H, "TCH/H" },
{ 0, NULL }
}
GSMTAP_CHANNEL_ACCH
#define GSMTAP_CHANNEL_ACCH
Definition: gsmtap.h:108
GSMTAP_CHANNEL_VOICE_H
#define GSMTAP_CHANNEL_VOICE_H
Definition: gsmtap.h:97
GSMTAP_CHANNEL_SDCCH
#define GSMTAP_CHANNEL_SDCCH
Definition: gsmtap.h:84
GSMTAP_CHANNEL_VOICE_F
#define GSMTAP_CHANNEL_VOICE_F
Definition: gsmtap.h:96
GSMTAP_CHANNEL_SDCCH4
#define GSMTAP_CHANNEL_SDCCH4
Definition: gsmtap.h:85
GSMTAP_CHANNEL_CBCH52
#define GSMTAP_CHANNEL_CBCH52
Definition: gsmtap.h:90
GSMTAP_CHANNEL_PCH
#define GSMTAP_CHANNEL_PCH
Definition: gsmtap.h:83
GSMTAP_CHANNEL_FACCH_F
#define GSMTAP_CHANNEL_FACCH_F
Definition: gsmtap.h:87
GSMTAP_CHANNEL_SDCCH8
#define GSMTAP_CHANNEL_SDCCH8
Definition: gsmtap.h:86
GSMTAP_CHANNEL_PTCCH
#define GSMTAP_CHANNEL_PTCCH
Definition: gsmtap.h:94
GSMTAP_CHANNEL_PDCH
#define GSMTAP_CHANNEL_PDCH
Definition: gsmtap.h:93
GSMTAP_CHANNEL_CCCH
#define GSMTAP_CHANNEL_CCCH
Definition: gsmtap.h:80
GSMTAP_CHANNEL_CBCH51
#define GSMTAP_CHANNEL_CBCH51
Definition: gsmtap.h:95
GSMTAP_CHANNEL_BCCH
#define GSMTAP_CHANNEL_BCCH
Definition: gsmtap.h:79
GSMTAP_CHANNEL_PACCH
#define GSMTAP_CHANNEL_PACCH
Definition: gsmtap.h:89
GSMTAP_CHANNEL_FACCH_H
#define GSMTAP_CHANNEL_FACCH_H
Definition: gsmtap.h:88
GSMTAP_CHANNEL_UNKNOWN
#define GSMTAP_CHANNEL_UNKNOWN
Definition: gsmtap.h:78
GSMTAP_CHANNEL_RACH
#define GSMTAP_CHANNEL_RACH
Definition: gsmtap.h:81
GSMTAP_CHANNEL_AGCH
#define GSMTAP_CHANNEL_AGCH
Definition: gsmtap.h:82

## ◆ gsmtap_type_names [1/2]

const struct value_string gsmtap_type_names[]
| extern

## ◆ gsmtap_type_names [2/2]

const struct value_string gsmtap_type_names[]

Initial value:
= {
{ GSMTAP_TYPE_UM, "GSM Um (MS<->BTS)" },
{ GSMTAP_TYPE_ABIS, "GSM Abis (BTS<->BSC)" },
{ GSMTAP_TYPE_UM_BURST, "GSM Um burst (MS<->BTS)" },
{ GSMTAP_TYPE_SIM, "SIM Card" },
{ GSMTAP_TYPE_TETRA_I1, "TETRA V+D" },
{ GSMTAP_TYPE_TETRA_I1_BURST, "TETRA bursts" },
{ GSMTAP_TYPE_WMX_BURST, "WiMAX burst" },
{ GSMTAP_TYPE_GB_LLC, "GPRS Gb LLC" },
{ GSMTAP_TYPE_GB_SNDCP, "GPRS Gb SNDCP" },
{ GSMTAP_TYPE_GMR1_UM, "GMR-1 air interfeace (MES-MS<->GTS)"},
{ GSMTAP_TYPE_UMTS_RLC_MAC, "UMTS RLC/MAC" },
{ GSMTAP_TYPE_UMTS_RRC, "UMTS RRC" },
{ GSMTAP_TYPE_LTE_RRC, "LTE RRC" },
{ GSMTAP_TYPE_LTE_MAC, "LTE MAC" },
{ GSMTAP_TYPE_LTE_MAC_FRAMED, "LTE MAC with context hdr" },
{ GSMTAP_TYPE_OSMOCORE_LOG, "libosmocore logging" },
{ GSMTAP_TYPE_QC_DIAG, "Qualcomm DIAG" },
{ GSMTAP_TYPE_LTE_NAS, "LTE Non-Access Stratum" },
{ GSMTAP_TYPE_E1T1, "E1/T1 lines" },
{ GSMTAP_TYPE_GSM_RLP, "GSM Radio Link Protocol" },
{ 0, NULL }
}
GSMTAP_TYPE_TETRA_I1
#define GSMTAP_TYPE_TETRA_I1
Definition: gsmtap.h:37
GSMTAP_TYPE_OSMOCORE_LOG
#define GSMTAP_TYPE_OSMOCORE_LOG
Definition: gsmtap.h:48
GSMTAP_TYPE_UMTS_RRC
#define GSMTAP_TYPE_UMTS_RRC
Definition: gsmtap.h:44
GSMTAP_TYPE_TETRA_I1_BURST
#define GSMTAP_TYPE_TETRA_I1_BURST
Definition: gsmtap.h:38
GSMTAP_TYPE_UMTS_RLC_MAC
#define GSMTAP_TYPE_UMTS_RLC_MAC
Definition: gsmtap.h:43
GSMTAP_TYPE_SIM
#define GSMTAP_TYPE_SIM
Definition: gsmtap.h:36
GSMTAP_TYPE_LTE_MAC_FRAMED
#define GSMTAP_TYPE_LTE_MAC_FRAMED
Definition: gsmtap.h:47
GSMTAP_TYPE_LTE_NAS
#define GSMTAP_TYPE_LTE_NAS
Definition: gsmtap.h:50
GSMTAP_TYPE_GB_SNDCP
#define GSMTAP_TYPE_GB_SNDCP
Definition: gsmtap.h:41
GSMTAP_TYPE_GB_LLC
#define GSMTAP_TYPE_GB_LLC
Definition: gsmtap.h:40
GSMTAP_TYPE_ABIS
#define GSMTAP_TYPE_ABIS
Definition: gsmtap.h:34
GSMTAP_TYPE_E1T1
#define GSMTAP_TYPE_E1T1
Definition: gsmtap.h:51
GSMTAP_TYPE_GMR1_UM
#define GSMTAP_TYPE_GMR1_UM
Definition: gsmtap.h:42
GSMTAP_TYPE_UM_BURST
#define GSMTAP_TYPE_UM_BURST
Definition: gsmtap.h:35
GSMTAP_TYPE_GSM_RLP
#define GSMTAP_TYPE_GSM_RLP
Definition: gsmtap.h:52
GSMTAP_TYPE_QC_DIAG
#define GSMTAP_TYPE_QC_DIAG
Definition: gsmtap.h:49
GSMTAP_TYPE_UM
#define GSMTAP_TYPE_UM
Definition: gsmtap.h:33
GSMTAP_TYPE_WMX_BURST
#define GSMTAP_TYPE_WMX_BURST
Definition: gsmtap.h:39
GSMTAP_TYPE_LTE_RRC
#define GSMTAP_TYPE_LTE_RRC
Definition: gsmtap.h:45
GSMTAP_TYPE_LTE_MAC
#define GSMTAP_TYPE_LTE_MAC
Definition: gsmtap.h:46