libosmogb  0.12.0.47-7c74
Osmocom Gb library
gprs_ns_vty.c File Reference

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"

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\ "Include statistics\")
 
 DEFUN (show_ns_pers, show_ns_pers_cmd, "show ns persistent", SHOW_STR "Display information about the NS protocol\ "Show only persistent NS\")
 
 DEFUN (show_nse, show_nse_cmd, "show ns (nsei|nsvc) <0-65535> [stats]", SHOW_STR "Display information about the NS protocol\ "Select one NSE by its NSE Identifier\" "Select one NSE by its NS-VC Identifier\" "The Identifier of selected type\" "Include Statistics\")
 
 DEFUN (cfg_nse_nsvc, cfg_nse_nsvci_cmd, "nse <0-65535> nsvci <0-65534>", NSE_CMD_STR "NS Virtual Connection\ "NS Virtual Connection ID(NSVCI)\")
 
 DEFUN (cfg_nse_remoteip, cfg_nse_remoteip_cmd, "nse <0-65535> remote-ip A.B.C.D", NSE_CMD_STR "Remote IP Address\ "Remote IP Address\")
 
 DEFUN (cfg_nse_remoteport, cfg_nse_remoteport_cmd, "nse <0-65535> remote-port <0-65535>", NSE_CMD_STR "Remote UDP Port\ "Remote UDP Port Number\")
 
 DEFUN (cfg_nse_fr_dlci, cfg_nse_fr_dlci_cmd, "nse <0-65535> fr-dlci <16-1007>", NSE_CMD_STR "Frame Relay DLCI\ "Frame Relay DLCI Number\")
 
 DEFUN (cfg_nse_encaps, cfg_nse_encaps_cmd, "nse <0-65535> encapsulation (udp|framerelay-gre)", NSE_CMD_STR "Encapsulation for NS\ "UDP/IP Encapsulation\" "Frame-Relay/GRE/IP Encapsulation\")
 
 DEFUN (cfg_nse_remoterole, cfg_nse_remoterole_cmd, "nse <0-65535> remote-role (sgsn|bss)", NSE_CMD_STR "Remote NSE Role\ "Remote Peer is SGSN\" "Remote Peer is BSS\")
 
 DEFUN (cfg_no_nse, cfg_no_nse_cmd, "no nse <0-65535>", "Delete Persistent NS Entity\ "Delete " NSE_CMD_STR)
 
 DEFUN (cfg_ns_timer, cfg_ns_timer_cmd, "timer " NS_TIMERS " <0-65535>", "Network Service Timer\ NS_TIMERS_HELP "Timer Value\")
 
 DEFUN (cfg_nsip_local_ip, cfg_nsip_local_ip_cmd, "encapsulation udp local-ip A.B.C.D", ENCAPS_STR "NS over UDP Encapsulation\ "Set the IP address on which we listen for NS/UDP\" "IP Address\")
 
 DEFUN (cfg_nsip_local_port, cfg_nsip_local_port_cmd, "encapsulation udp local-port <0-65535>", ENCAPS_STR "NS over UDP Encapsulation\ "Set the UDP port on which we listen for NS/UDP\" "UDP port number\")
 
 DEFUN (cfg_nsip_dscp, cfg_nsip_dscp_cmd, "encapsulation udp dscp <0-255>", ENCAPS_STR "NS over UDP Encapsulation\ "Set DSCP/TOS on the UDP socket\" "DSCP Value\")
 
 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\ "Set the IP address on which we listen for NS/FR/GRE\" "IP Address\")
 
 DEFUN (cfg_frgre_enable, cfg_frgre_enable_cmd, "encapsulation framerelay-gre enabled (1|0)", ENCAPS_STR "NS over Frame Relay over GRE Encapsulation\ "Enable or disable Frame Relay over GRE\" "Enable\" "Disable\")
 
 DEFUN (nsvc_nsei, nsvc_nsei_cmd, "nsvc (nsei|nsvci) <0-65535> (block|unblock|reset)", "Perform an operation on a NSVC\ "NSEI to identify NS-VC Identifier(NS-VCI)\" "NS-VC Identifier(NS-VCI)\" "The NSEI\" "Initiate BLOCK procedure\" "Initiate UNBLOCK procedure\" "Initiate RESET procedure\")
 
 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\ "Identify NS-VC by NSEI\" "Identify NS-VC by NSVCI\" "Numeric identifier\")
 
int gprs_ns_vty_init (struct gprs_ns_inst *nsi)
 

Variables

static struct gprs_ns_instvty_nsi = NULL
 
static const struct value_string gprs_ns_timer_strs []
 
static struct cmd_node ns_node
 

Detailed Description

VTY interface for our GPRS Networks Service (NS) implementation.

Macro Definition Documentation

◆ ENCAPS_STR

#define ENCAPS_STR   "NS encapsulation options\n"

◆ NSE_CMD_STR

#define NSE_CMD_STR   "Persistent NS Entity\n" "NS Entity ID (NSEI)\n"

Function Documentation

◆ config_write_ns()

◆ DEFUN() [1/20]

DEFUN ( cfg_ns  ,
cfg_ns_cmd  ,
"ns"  ,
"Configure the GPRS Network Service"   
)

◆ DEFUN() [2/20]

DEFUN ( show_ns  ,
show_ns_cmd  ,
"show ns"  ,
SHOW_STR "Display information about the NS protocol"   
)

References dump_ns(), and vty_nsi.

◆ DEFUN() [3/20]

DEFUN ( show_ns_stats  ,
show_ns_stats_cmd  ,
"show ns stats"  ,
SHOW_STR "Display information about the NS protocol\ "Include statistics\"   
)

References dump_ns(), and vty_nsi.

◆ DEFUN() [4/20]

DEFUN ( show_ns_pers  ,
show_ns_pers_cmd  ,
"show ns persistent"  ,
SHOW_STR "Display information about the NS protocol\ "Show only persistent NS\"   
)

References dump_ns(), and vty_nsi.

◆ DEFUN() [5/20]

DEFUN ( show_nse  ,
show_nse_cmd  ,
"show ns (nsei|nsvc) <0-65535> "  [stats],
SHOW_STR "Display information about the NS protocol\ "Select one NSE by its NSE Identifier\" "Select one NSE by its NS-VC Identifier\" "The Identifier of selected type\" "Include Statistics\"   
)

◆ DEFUN() [6/20]

DEFUN ( cfg_nse_nsvc  ,
cfg_nse_nsvci_cmd  ,
"nse <0-65535> nsvci <0-65534>"  ,
NSE_CMD_STR "NS Virtual Connection\ "NS Virtual Connection ID(NSVCI)\"   
)

◆ DEFUN() [7/20]

DEFUN ( cfg_nse_remoteip  ,
cfg_nse_remoteip_cmd  ,
"nse <0-65535> remote-ip A.B.C.D"  ,
NSE_CMD_STR "Remote IP Address\ "Remote IP Address\"   
)

◆ DEFUN() [8/20]

DEFUN ( cfg_nse_remoteport  ,
cfg_nse_remoteport_cmd  ,
"nse <0-65535> remote-port <0-65535>"  ,
NSE_CMD_STR "Remote UDP Port\ "Remote UDP Port Number\"   
)

◆ DEFUN() [9/20]

DEFUN ( cfg_nse_fr_dlci  ,
cfg_nse_fr_dlci_cmd  ,
"nse <0-65535> fr-dlci <16-1007>"  ,
NSE_CMD_STR "Frame Relay DLCI\ "Frame Relay DLCI Number\"   
)

◆ DEFUN() [10/20]

DEFUN ( cfg_nse_encaps  ,
cfg_nse_encaps_cmd  ,
"nse <0-65535> encapsulation (udp|framerelay-gre)"  ,
NSE_CMD_STR "Encapsulation for NS\ "UDP/IP Encapsulation\" "Frame-Relay/GRE/IP Encapsulation\"   
)

◆ DEFUN() [11/20]

DEFUN ( cfg_nse_remoterole  ,
cfg_nse_remoterole_cmd  ,
"nse <0-65535> remote-role (sgsn|bss)"  ,
NSE_CMD_STR "Remote NSE Role\ "Remote Peer is SGSN\" "Remote Peer is BSS\"   
)

◆ DEFUN() [12/20]

DEFUN ( cfg_no_nse  ,
cfg_no_nse_cmd  ,
"no nse <0-65535>"  ,
"Delete Persistent NS Entity\ "Delete "  NSE_CMD_STR 
)

◆ DEFUN() [13/20]

DEFUN ( cfg_ns_timer  ,
cfg_ns_timer_cmd  ,
"timer " NS_TIMERS " <0-65535>"  ,
"Network Service Timer\ NS_TIMERS_HELP "Timer Value\"   
)

◆ DEFUN() [14/20]

DEFUN ( cfg_nsip_local_ip  ,
cfg_nsip_local_ip_cmd  ,
"encapsulation udp local-ip A.B.C.D"  ,
ENCAPS_STR "NS over UDP Encapsulation\ "Set the IP address on which we listen for NS/UDP\" "IP Address\"   
)

◆ DEFUN() [15/20]

DEFUN ( cfg_nsip_local_port  ,
cfg_nsip_local_port_cmd  ,
"encapsulation udp local-port <0-65535>"  ,
ENCAPS_STR "NS over UDP Encapsulation\ "Set the UDP port on which we listen for NS/UDP\" "UDP port number\"   
)

◆ DEFUN() [16/20]

DEFUN ( cfg_nsip_dscp  ,
cfg_nsip_dscp_cmd  ,
"encapsulation udp dscp <0-255>"  ,
ENCAPS_STR "NS over UDP Encapsulation\ "Set DSCP/TOS on the UDP socket\" "DSCP Value\"   
)

◆ DEFUN() [17/20]

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\ "Set the IP address on which we listen for NS/FR/GRE\" "IP Address\"   
)

◆ DEFUN() [18/20]

DEFUN ( cfg_frgre_enable  ,
cfg_frgre_enable_cmd  ,
"encapsulation framerelay-gre enabled (1|0)"  ,
ENCAPS_STR "NS over Frame Relay over GRE Encapsulation\ "Enable or disable Frame Relay over GRE\" "Enable\" "Disable\"   
)

◆ DEFUN() [19/20]

DEFUN ( nsvc_nsei  ,
nsvc_nsei_cmd  ,
"nsvc (nsei|nsvci) <0-65535> (block|unblock|reset)"  ,
"Perform an operation on a NSVC\ "NSEI to identify NS-VC Identifier(NS-VCI)\" "NS-VC Identifier(NS-VCI)\" "The NSEI\" "Initiate BLOCK procedure\" "Initiate UNBLOCK procedure\" "Initiate RESET procedure\"   
)

◆ DEFUN() [20/20]

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\ "Identify NS-VC by NSEI\" "Identify NS-VC by NSVCI\" "Numeric identifier\"   
)

◆ dump_ns()

static void dump_ns ( struct vty *  vty,
const struct gprs_ns_inst nsi,
bool  stats,
bool  persistent_only 
)
static

◆ dump_nse()

◆ gprs_ns_vty_init()

int gprs_ns_vty_init ( struct gprs_ns_inst nsi)

◆ log_set_nsvc_filter()

static void log_set_nsvc_filter ( struct log_target target,
struct gprs_nsvc nsvc 
)
static

Variable Documentation

◆ gprs_ns_timer_strs

const struct value_string gprs_ns_timer_strs[]
static
Initial value:
= {
{ 0, "tns-block" },
{ 1, "tns-block-retries" },
{ 2, "tns-reset" },
{ 3, "tns-reset-retries" },
{ 4, "tns-test" },
{ 5, "tns-alive" },
{ 6, "tns-alive-retries" },
{ 0, NULL }
}

◆ ns_node

struct cmd_node ns_node
static
Initial value:
= {
L_NS_NODE,
"%s(config-ns)# ",
1,
}

Referenced by gprs_ns_vty_init().

◆ vty_nsi

struct gprs_ns_inst* vty_nsi = NULL
static

Referenced by DEFUN().