libosmogb 1.10.0.57-8972
Osmocom Gb library
|
VTY interface for our GPRS Networks Service (NS) implementation. More...
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <stdint.h>
#include <arpa/inet.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/byteswap.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/select.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/gprs/gprs_ns.h>
#include <osmocom/gprs/gprs_bssgp.h>
#include <osmocom/core/socket.h>
#include <osmocom/vty/vty.h>
#include <osmocom/vty/command.h>
#include <osmocom/vty/logging.h>
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/misc.h>
#include "common_vty.h"
#include "gb_internal.h"
Macros | |
#define | NSE_CMD_STR "Persistent NS Entity\n" "NS Entity ID (NSEI)\n" |
#define | ENCAPS_STR "NS encapsulation options\n" |
Functions | |
static void | log_set_nsvc_filter (struct log_target *target, struct gprs_nsvc *nsvc) |
static int | config_write_ns (struct vty *vty) |
DEFUN (cfg_ns, cfg_ns_cmd, "ns", "Configure the GPRS Network Service") | |
static void | dump_nse (struct vty *vty, const struct gprs_nsvc *nsvc, bool stats, bool persistent_only) |
static void | dump_ns (struct vty *vty, const struct gprs_ns_inst *nsi, bool stats, bool persistent_only) |
DEFUN (show_ns, show_ns_cmd, "show ns", SHOW_STR "Display information about the NS protocol") | |
DEFUN (show_ns_stats, show_ns_stats_cmd, "show ns stats", SHOW_STR "Display information about the NS protocol\n" "Include statistics\n") | |
DEFUN (show_ns_pers, show_ns_pers_cmd, "show ns persistent", SHOW_STR "Display information about the NS protocol\n" "Show only persistent NS\n") | |
DEFUN (show_nse, show_nse_cmd, "show ns (nsei|nsvc) <0-65535> [stats]", SHOW_STR "Display information about the NS protocol\n" "Select one NSE by its NSE Identifier\n" "Select one NSE by its NS-VC Identifier\n" "The Identifier of selected type\n" "Include Statistics\n") | |
DEFUN (cfg_nse_nsvc, cfg_nse_nsvci_cmd, "nse <0-65535> nsvci <0-65534>", NSE_CMD_STR "NS Virtual Connection\n" "NS Virtual Connection ID (NSVCI)\n") | |
DEFUN (cfg_nse_remoteip, cfg_nse_remoteip_cmd, "nse <0-65535> remote-ip A.B.C.D", NSE_CMD_STR "Remote IP Address\n" "Remote IP Address\n") | |
DEFUN (cfg_nse_remoteport, cfg_nse_remoteport_cmd, "nse <0-65535> remote-port <0-65535>", NSE_CMD_STR "Remote UDP Port\n" "Remote UDP Port Number\n") | |
DEFUN (cfg_nse_fr_dlci, cfg_nse_fr_dlci_cmd, "nse <0-65535> fr-dlci <16-1007>", NSE_CMD_STR "Frame Relay DLCI\n" "Frame Relay DLCI Number\n") | |
DEFUN (cfg_nse_encaps, cfg_nse_encaps_cmd, "nse <0-65535> encapsulation (udp|framerelay-gre)", NSE_CMD_STR "Encapsulation for NS\n" "UDP/IP Encapsulation\n" "Frame-Relay/GRE/IP Encapsulation\n") | |
DEFUN (cfg_nse_remoterole, cfg_nse_remoterole_cmd, "nse <0-65535> remote-role (sgsn|bss)", NSE_CMD_STR "Remote NSE Role\n" "Remote Peer is SGSN\n" "Remote Peer is BSS\n") | |
DEFUN (cfg_no_nse, cfg_no_nse_cmd, "no nse <0-65535>", "Delete Persistent NS Entity\n" "Delete " NSE_CMD_STR) | |
DEFUN (cfg_ns_timer, cfg_ns_timer_cmd, "timer " NS_TIMERS " <0-65535>", "Network Service Timer\n" NS_TIMERS_HELP "Timer Value\n") | |
DEFUN (cfg_nsip_local_ip, cfg_nsip_local_ip_cmd, "encapsulation udp local-ip A.B.C.D", ENCAPS_STR "NS over UDP Encapsulation\n" "Set the IP address on which we listen for NS/UDP\n" "IP Address\n") | |
DEFUN (cfg_nsip_local_port, cfg_nsip_local_port_cmd, "encapsulation udp local-port <0-65535>", ENCAPS_STR "NS over UDP Encapsulation\n" "Set the UDP port on which we listen for NS/UDP\n" "UDP port number\n") | |
DEFUN (cfg_nsip_dscp, cfg_nsip_dscp_cmd, "encapsulation udp dscp <0-255>", ENCAPS_STR "NS over UDP Encapsulation\n" "Set DSCP/TOS on the UDP socket\n" "DSCP Value\n") | |
DEFUN (cfg_nsip_res_block_unblock, cfg_nsip_res_block_unblock_cmd, "encapsulation udp use-reset-block-unblock (enabled|disabled)", ENCAPS_STR "NS over UDP Encapsulation\n" "Use NS-{RESET,BLOCK,UNBLOCK} procedures in violation of 3GPP TS 48.016\n" "Enable NS-{RESET,BLOCK,UNBLOCK}\n" "Disable NS-{RESET,BLOCK,UNBLOCK}\n") | |
DEFUN (cfg_frgre_local_ip, cfg_frgre_local_ip_cmd, "encapsulation framerelay-gre local-ip A.B.C.D", ENCAPS_STR "NS over Frame Relay over GRE Encapsulation\n" "Set the IP address on which we listen for NS/FR/GRE\n" "IP Address\n") | |
DEFUN (cfg_frgre_enable, cfg_frgre_enable_cmd, "encapsulation framerelay-gre enabled (1|0)", ENCAPS_STR "NS over Frame Relay over GRE Encapsulation\n" "Enable or disable Frame Relay over GRE\n" "Enable\n" "Disable\n") | |
DEFUN (nsvc_nsei, nsvc_nsei_cmd, "nsvc (nsei|nsvci) <0-65535> (block|unblock|reset)", "Perform an operation on a NSVC\n" "NSEI to identify NS-VC Identifier (NS-VCI)\n" "NS-VC Identifier (NS-VCI)\n" "The NSEI\n" "Initiate BLOCK procedure\n" "Initiate UNBLOCK procedure\n" "Initiate RESET procedure\n") | |
DEFUN (logging_fltr_nsvc, logging_fltr_nsvc_cmd, "logging filter nsvc (nsei|nsvci) <0-65535>", LOGGING_STR FILTER_STR "Filter based on NS Virtual Connection\n" "Identify NS-VC by NSEI\n" "Identify NS-VC by NSVCI\n" "Numeric identifier\n") | |
int | gprs_ns_vty_init (struct gprs_ns_inst *nsi) |
Variables | |
static struct gprs_ns_inst * | vty_nsi = NULL |
static const struct value_string | gprs_ns_timer_strs [] |
static struct cmd_node | ns_node |
VTY interface for our GPRS Networks Service (NS) implementation.
#define ENCAPS_STR "NS encapsulation options\n" |
|
static |
References ARRAY_SIZE, gprs_nsvc::bts_addr, CMD_SUCCESS, gprs_ns_inst::dscp, gprs_ns_inst::enabled, gprs_ns_inst::frgre, gprs_nsvc::frgre, get_value_string(), GPRS_NS_LL_FR_GRE, GPRS_NS_LL_UDP, gprs_ns_timer_strs, gprs_ns_inst::gprs_nsvcs, gprs_nsvc::ip, list, gprs_nsvc::ll, llist_for_each_entry, gprs_ns_inst::local_ip, gprs_ns_inst::local_port, gprs_nsvc::nsei, gprs_ns_inst::nsip, gprs_nsvc::nsvci, osmo_htonl, osmo_ntohs, gprs_nsvc::persistent, gprs_nsvc::remote_end_is_sgsn, gprs_ns_inst::timeout, gprs_ns_inst::use_reset_block_unblock, VTY_NEWLINE, vty_nsi, and vty_out().
Referenced by gprs_ns_vty_init().
DEFUN | ( | cfg_frgre_enable | , |
cfg_frgre_enable_cmd | , | ||
"encapsulation framerelay-gre enabled (1|0)" | , | ||
ENCAPS_STR "NS over Frame Relay over GRE Encapsulation\n" "Enable or disable Frame Relay over GRE\n" "Enable\n" "Disable\n" | |||
) |
References argv, CMD_SUCCESS, gprs_ns_inst::enabled, gprs_ns_inst::frgre, and vty_nsi.
DEFUN | ( | cfg_frgre_local_ip | , |
cfg_frgre_local_ip_cmd | , | ||
"encapsulation framerelay-gre local-ip A.B.C.D" | , | ||
ENCAPS_STR "NS over Frame Relay over GRE Encapsulation\n" "Set the IP address on which we listen for NS/FR/GRE\n" "IP Address\n" | |||
) |
References argv, CMD_SUCCESS, gprs_ns_inst::frgre, gprs_ns_inst::local_ip, osmo_ntohl, and vty_nsi.
DEFUN | ( | cfg_no_nse | , |
cfg_no_nse_cmd | , | ||
"no nse <0-65535>" | , | ||
"Delete Persistent NS Entity\n" "Delete " | NSE_CMD_STR | ||
) |
References argv, CMD_SUCCESS, CMD_WARNING, gprs_nsvc_by_nsei(), nsei, gprs_nsvc::persistent, VTY_NEWLINE, vty_nsi, and vty_out().
DEFUN | ( | cfg_ns | , |
cfg_ns_cmd | , | ||
"ns" | , | ||
"Configure the GPRS Network Service" | |||
) |
References CMD_SUCCESS, L_NS_NODE, and vty::node.
DEFUN | ( | cfg_ns_timer | , |
cfg_ns_timer_cmd | , | ||
"timer " NS_TIMERS " <0-65535>" | , | ||
"Network Service Timer\n" NS_TIMERS_HELP "Timer Value\n" | |||
) |
References argv, ARRAY_SIZE, CMD_SUCCESS, CMD_WARNING, get_string_value(), gprs_ns_timer_strs, gprs_ns_inst::timeout, and vty_nsi.
DEFUN | ( | cfg_nse_encaps | , |
cfg_nse_encaps_cmd | , | ||
"nse <0-65535> encapsulation (udp|framerelay-gre)" | , | ||
NSE_CMD_STR "Encapsulation for NS\n" "UDP/IP Encapsulation\n" "Frame-Relay/GRE/IP Encapsulation\n" | |||
) |
References argv, CMD_SUCCESS, CMD_WARNING, GPRS_NS_LL_FR_GRE, GPRS_NS_LL_UDP, gprs_nsvc_by_nsei(), gprs_nsvc::ll, nsei, VTY_NEWLINE, vty_nsi, and vty_out().
DEFUN | ( | cfg_nse_fr_dlci | , |
cfg_nse_fr_dlci_cmd | , | ||
"nse <0-65535> fr-dlci <16-1007>" | , | ||
NSE_CMD_STR "Frame Relay DLCI\n" "Frame Relay DLCI Number\n" | |||
) |
References argv, gprs_nsvc::bts_addr, CMD_SUCCESS, CMD_WARNING, gprs_nsvc::frgre, GPRS_NS_LL_FR_GRE, gprs_nsvc_by_nsei(), gprs_nsvc::ll, nsei, osmo_htons, VTY_NEWLINE, vty_nsi, and vty_out().
DEFUN | ( | cfg_nse_nsvc | , |
cfg_nse_nsvci_cmd | , | ||
"nse <0-65535> nsvci <0-65534>" | , | ||
NSE_CMD_STR "NS Virtual Connection\n" "NS Virtual Connection ID (NSVCI)\n" | |||
) |
References argv, CMD_SUCCESS, gprs_nsvc_by_nsei(), gprs_nsvc_create2(), nsei, gprs_nsvc::nsei, gprs_nsvc::nsvci, gprs_nsvc::persistent, and vty_nsi.
DEFUN | ( | cfg_nse_remoteip | , |
cfg_nse_remoteip_cmd | , | ||
"nse <0-65535> remote-ip A.B.C.D" | , | ||
NSE_CMD_STR "Remote IP Address\n" "Remote IP Address\n" | |||
) |
References argv, gprs_nsvc::bts_addr, CMD_SUCCESS, CMD_WARNING, gprs_nsvc_by_nsei(), gprs_nsvc::ip, nsei, VTY_NEWLINE, vty_nsi, and vty_out().
DEFUN | ( | cfg_nse_remoteport | , |
cfg_nse_remoteport_cmd | , | ||
"nse <0-65535> remote-port <0-65535>" | , | ||
NSE_CMD_STR "Remote UDP Port\n" "Remote UDP Port Number\n" | |||
) |
References argv, gprs_nsvc::bts_addr, CMD_SUCCESS, CMD_WARNING, GPRS_NS_LL_UDP, gprs_nsvc_by_nsei(), gprs_nsvc::ip, gprs_nsvc::ll, nsei, osmo_htons, VTY_NEWLINE, vty_nsi, and vty_out().
DEFUN | ( | cfg_nse_remoterole | , |
cfg_nse_remoterole_cmd | , | ||
"nse <0-65535> remote-role (sgsn|bss)" | , | ||
NSE_CMD_STR "Remote NSE Role\n" "Remote Peer is SGSN\n" "Remote Peer is BSS\n" | |||
) |
References argv, CMD_SUCCESS, CMD_WARNING, gprs_nsvc_by_nsei(), nsei, gprs_nsvc::remote_end_is_sgsn, VTY_NEWLINE, vty_nsi, and vty_out().
DEFUN | ( | cfg_nsip_dscp | , |
cfg_nsip_dscp_cmd | , | ||
"encapsulation udp dscp <0-255>" | , | ||
ENCAPS_STR "NS over UDP Encapsulation\n" "Set DSCP/TOS on the UDP socket\n" "DSCP Value\n" | |||
) |
References argv, CMD_SUCCESS, gprs_ns_inst::dscp, gprs_ns_inst::nsip, and vty_nsi.
DEFUN | ( | cfg_nsip_local_ip | , |
cfg_nsip_local_ip_cmd | , | ||
"encapsulation udp local-ip A.B.C.D" | , | ||
ENCAPS_STR "NS over UDP Encapsulation\n" "Set the IP address on which we listen for NS/UDP\n" "IP Address\n" | |||
) |
References argv, CMD_SUCCESS, gprs_ns_inst::local_ip, gprs_ns_inst::nsip, osmo_ntohl, and vty_nsi.
DEFUN | ( | cfg_nsip_local_port | , |
cfg_nsip_local_port_cmd | , | ||
"encapsulation udp local-port <0-65535>" | , | ||
ENCAPS_STR "NS over UDP Encapsulation\n" "Set the UDP port on which we listen for NS/UDP\n" "UDP port number\n" | |||
) |
References argv, CMD_SUCCESS, gprs_ns_inst::local_port, gprs_ns_inst::nsip, and vty_nsi.
DEFUN | ( | cfg_nsip_res_block_unblock | , |
cfg_nsip_res_block_unblock_cmd | , | ||
"encapsulation udp use-reset-block-unblock (enabled|disabled)" | , | ||
ENCAPS_STR "NS over UDP Encapsulation\n" "Use NS-{RESET,BLOCK,UNBLOCK} procedures in violation of 3GPP TS 48.016\n" "Enable NS-{RESET,BLOCK,UNBLOCK}\n" "Disable NS-{RESET,BLOCK,UNBLOCK}\n" | |||
) |
References argv, CMD_SUCCESS, gprs_ns_inst::nsip, gprs_ns_inst::use_reset_block_unblock, and vty_nsi.
DEFUN | ( | logging_fltr_nsvc | , |
logging_fltr_nsvc_cmd | , | ||
"logging filter nsvc (nsei|nsvci) <0-65535>" | , | ||
LOGGING_STR FILTER_STR "Filter based on NS Virtual Connection\n" "Identify NS-VC by NSEI\n" "Identify NS-VC by NSVCI\n" "Numeric identifier\n" | |||
) |
DEFUN | ( | nsvc_nsei | , |
nsvc_nsei_cmd | , | ||
"nsvc (nsei|nsvci) <0-65535> (block|unblock|reset)" | , | ||
"Perform an operation on a NSVC\n" "NSEI to identify NS-VC Identifier (NS-VCI)\n" "NS-VC Identifier (NS-VCI)\n" "The NSEI\n" "Initiate BLOCK procedure\n" "Initiate UNBLOCK procedure\n" "Initiate RESET procedure\n" | |||
) |
DEFUN | ( | show_ns | , |
show_ns_cmd | , | ||
"show ns" | , | ||
SHOW_STR "Display information about the NS protocol" | |||
) |
References CMD_SUCCESS, dump_ns(), and vty_nsi.
DEFUN | ( | show_ns_pers | , |
show_ns_pers_cmd | , | ||
"show ns persistent" | , | ||
SHOW_STR "Display information about the NS protocol\n" "Show only persistent NS\n" | |||
) |
References CMD_SUCCESS, dump_ns(), and vty_nsi.
DEFUN | ( | show_ns_stats | , |
show_ns_stats_cmd | , | ||
"show ns stats" | , | ||
SHOW_STR "Display information about the NS protocol\n" "Include statistics\n" | |||
) |
References CMD_SUCCESS, dump_ns(), and vty_nsi.
DEFUN | ( | show_nse | , |
show_nse_cmd | , | ||
"show ns (nsei|nsvc) <0-65535> " | [stats], | ||
SHOW_STR "Display information about the NS protocol\n" "Select one NSE by its NSE Identifier\n" "Select one NSE by its NS-VC Identifier\n" "The Identifier of selected type\n" "Include Statistics\n" | |||
) |
References argc, argv, CMD_SUCCESS, CMD_WARNING, dump_nse(), gprs_nsvc_by_nsei(), gprs_nsvc_by_nsvci(), gprs_nsvc::nsi, VTY_NEWLINE, vty_nsi, and vty_out().
|
static |
References dump_nse(), gprs_ns_inst::enabled, gprs_ns_inst::frgre, gprs_ns_inst::gprs_nsvcs, gprs_sns_dump_vty(), list, llist_for_each_entry, gprs_ns_inst::local_ip, gprs_ns_inst::local_port, gprs_ns_inst::nsip, osmo_htonl, gprs_ns_inst::unknown_nsvc, VTY_NEWLINE, vty_nsi, and vty_out().
Referenced by DEFUN().
|
static |
References gprs_nsvc::bts_addr, gprs_nsvc::ctrg, gprs_ns_ll_str(), GPRS_NS_LL_UDP, gprs_nsvc::ip, gprs_nsvc::ll, gprs_ns_inst::local_port, NS_DESC_A, NS_DESC_B, gprs_nsvc::nsei, gprs_nsvc::nsi, gprs_ns_inst::nsip, gprs_nsvc::nsvci, osmo_sock_local_ip(), gprs_nsvc::persistent, gprs_nsvc::remote_end_is_sgsn, gprs_nsvc::remote_state, gprs_nsvc::state, gprs_nsvc::statg, VTY_NEWLINE, vty_out(), vty_out_rate_ctr_group(), and vty_out_stat_item_group().
int gprs_ns_vty_init | ( | struct gprs_ns_inst * | nsi | ) |
|
static |
References log_target::filter_data, log_target::filter_map, and LOG_FLT_GB_NSVC.
Referenced by DEFUN().
|
static |
Referenced by config_write_ns(), and DEFUN().
|
static |
Referenced by gprs_ns_vty_init().
|
static |
Referenced by config_write_ns(), DEFUN(), dump_ns(), and gprs_ns_vty_init().