gprs_ns2: add new vty2

Change-Id: I163279cf57e84198dc8c53e1c109f5a9474670e9
This commit is contained in:
Alexander Couzens 2020-11-19 05:24:37 +01:00
parent d2a61179a3
commit 412bc3494d
8 changed files with 1675 additions and 1 deletions

View File

@ -42,6 +42,7 @@ enum gprs_ns2_dialect {
/*! Osmocom NS link layer types */
enum gprs_ns2_ll {
GPRS_NS2_LL_UNDEF, /*!< undefined, used by vty */
GPRS_NS2_LL_UDP, /*!< NS/UDP/IP */
GPRS_NS2_LL_FR, /*!< NS/FR */
GPRS_NS2_LL_FR_GRE, /*!< NS/FR/GRE/IP */
@ -264,4 +265,7 @@ int gprs_ns2_vty_init(struct gprs_ns2_inst *nsi,
const struct osmo_sockaddr_str *default_bind);
int gprs_ns2_vty_create();
/* vty 2 */
int gprs_ns2_vty2_init(struct gprs_ns2_inst *nsi);
/*! @} */

View File

@ -100,6 +100,8 @@ enum node_type {
L_CS7_SCCPADDR_GT_NODE, /*!< SS7 SCCP Global Title */
L_CPU_SCHED_NODE, /*!< CPU Sched related options node */
L_NS_BIND_NODE, /*!< NS bind node */
L_NS_NSE_NODE, /*!< NS NSE node */
/*
* When adding new nodes to the libosmocore project, these nodes can be
* used to avoid ABI changes for unrelated projects.

View File

@ -25,7 +25,7 @@ libosmogb_la_SOURCES = gprs_ns.c gprs_ns_frgre.c gprs_ns_vty.c gprs_ns_sns.c \
gprs_bssgp.c gprs_bssgp_util.c gprs_bssgp_vty.c \
gprs_bssgp_bss.c \
gprs_ns2.c gprs_ns2_udp.c gprs_ns2_frgre.c gprs_ns2_fr.c gprs_ns2_vc_fsm.c gprs_ns2_sns.c \
gprs_ns2_message.c gprs_ns2_vty.c \
gprs_ns2_message.c gprs_ns2_vty.c gprs_ns2_vty2.c \
gprs_bssgp2.c bssgp_bvc_fsm.c \
common_vty.c frame_relay.c
endif

View File

@ -234,6 +234,7 @@ struct gprs_ns2_vc *ns2_vc_alloc(struct gprs_ns2_vc_bind *bind,
struct msgb *gprs_ns2_msgb_alloc(void);
void gprs_ns2_sns_write_vty(struct vty *vty, const struct gprs_ns2_nse *nse);
void gprs_ns2_sns_dump_vty(struct vty *vty, const struct gprs_ns2_nse *nse, bool stats);
void ns2_prim_status_ind(struct gprs_ns2_nse *nse,
struct gprs_ns2_vc *nsvc,

View File

@ -46,6 +46,7 @@
#include <osmocom/core/fsm.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/socket.h>
#include <osmocom/core/sockaddr_str.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/gprs/gprs_msgb.h>
#include <osmocom/gprs/gprs_ns2.h>
@ -1534,6 +1535,25 @@ void gprs_ns2_sns_dump_vty(struct vty *vty, const struct gprs_ns2_nse *nse, bool
}
}
/*! write IP-SNS to a vty
* \param[in] vty VTY to which the state shall be printed
* \param[in] nse NS Entity whose IP-SNS state shall be printed */
void gprs_ns2_sns_write_vty(struct vty *vty, const struct gprs_ns2_nse *nse)
{
struct ns2_sns_state *gss;
struct osmo_sockaddr_str addr_str;
struct sns_endpoint *endpoint;
if (!nse->bss_sns_fi)
return;
gss = (struct ns2_sns_state *) nse->bss_sns_fi->priv;
llist_for_each_entry(endpoint, &gss->sns_endpoints, list) {
osmo_sockaddr_str_from_sockaddr(&addr_str, &endpoint->saddr.u.sas);
vty_out(vty, " ip-sns %s %u%s", addr_str.ip, addr_str.port, VTY_NEWLINE);
}
}
static struct sns_endpoint *ns2_get_sns_endpoint(struct ns2_sns_state *state,
const struct osmo_sockaddr *saddr)
{

View File

@ -935,6 +935,9 @@ int gprs_ns2_vty_create() {
case GPRS_NS2_LL_FR_GRE:
dialect = NS2_DIALECT_STATIC_RESETBLOCK;
continue;
case GPRS_NS2_LL_UNDEF:
/* should not happen */
OSMO_ASSERT(false);
}
nse = gprs_ns2_nse_by_nsei(vty_nsi, vtyvc->nsei);
@ -984,6 +987,7 @@ int gprs_ns2_vty_create() {
break;
}
case GPRS_NS2_LL_FR_GRE:
case GPRS_NS2_LL_UNDEF:
continue;
}
}

1642
src/gb/gprs_ns2_vty2.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -164,6 +164,7 @@ gprs_ns2_sns_add_endpoint;
gprs_ns2_sns_del_endpoint;
gprs_ns2_vty_create;
gprs_ns2_vty_init;
gprs_ns2_vty2_init;
gprs_nsvc_create2;
gprs_nsvc_delete;