This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/709 hnbgw: move vty commands out to new hnbgw_vty.c Pass g_hnb_gw and tall_hnb_ctx to hnbgw_vty_init() as they are no longer statically available. Change-Id: If85c1b97a240bd1dcf9f367ea6fca857d542ab22 --- M src/Makefile.am M src/hnbgw.c M src/hnbgw.h A src/hnbgw_vty.c 4 files changed, 95 insertions(+), 63 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/09/709/1 diff --git a/src/Makefile.am b/src/Makefile.am index 2d078f3..17e60e2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -46,6 +46,7 @@ rua_encoder.c rua_decoder.c rua_common.c \ rua_msg_factory.c \ hnbgw.c hnbgw_hnbap.c hnbgw_rua.c hnbgw_ranap.c \ + hnbgw_vty.c \ context_map.c hnbgw_cn.c osmo_hnbgw_LDADD = $(OSMOCORE_LIBS) $(OSMOVTY_LIBS) $(OSMOGSM_LIBS) \ diff --git a/src/hnbgw.c b/src/hnbgw.c index 4cb3c69..d2e7b30 100644 --- a/src/hnbgw.c +++ b/src/hnbgw.c @@ -1,6 +1,7 @@ /* main application for hnb-gw part of osmo-iuh */ /* (C) 2015 by Harald Welte <laforge at gnumonks.org> + * (C) 2016 by sysmocom s.f.m.c. GmbH <info at sysmocom.de> * All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -43,7 +44,6 @@ #include <osmocom/vty/telnet_interface.h> #include <osmocom/vty/logging.h> -#include <osmocom/vty/command.h> #include <osmocom/netif/stream.h> @@ -327,67 +327,6 @@ .version = "0", }; -static void vty_dump_hnb_info(struct vty *vty, struct hnb_context *hnb) -{ - struct hnbgw_context_map *map; - - vty_out(vty, "HNB \"%s\" MCC %u MNC %u LAC %u RAC %u SAC %u CID %u%s", hnb->identity_info, - hnb->id.mcc, hnb->id.mnc, hnb->id.lac, hnb->id.rac, hnb->id.sac, hnb->id.cid, - VTY_NEWLINE); - vty_out(vty, " HNBAP ID %u RUA ID %u%s", hnb->hnbap_stream, hnb->rua_stream, VTY_NEWLINE); - - llist_for_each_entry(map, &hnb->map_list, hnb_list) { - vty_out(vty, " Map %u->%u (RUA->SUA) cnlink=%p state=%u%s", map->rua_ctx_id, map->scu_conn_id, - map->cn_link, map->state, VTY_NEWLINE); - - } -} - -static void vty_dump_ue_info(struct vty *vty, struct ue_context *ue) -{ - vty_out(vty, "UE IMSI \"%s\" context ID %u%s", ue->imsi, ue->context_id, VTY_NEWLINE); -} - -DEFUN(show_hnb, show_hnb_cmd, "show hnb all", SHOW_STR "Display information about a HNB") -{ - struct hnb_context *hnb; - - llist_for_each_entry(hnb, &g_hnb_gw->hnb_list, list) { - vty_dump_hnb_info(vty, hnb); - } - - return CMD_SUCCESS; -} - -DEFUN(show_ue, show_ue_cmd, "show ue all", SHOW_STR "Display information about a UE") -{ - struct ue_context *ue; - - llist_for_each_entry(ue, &g_hnb_gw->ue_list, list) { - vty_dump_ue_info(vty, ue); - } - - return CMD_SUCCESS; -} - -DEFUN(show_talloc, show_talloc_cmd, "show talloc", SHOW_STR "Display talloc info") -{ - talloc_report_full(tall_hnb_ctx, stderr); - talloc_report_full(talloc_asn1_ctx, stderr); - - return CMD_SUCCESS; -} - -static void hnbgw_vty_init(void) -{ - install_element_ve(&show_hnb_cmd); - install_element_ve(&show_ue_cmd); - install_element_ve(&show_talloc_cmd); - - logging_vty_add_cmds(&hnbgw_log_info); -} - - static struct { int daemonize; const char *config_file; @@ -499,7 +438,8 @@ vty_info.copyright = osmo_hnbgw_copyright; vty_init(&vty_info); - hnbgw_vty_init(); + hnbgw_vty_init(g_hnb_gw, tall_hnb_ctx); + logging_vty_add_cmds(&hnbgw_log_info); /* Handle options after vty_init(), for --version */ handle_options(argc, argv); diff --git a/src/hnbgw.h b/src/hnbgw.h index 9f010d9..9b5ae85 100644 --- a/src/hnbgw.h +++ b/src/hnbgw.h @@ -132,6 +132,8 @@ struct hnbgw_cnlink *cnlink_ps; }; +extern void *talloc_asn1_ctx; + struct ue_context *ue_context_by_id(struct hnb_gw *gw, uint32_t id); struct ue_context *ue_context_by_imsi(struct hnb_gw *gw, const char *imsi); struct ue_context *ue_context_alloc(struct hnb_context *hnb, const char *imsi); @@ -139,3 +141,5 @@ struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_link *link, int new_fd); void hnb_context_release(struct hnb_context *ctx); + +void hnbgw_vty_init(struct hnb_gw *gw, void *tall_ctx); diff --git a/src/hnbgw_vty.c b/src/hnbgw_vty.c new file mode 100644 index 0000000..f29b849 --- /dev/null +++ b/src/hnbgw_vty.c @@ -0,0 +1,87 @@ +/* HNB-GW interface to quagga VTY */ + +/* (C) 2016 by sysmocom s.f.m.c. GmbH <info at sysmocom.de> + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <osmocom/vty/command.h> + +#include "hnbgw.h" +#include "context_map.h" + +static void *tall_hnb_ctx = NULL; +static struct hnb_gw *g_hnb_gw = NULL; + +static void vty_dump_hnb_info(struct vty *vty, struct hnb_context *hnb) +{ + struct hnbgw_context_map *map; + + vty_out(vty, "HNB \"%s\" MCC %u MNC %u LAC %u RAC %u SAC %u CID %u%s", hnb->identity_info, + hnb->id.mcc, hnb->id.mnc, hnb->id.lac, hnb->id.rac, hnb->id.sac, hnb->id.cid, + VTY_NEWLINE); + vty_out(vty, " HNBAP ID %u RUA ID %u%s", hnb->hnbap_stream, hnb->rua_stream, VTY_NEWLINE); + + llist_for_each_entry(map, &hnb->map_list, hnb_list) { + vty_out(vty, " Map %u->%u (RUA->SUA) cnlink=%p state=%u%s", map->rua_ctx_id, map->scu_conn_id, + map->cn_link, map->state, VTY_NEWLINE); + + } +} + +static void vty_dump_ue_info(struct vty *vty, struct ue_context *ue) +{ + vty_out(vty, "UE IMSI \"%s\" context ID %u%s", ue->imsi, ue->context_id, VTY_NEWLINE); +} + +DEFUN(show_hnb, show_hnb_cmd, "show hnb all", SHOW_STR "Display information about a HNB") +{ + struct hnb_context *hnb; + + llist_for_each_entry(hnb, &g_hnb_gw->hnb_list, list) { + vty_dump_hnb_info(vty, hnb); + } + + return CMD_SUCCESS; +} + +DEFUN(show_ue, show_ue_cmd, "show ue all", SHOW_STR "Display information about a UE") +{ + struct ue_context *ue; + + llist_for_each_entry(ue, &g_hnb_gw->ue_list, list) { + vty_dump_ue_info(vty, ue); + } + + return CMD_SUCCESS; +} + +DEFUN(show_talloc, show_talloc_cmd, "show talloc", SHOW_STR "Display talloc info") +{ + talloc_report_full(tall_hnb_ctx, stderr); + talloc_report_full(talloc_asn1_ctx, stderr); + + return CMD_SUCCESS; +} + +void hnbgw_vty_init(struct hnb_gw *gw, void *tall_ctx) +{ + g_hnb_gw = gw; + tall_hnb_ctx = tall_ctx; + install_element_ve(&show_hnb_cmd); + install_element_ve(&show_ue_cmd); + install_element_ve(&show_talloc_cmd); +} -- To view, visit https://gerrit.osmocom.org/709 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If85c1b97a240bd1dcf9f367ea6fca857d542ab22 Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>