libosmogb 1.10.0.64-ff3d
Osmocom Gb library
|
Implement frame relay/PVC by Q.933. More...
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
#include <errno.h>
#include <osmocom/gprs/frame_relay.h>
#include <osmocom/core/endian.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/tdef.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/vty/vty.h>
#include <osmocom/vty/tdef_vty.h>
Data Structures | |
struct | q933_a_hdr |
struct | q933_a_pvc_sts |
Macros | |
#define | LOGPFRL(frl, lvl, fmt, args ...) LOGP(DFR, lvl, "%s: " fmt, (frl)->name, ## args) |
#define | DFR DLNS |
#define | LAPF_UI 0x03 /* UI control word */ |
#define | Q931_PDISC_CC 0x08 /* protocol discriminator */ |
#define | LMI_Q933A_CALLREF 0x00 /* NULL call-ref */ |
#define | LMI_Q933A_DLCI 0 /* Q.933A DLCI */ |
#define | LMI_CISCO_DLCI 1023 /* Cisco DLCI */ |
#define | MAX_SUPPORTED_PVC 10 |
Functions | |
struct q933_a_hdr | __attribute__ ((packed)) |
static void | check_link_state (struct osmo_fr_link *link, bool valid) |
static uint16_t | q922_to_dlci (const uint8_t *hdr) |
static void | dlci_to_q922 (uint8_t *hdr, uint16_t dlci) |
static void | dlc_set_active (struct osmo_fr_dlc *dlc, bool active) |
static struct msgb * | q933_msgb_alloc (uint16_t dlci, uint8_t prot_disc, uint8_t msg_type) |
static uint8_t | link_get_tx_seq (struct osmo_fr_link *link) |
static void | msgb_put_link_int_verif (struct msgb *msg, struct osmo_fr_link *link) |
static void | dlc_destroy (struct osmo_fr_dlc *dlc) |
static void | msgb_put_pvc_status (struct msgb *msg, struct osmo_fr_dlc *dlc) |
static int | tx_lmi_q933_status_enq (struct osmo_fr_link *link, uint8_t rep_type) |
static int | tx_lmi_q933_status (struct osmo_fr_link *link, uint8_t rep_type) |
static void | link_set_failed (struct osmo_fr_link *link) |
static int | rx_lmi_q933_status_enq (struct msgb *msg, struct tlv_parsed *tp) |
static int | validate_pvc_status (struct tlv_parsed *tp, size_t tp_len) |
static int | parse_full_pvc_status (struct osmo_fr_link *link, struct tlv_parsed *tp, size_t tp_len) |
static int | parse_link_pvc_status (struct osmo_fr_link *link, struct tlv_parsed *tp, size_t tp_len) |
static size_t | count_pvc_status (struct tlv_parsed *tp, size_t tp_len) |
static int | rx_lmi_q933_status (struct msgb *msg, struct tlv_parsed *tp) |
static int | rx_lmi_q922 (struct msgb *msg) |
int | osmo_fr_rx (struct msgb *msg) |
int | osmo_fr_tx_dlc (struct msgb *msg) |
static void | fr_t391_cb (void *data) |
static void | fr_t392_cb (void *data) |
struct osmo_fr_network * | osmo_fr_network_alloc (void *ctx) |
void | osmo_fr_network_free (struct osmo_fr_network *net) |
struct osmo_fr_link * | osmo_fr_link_alloc (struct osmo_fr_network *net, enum osmo_fr_role role, const char *name) |
void | osmo_fr_link_free (struct osmo_fr_link *link) |
struct osmo_fr_dlc * | osmo_fr_dlc_alloc (struct osmo_fr_link *link, uint16_t dlci) |
void | osmo_fr_dlc_free (struct osmo_fr_dlc *dlc) |
struct osmo_fr_dlc * | osmo_fr_dlc_by_dlci (struct osmo_fr_link *link, uint16_t dlci) |
static void | fr_dlc_dump_vty (struct vty *vty, const struct osmo_fr_dlc *dlc) |
static void | fr_link_dump_vty (struct vty *vty, const struct osmo_fr_link *link) |
void | osmo_fr_network_dump_vty (struct vty *vty, const struct osmo_fr_network *net) |
Variables | |
uint8_t | prot_disc |
uint8_t | call_ref |
uint8_t | msg_type |
const struct value_string | osmo_fr_role_names [] |
struct osmo_tdef | fr_tdefs [] |
static const struct tlv_definition | q933_att_tlvdef |
Implement frame relay/PVC by Q.933.
#define DFR DLNS |
#define LAPF_UI 0x03 /* UI control word */ |
#define LMI_CISCO_DLCI 1023 /* Cisco DLCI */ |
#define LMI_Q933A_CALLREF 0x00 /* NULL call-ref */ |
#define LMI_Q933A_DLCI 0 /* Q.933A DLCI */ |
#define MAX_SUPPORTED_PVC 10 |
#define Q931_PDISC_CC 0x08 /* protocol discriminator */ |
enum q931_msgtype |
enum q933_iei |
enum q933_pvc_status |
enum q933_type_of_report |
|
static |
References osmo_fr_dlc::add, osmo_fr_link::cb_data, osmo_fr_dlc::del, osmo_fr_link::dlc_list, dlc_set_active(), FR_ROLE_USER_EQUIPMENT, osmo_fr_dlc::link, link_set_failed(), list, llist_for_each_entry, LOGL_NOTICE, LOGPFRL, osmo_fr_network::n392, osmo_fr_network::n393, osmo_fr_link::net, osmo_fr_link::polling_count, osmo_fr_link::role, osmo_fr_link::state, osmo_fr_link::status_cb, and osmo_fr_link::succeed.
Referenced by fr_t392_cb(), rx_lmi_q933_status(), and rx_lmi_q933_status_enq().
|
static |
References Q933_IEI_PVC_STATUS, and TLVP_PRESENT.
Referenced by rx_lmi_q933_status().
|
static |
References osmo_fr_dlc::list, and llist_del().
Referenced by msgb_put_pvc_status().
|
static |
References osmo_fr_dlc::active, osmo_fr_dlc::cb_data, osmo_fr_dlc::dlci, osmo_fr_dlc::link, LOGL_NOTICE, LOGPFRL, and osmo_fr_dlc::status_cb.
Referenced by check_link_state(), link_set_failed(), parse_full_pvc_status(), parse_link_pvc_status(), and rx_lmi_q933_status_enq().
|
inlinestatic |
References hdr.
Referenced by osmo_fr_tx_dlc(), and q933_msgb_alloc().
|
static |
References osmo_fr_dlc::active, osmo_fr_dlc::add, osmo_fr_dlc::del, osmo_fr_dlc::dlci, VTY_NEWLINE, and vty_out().
Referenced by fr_link_dump_vty().
|
static |
|
static |
References data, osmo_fr_network::n391, osmo_fr_link::net, OSMO_ASSERT, osmo_tdef_get(), OSMO_TDEF_S, osmo_timer_schedule(), osmo_fr_link::polling_count, Q933_REPT_FULL_STATUS, Q933_REPT_LINK_INTEGRITY_VERIF, osmo_fr_link::t391, osmo_fr_network::T_defs, and tx_lmi_q933_status_enq().
Referenced by osmo_fr_link_alloc().
|
static |
References check_link_state(), data, osmo_fr_link::err_count, osmo_fr_link::net, OSMO_ASSERT, osmo_tdef_get(), OSMO_TDEF_S, osmo_timer_schedule(), osmo_fr_link::t392, and osmo_fr_network::T_defs.
Referenced by osmo_fr_link_alloc().
|
static |
References osmo_fr_link::last_tx_seq.
Referenced by msgb_put_link_int_verif().
|
static |
References osmo_fr_link::cb_data, osmo_fr_link::dlc_list, dlc_set_active(), osmo_fr_dlc::link, list, llist_for_each_entry, LOGL_NOTICE, LOGPFRL, osmo_fr_link::state, and osmo_fr_link::status_cb.
Referenced by check_link_state(), and rx_lmi_q933_status_enq().
|
static |
References osmo_fr_link::last_rx_seq, link_get_tx_seq(), msg, msgb_tlv_put(), and Q933_IEI_LINK_INT_VERIF.
Referenced by tx_lmi_q933_status(), and tx_lmi_q933_status_enq().
|
static |
struct osmo_fr_dlc * osmo_fr_dlc_alloc | ( | struct osmo_fr_link * | link, |
uint16_t | dlci | ||
) |
struct osmo_fr_dlc * osmo_fr_dlc_by_dlci | ( | struct osmo_fr_link * | link, |
uint16_t | dlci | ||
) |
References osmo_fr_link::dlc_list, osmo_fr_dlc::dlci, osmo_fr_dlc::link, list, and llist_for_each_entry.
Referenced by osmo_fr_rx(), parse_full_pvc_status(), and parse_link_pvc_status().
void osmo_fr_dlc_free | ( | struct osmo_fr_dlc * | dlc | ) |
References osmo_fr_dlc::list, and llist_del().
Referenced by osmo_fr_link_free().
struct osmo_fr_link * osmo_fr_link_alloc | ( | struct osmo_fr_network * | net, |
enum osmo_fr_role | role, | ||
const char * | name | ||
) |
References osmo_fr_link::dlc_list, FR_ROLE_NETWORK_EQUIPMENT, FR_ROLE_USER_EQUIPMENT, fr_t391_cb(), fr_t392_cb(), INIT_LLIST_HEAD, osmo_fr_link::list, llist_add_tail(), LOGL_INFO, LOGPFRL, name, osmo_fr_link::name, net, osmo_fr_link::net, osmo_fr_role_str(), osmo_tdef_get(), OSMO_TDEF_S, osmo_timer_schedule(), osmo_timer_setup(), osmo_fr_link::role, osmo_fr_link::t391, osmo_fr_link::t392, and osmo_fr_network::T_defs.
Referenced by gprs_ns2_fr_bind().
void osmo_fr_link_free | ( | struct osmo_fr_link * | link | ) |
References osmo_fr_link::dlc_list, osmo_fr_dlc::link, list, osmo_fr_link::list, llist_del(), llist_for_each_entry_safe, osmo_fr_dlc_free(), osmo_timer_del(), osmo_fr_link::t391, and osmo_fr_link::t392.
Referenced by free_bind(), gprs_ns2_fr_bind(), and osmo_fr_network_free().
struct osmo_fr_network * osmo_fr_network_alloc | ( | void * | ctx | ) |
References fr_tdefs, INIT_LLIST_HEAD, net, and osmo_tdefs_reset().
Referenced by gprs_ns2_vty_init_reduced().
void osmo_fr_network_dump_vty | ( | struct vty * | vty, |
const struct osmo_fr_network * | net | ||
) |
References fr_link_dump_vty(), list, llist_for_each_entry, net, osmo_tdef_vty_out_all(), VTY_NEWLINE, and vty_out().
Referenced by DEFUN_HIDDEN().
void osmo_fr_network_free | ( | struct osmo_fr_network * | net | ) |
References list, llist_for_each_entry_safe, net, and osmo_fr_link_free().
int osmo_fr_rx | ( | struct msgb * | msg | ) |
References osmo_fr_dlc::active, osmo_fr_dlc::cb_data, LMI_CISCO_DLCI, LMI_Q933A_DLCI, LOGL_ERROR, LOGL_NOTICE, LOGPFRL, msg, msgb_data(), msgb_free(), msgb_length(), OSMO_ASSERT, osmo_fr_dlc_by_dlci(), q922_to_dlci(), osmo_fr_dlc::rx_cb, rx_lmi_q922(), osmo_fr_link::state, osmo_fr_link::unknown_dlc_rx_cb, and osmo_fr_link::unknown_dlc_rx_cb_data.
Referenced by fr_netif_ofd_cb().
int osmo_fr_tx_dlc | ( | struct msgb * | msg | ) |
References osmo_fr_dlc::active, osmo_fr_link::cb_data, osmo_fr_dlc::dlci, dlci_to_q922(), osmo_fr_dlc::link, LOGL_DEBUG, LOGL_NOTICE, LOGPFRL, msg, msgb_free(), msgb_headroom(), msgb_push(), OSMO_ASSERT, osmo_fr_link::state, and osmo_fr_link::tx_cb.
Referenced by fr_vc_sendmsg().
|
static |
References osmo_fr_dlc::add, osmo_fr_dlc::del, osmo_fr_link::dlc_list, dlc_set_active(), osmo_fr_dlc::dlci, list, llist_for_each_entry_safe, LOGL_ERROR, LOGPFRL, osmo_fr_dlc_alloc(), osmo_fr_dlc_by_dlci(), Q933_IEI_PVC_STATUS, TLVP_PRESENT, TLVP_VAL_MINLEN, and validate_pvc_status().
Referenced by rx_lmi_q933_status().
|
static |
References osmo_fr_dlc::add, osmo_fr_dlc::del, dlc_set_active(), osmo_fr_dlc::dlci, LOGL_ERROR, LOGPFRL, osmo_fr_dlc_alloc(), osmo_fr_dlc_by_dlci(), Q933_IEI_PVC_STATUS, TLVP_PRESENT, TLVP_VAL_MINLEN, and validate_pvc_status().
Referenced by rx_lmi_q933_status().
|
inlinestatic |
References hdr.
Referenced by osmo_fr_rx().
|
static |
References q933_a_hdr::call_ref, dlci_to_q922(), LAPF_UI, LMI_Q933A_CALLREF, msg, msg_type, q933_a_hdr::msg_type, msgb_alloc_headroom(), msgb_put(), prot_disc, and q933_a_hdr::prot_disc.
Referenced by tx_lmi_q933_status(), and tx_lmi_q933_status_enq().
|
static |
References LAPF_UI, LOGL_NOTICE, LOGPFRL, MAX_SUPPORTED_PVC, msg, q933_a_hdr::msg_type, msgb_free(), msgb_l2, msgb_l2len(), msgb_l3, msgb_l3len(), OSMO_ASSERT, q933_a_hdr::prot_disc, Q931_MSGT_STATUS, Q931_MSGT_STATUS_ENQUIRY, Q931_PDISC_CC, q933_att_tlvdef, rx_lmi_q933_status(), rx_lmi_q933_status_enq(), and tlv_parse2().
Referenced by osmo_fr_rx().
|
static |
References check_link_state(), count_pvc_status(), osmo_fr_link::expected_rep, FR_ROLE_NETWORK_EQUIPMENT, osmo_fr_link::last_rx_seq, osmo_fr_link::last_tx_seq, LOGL_ERROR, LOGL_NOTICE, LOGPFRL, MAX_SUPPORTED_PVC, msg, osmo_fr_link::net, OSMO_ASSERT, osmo_tdef_get(), OSMO_TDEF_S, osmo_timer_schedule(), parse_full_pvc_status(), parse_link_pvc_status(), Q933_IEI_LINK_INT_VERIF, Q933_IEI_REPORT_TYPE, Q933_REPT_FULL_STATUS, Q933_REPT_LINK_INTEGRITY_VERIF, Q933_REPT_SINGLE_PVC_ASYNC_STS, osmo_fr_link::role, osmo_fr_link::t392, osmo_fr_network::T_defs, TLVP_PRES_LEN, and TLVP_VAL.
Referenced by rx_lmi_q922().
|
static |
References osmo_fr_dlc::add, check_link_state(), osmo_fr_dlc::del, osmo_fr_link::dlc_list, dlc_set_active(), osmo_fr_link::err_count, FR_ROLE_USER_EQUIPMENT, osmo_fr_link::last_rx_seq, osmo_fr_link::last_tx_seq, osmo_fr_dlc::link, link_set_failed(), list, llist_for_each_entry, LOGL_ERROR, LOGPFRL, msg, osmo_fr_link::net, OSMO_ASSERT, osmo_tdef_get(), OSMO_TDEF_S, osmo_timer_schedule(), Q933_IEI_LINK_INT_VERIF, Q933_IEI_REPORT_TYPE, osmo_fr_link::role, osmo_fr_link::state, osmo_fr_dlc::state_send, osmo_fr_link::t392, osmo_fr_network::T_defs, TLVP_PRES_LEN, TLVP_VAL, and tx_lmi_q933_status().
Referenced by rx_lmi_q922().
|
static |
References osmo_fr_dlc::add, osmo_fr_link::cb_data, osmo_fr_dlc::del, osmo_fr_link::dlc_list, msgb::dst, list, llist_for_each_entry, msgb_put_link_int_verif(), msgb_put_pvc_status(), msgb_tlv_put(), Q931_MSGT_STATUS, Q931_PDISC_CC, Q933_IEI_REPORT_TYPE, q933_msgb_alloc(), Q933_REPT_FULL_STATUS, Q933_REPT_LINK_INTEGRITY_VERIF, Q933_REPT_SINGLE_PVC_ASYNC_STS, osmo_fr_dlc::state_send, and osmo_fr_link::tx_cb.
Referenced by osmo_fr_dlc_alloc(), and rx_lmi_q933_status_enq().
|
static |
References osmo_fr_link::cb_data, msgb::dst, osmo_fr_link::expected_rep, msgb_put_link_int_verif(), msgb_tlv_put(), Q931_MSGT_STATUS_ENQUIRY, Q931_PDISC_CC, Q933_IEI_REPORT_TYPE, q933_msgb_alloc(), and osmo_fr_link::tx_cb.
Referenced by fr_t391_cb().
|
static |
References len(), Q933_IEI_PVC_STATUS, TLVP_LEN, and TLVP_PRESENT.
Referenced by parse_full_pvc_status(), and parse_link_pvc_status().
uint8_t call_ref |
struct osmo_tdef fr_tdefs[] |
Referenced by osmo_fr_network_alloc().
uint8_t msg_type |
Referenced by q933_msgb_alloc().
const struct value_string osmo_fr_role_names[] |
Referenced by osmo_fr_role_str().
uint8_t prot_disc |
Referenced by q933_msgb_alloc().
|
static |
Referenced by rx_lmi_q922().