2 * (C) 2010 by Andreas Eversberg <jolly@eversberg.eu>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include <sys/types.h>
28 #include <osmocom/vty.h>
29 #include <osmocom/vty/telnet_interface.h>
31 #include <osmocore/gsm48.h>
32 #include <osmocom/osmocom_data.h>
33 #include <osmocom/networks.h>
34 #include <osmocom/mncc.h>
35 #include <osmocom/transaction.h>
37 int mncc_call(struct osmocom_ms *ms, char *number);
38 int mncc_hangup(struct osmocom_ms *ms);
39 int mncc_answer(struct osmocom_ms *ms);
40 int mncc_hold(struct osmocom_ms *ms);
41 int mncc_retrieve(struct osmocom_ms *ms, int number);
43 extern struct llist_head ms_list;
44 extern struct llist_head active_connections;
46 struct cmd_node ms_node = {
52 struct cmd_node testsim_node = {
58 static void print_vty(void *priv, const char *fmt, ...)
61 struct vty *vty = priv;
65 vsnprintf(buffer, sizeof(buffer) - 1, fmt, args);
66 buffer[sizeof(buffer) - 1] = '\0';
70 if (buffer[strlen(buffer) - 1] == '\n') {
71 buffer[strlen(buffer) - 1] = '\0';
72 vty_out(vty, "%s%s", buffer, VTY_NEWLINE);
74 vty_out(vty, "%s", buffer);
78 static struct osmocom_ms *get_ms(const char *name, struct vty *vty)
80 struct osmocom_ms *ms;
82 llist_for_each_entry(ms, &ms_list, entity) {
83 if (!strcmp(ms->name, name))
86 vty_out(vty, "MS name '%s' does not exits.%s", name, VTY_NEWLINE);
91 DEFUN(show_ms, show_ms_cmd, "show ms",
92 SHOW_STR "Display available MS entities\n")
94 struct osmocom_ms *ms;
96 llist_for_each_entry(ms, &ms_list, entity) {
97 struct gsm_settings *set = &ms->settings;
99 vty_out(vty, "MS NAME: %s%s", ms->name, VTY_NEWLINE);
100 vty_out(vty, " IMEI: %s%s", set->imei, VTY_NEWLINE);
101 vty_out(vty, " IMEISV: %s%s", set->imeisv, VTY_NEWLINE);
102 if (set->imei_random)
103 vty_out(vty, " IMEI generation: random (%d trailing "
104 "digits)%s", set->imei_random, VTY_NEWLINE);
106 vty_out(vty, " IMEI generation: fixed%s", VTY_NEWLINE);
107 vty_out(vty, " network selection mode: %s%s",
108 (set->plmn_mode == PLMN_MODE_AUTO)
109 ? "automatic" : "manual", VTY_NEWLINE);
115 DEFUN(show_support, show_support_cmd, "show support [ms_name]",
116 SHOW_STR "Display information about MS support\n"
117 "Name of MS (see \"show ms\")")
119 struct osmocom_ms *ms;
122 ms = get_ms(argv[0], vty);
125 gsm_support_dump(&ms->support, print_vty, vty);
127 llist_for_each_entry(ms, &ms_list, entity) {
128 gsm_support_dump(&ms->support, print_vty, vty);
129 vty_out(vty, "%s", VTY_NEWLINE);
136 static void gsm_states_dump(struct osmocom_ms *ms, struct vty *vty)
138 struct gsm_trans *trans;
140 vty_out(vty, "Current state of MS '%s'%s", ms->name, VTY_NEWLINE);
141 if (ms->settings.plmn_mode == PLMN_MODE_AUTO)
142 vty_out(vty, " automatic network selection: %s%s",
143 plmn_a_state_names[ms->plmn.state], VTY_NEWLINE);
145 vty_out(vty, " manual network selection: %s%s",
146 plmn_m_state_names[ms->plmn.state], VTY_NEWLINE);
147 vty_out(vty, " cell selection: %s%s",
148 cs_state_names[ms->cellsel.state], VTY_NEWLINE);
149 vty_out(vty, " radio ressource layer: %s%s",
150 gsm48_rr_state_names[ms->rrlayer.state], VTY_NEWLINE);
151 vty_out(vty, " mobility management layer: %s",
152 gsm48_mm_state_names[ms->mmlayer.state]);
153 if (ms->mmlayer.state == GSM48_MM_ST_MM_IDLE)
155 gsm48_mm_substate_names[ms->mmlayer.substate]);
156 vty_out(vty, "%s", VTY_NEWLINE);
157 llist_for_each_entry(trans, &ms->trans_list, entry) {
158 vty_out(vty, " call control: %s%s",
159 gsm48_cc_state_name(trans->cc.state), VTY_NEWLINE);
163 DEFUN(show_states, show_states_cmd, "show states [ms_name]",
164 SHOW_STR "Display current states of given MS\n"
165 "Name of MS (see \"show ms\")")
167 struct osmocom_ms *ms;
170 ms = get_ms(argv[0], vty);
173 gsm_states_dump(ms, vty);
175 llist_for_each_entry(ms, &ms_list, entity) {
176 gsm_states_dump(ms, vty);
177 vty_out(vty, "%s", VTY_NEWLINE);
184 DEFUN(show_subscr, show_subscr_cmd, "show subscriber [ms_name]",
185 SHOW_STR "Display information about subscriber\n"
186 "Name of MS (see \"show ms\")")
188 struct osmocom_ms *ms;
191 ms = get_ms(argv[0], vty);
194 gsm_subscr_dump(&ms->subscr, print_vty, vty);
196 llist_for_each_entry(ms, &ms_list, entity) {
197 gsm_subscr_dump(&ms->subscr, print_vty, vty);
198 vty_out(vty, "%s", VTY_NEWLINE);
205 DEFUN(show_cell, show_cell_cmd, "show cell MS_NAME",
206 SHOW_STR "Display information about received cells\n"
207 "Name of MS (see \"show ms\")")
209 struct osmocom_ms *ms;
211 ms = get_ms(argv[0], vty);
215 gsm322_dump_cs_list(&ms->cellsel, GSM322_CS_FLAG_SYSINFO, print_vty,
221 DEFUN(show_cell_si, show_cell_si_cmd, "show cell MS_NAME <0-1023>",
222 SHOW_STR "Display information about received cell\n"
223 "Name of MS (see \"show ms\")\nRadio frequency number")
225 struct osmocom_ms *ms;
227 struct gsm48_sysinfo *s;
229 ms = get_ms(argv[0], vty);
234 if (i < 0 || i > 1023) {
235 vty_out(vty, "Given ARFCN '%s' not in range (0..1023)%s",
236 argv[1], VTY_NEWLINE);
239 s = ms->cellsel.list[i].sysinfo;
241 vty_out(vty, "Given ARFCN '%s' has no sysinfo available%s",
242 argv[1], VTY_NEWLINE);
246 gsm48_sysinfo_dump(s, i, print_vty, vty);
251 DEFUN(show_ba, show_ba_cmd, "show ba MS_NAME [mcc] [mnc]",
252 SHOW_STR "Display information about band allocations\n"
253 "Name of MS (see \"show ms\")\nMobile Country Code\n"
254 "Mobile Network Code")
256 struct osmocom_ms *ms;
257 uint16_t mcc = 0, mnc = 0;
259 ms = get_ms(argv[0], vty);
264 mcc = gsm_input_mcc((char *)argv[1]);
265 mnc = gsm_input_mnc((char *)argv[2]);
267 vty_out(vty, "Given MCC invalid%s", VTY_NEWLINE);
271 vty_out(vty, "Given MNC invalid%s", VTY_NEWLINE);
276 gsm322_dump_ba_list(&ms->cellsel, mcc, mnc, print_vty, vty);
281 DEFUN(show_forb_plmn, show_forb_plmn_cmd, "show forbidden plmn MS_NAME",
282 SHOW_STR "Display information about forbidden cells / networks\n"
283 "Display forbidden PLMNs\nName of MS (see \"show ms\")")
285 struct osmocom_ms *ms;
287 ms = get_ms(argv[0], vty);
291 gsm_subscr_dump_forbidden_plmn(ms, print_vty, vty);
296 DEFUN(show_forb_la, show_forb_la_cmd, "show forbidden location-area MS_NAME",
297 SHOW_STR "Display information about forbidden cells / networks\n"
298 "Display forbidden location areas\nName of MS (see \"show ms\")")
300 struct osmocom_ms *ms;
302 ms = get_ms(argv[0], vty);
306 gsm322_dump_forbidden_la(ms, print_vty, vty);
311 DEFUN(insert_test, insert_test_cmd, "insert testcard MS_NAME [mcc] [mnc]",
312 "Insert ...\nInsert test card\nName of MS (see \"show ms\")\n"
313 "Mobile Country Code\nMobile Network Code")
315 struct osmocom_ms *ms;
316 uint16_t mcc = 1, mnc = 1;
318 ms = get_ms(argv[0], vty);
322 if (ms->subscr.sim_valid) {
323 vty_out(vty, "Sim already presend, remove first!%s",
329 mcc = gsm_input_mcc((char *)argv[1]);
330 mnc = gsm_input_mnc((char *)argv[2]);
332 vty_out(vty, "Given MCC invalid%s", VTY_NEWLINE);
336 vty_out(vty, "Given MNC invalid%s", VTY_NEWLINE);
341 gsm_subscr_testcard(ms);
346 DEFUN(remove_sim, remove_sim_cmd, "remove sim MS_NAME",
347 "Remove ...\nRemove SIM card\nName of MS (see \"show ms\")")
349 struct osmocom_ms *ms;
351 ms = get_ms(argv[0], vty);
355 if (!ms->subscr.sim_valid) {
356 vty_out(vty, "No Sim inserted!%s", VTY_NEWLINE);
360 gsm_subscr_remove(ms);
365 DEFUN(network_select, network_select_cmd, "network select MS_NAME MCC MNC",
366 "Select ...\nSelect Network\nName of MS (see \"show ms\")\n"
367 "Mobile Country Code\nMobile Network Code")
369 struct osmocom_ms *ms;
370 struct gsm322_plmn *plmn;
372 struct gsm322_msg *ngm;
373 struct gsm322_plmn_list *temp;
374 uint16_t mcc = gsm_input_mcc((char *)argv[1]),
375 mnc = gsm_input_mnc((char *)argv[2]);
378 ms = get_ms(argv[0], vty);
384 vty_out(vty, "Given MCC invalid%s", VTY_NEWLINE);
388 vty_out(vty, "Given MNC invalid%s", VTY_NEWLINE);
392 llist_for_each_entry(temp, &plmn->sorted_plmn, entry)
393 if (temp->mcc == mcc && temp->mnc == mnc)
396 vty_out(vty, "Network not in list!%s", VTY_NEWLINE);
400 nmsg = gsm322_msgb_alloc(GSM322_EVENT_CHOSE_PLMN);
403 ngm = (struct gsm322_msg *) nmsg->data;
406 gsm322_plmn_sendmsg(ms, nmsg);
411 DEFUN(call, call_cmd, "call MS_NAME (NUMBER|emergency|answer|hangup|hold)",
412 "Make a call\nName of MS (see \"show ms\")\nPhone number to call\n"
413 "Make an emergency call\nAnswer an incomming call\nHangup a call\n"
414 "Hold current active call\n")
416 struct osmocom_ms *ms;
418 ms = get_ms(argv[0], vty);
422 switch (argv[1][0]) {
427 if (argv[1][1] == 'a')
433 mncc_call(ms, (char *)argv[1]);
439 DEFUN(call_retr, call_retr_cmd, "call MS_NAME retrieve [number]",
440 "Make a call\nName of MS (see \"show ms\")\n"
441 "Retrieve call on hold\nNumber of call to retrieve")
443 struct osmocom_ms *ms;
445 ms = get_ms(argv[0], vty);
449 mncc_retrieve(ms, (argc > 1) ? atoi(argv[1]) : 0);
454 DEFUN(network_show, network_show_cmd, "network show MS_NAME",
455 "Network ...\nShow results of network search (again)\n"
456 "Name of MS (see \"show ms\")")
458 struct osmocom_ms *ms;
459 struct gsm322_plmn *plmn;
460 struct gsm322_plmn_list *temp;
462 ms = get_ms(argv[0], vty);
467 if (ms->settings.plmn_mode != PLMN_MODE_AUTO
468 && plmn->state != GSM322_M3_NOT_ON_PLMN) {
469 vty_out(vty, "Start network search first!%s", VTY_NEWLINE);
473 llist_for_each_entry(temp, &plmn->sorted_plmn, entry)
474 vty_out(vty, " Network %s, %s (%s, %s)%s",
475 gsm_print_mcc(temp->mcc), gsm_print_mnc(temp->mnc),
476 gsm_get_mcc(temp->mcc),
477 gsm_get_mnc(temp->mcc, temp->mnc), VTY_NEWLINE);
482 DEFUN(network_search, network_search_cmd, "network search MS_NAME",
483 "Network ...\nTrigger network search\nName of MS (see \"show ms\")")
485 struct osmocom_ms *ms;
488 ms = get_ms(argv[0], vty);
492 nmsg = gsm322_msgb_alloc(GSM322_EVENT_USER_RESEL);
495 gsm322_plmn_sendmsg(ms, nmsg);
501 DEFUN(cfg_ms, cfg_ms_cmd, "ms MS_NAME",
502 "Select a mobile station to configure\nName of MS (see \"show ms\")")
504 struct osmocom_ms *ms;
506 ms = get_ms(argv[0], vty);
516 static void config_write_ms_single(struct vty *vty, struct osmocom_ms *ms)
518 struct gsm_settings *set = &ms->settings;
520 vty_out(vty, "ms %s%s", ms->name, VTY_NEWLINE);
521 switch(ms->settings.simtype) {
522 case GSM_SIM_TYPE_NONE:
523 vty_out(vty, " sim none%s", VTY_NEWLINE);
525 case GSM_SIM_TYPE_SLOT:
526 vty_out(vty, " sim slot%s", VTY_NEWLINE);
528 case GSM_SIM_TYPE_TEST:
529 vty_out(vty, " sim test%s", VTY_NEWLINE);
532 vty_out(vty, " network-selection-mode %s%s", (set->plmn_mode
533 == PLMN_MODE_AUTO) ? "auto" : "manual", VTY_NEWLINE);
534 vty_out(vty, " imei %s %s%s", set->imei,
535 set->imeisv + strlen(set->imei), VTY_NEWLINE);
536 if (set->imei_random)
537 vty_out(vty, " imei-random %d%s", set->imei_random,
540 vty_out(vty, " imei-fixed%s", VTY_NEWLINE);
541 vty_out(vty, " emergency-imsi %s%s", (ms->settings.emergency_imsi[0]) ?
542 ms->settings.emergency_imsi : "none", VTY_NEWLINE);
543 vty_out(vty, " %scall-waiting%s", (set->cw) ? "" : "no ", VTY_NEWLINE);
544 vty_out(vty, " %sclip%s", (set->clip) ? "" : "no ", VTY_NEWLINE);
545 vty_out(vty, " %sclir%s", (set->clir) ? "" : "no ", VTY_NEWLINE);
546 vty_out(vty, " test-sim%s", VTY_NEWLINE);
547 vty_out(vty, " imsi %s%s", ms->settings.test_imsi, VTY_NEWLINE);
548 vty_out(vty, " %sbarred-access%s", (set->test_barr) ? "" : "no ",
550 if (ms->settings.test_rplmn_valid)
551 vty_out(vty, " rplmn %s %s%s",
552 gsm_print_mcc(ms->settings.test_rplmn_mcc),
553 gsm_print_mnc(ms->settings.test_rplmn_mnc),
556 vty_out(vty, " no rplmn%s", VTY_NEWLINE);
557 vty_out(vty, " hplmn-search %s%s", (set->test_always) ? "everywhere"
558 : "foreign-country", VTY_NEWLINE);
559 vty_out(vty, " exit%s", VTY_NEWLINE);
560 vty_out(vty, "exit%s", VTY_NEWLINE);
561 vty_out(vty, "!%s", VTY_NEWLINE);
564 static int config_write_ms(struct vty *vty)
566 struct osmocom_ms *ms;
568 llist_for_each_entry(ms, &ms_list, entity)
569 config_write_ms_single(vty, ms);
574 DEFUN(cfg_ms_mode, cfg_ms_mode_cmd, "network-selection-mode (auto|manual)",
575 "Set network selection mode\nAutomatic network selection\n"
576 "Manual network selection")
578 struct osmocom_ms *ms = vty->index;
581 if (!ms->plmn.state) {
582 if (argv[0][0] == 'a')
583 ms->settings.plmn_mode = PLMN_MODE_AUTO;
585 ms->settings.plmn_mode = PLMN_MODE_MANUAL;
589 if (argv[0][0] == 'a')
590 nmsg = gsm322_msgb_alloc(GSM322_EVENT_SEL_AUTO);
592 nmsg = gsm322_msgb_alloc(GSM322_EVENT_SEL_MANUAL);
595 gsm322_plmn_sendmsg(ms, nmsg);
600 DEFUN(cfg_ms_imei, cfg_ms_imei_cmd, "imei IMEI [SV]",
601 "Set IMEI (enter without control digit)\n15 Digits IMEI\n"
602 "Software version digit")
604 struct osmocom_ms *ms = vty->index;
605 char *error, *sv = "0";
608 sv = (char *)argv[1];
610 error = gsm_check_imei(argv[0], sv);
612 vty_out(vty, "%s%s", error, VTY_NEWLINE);
616 strcpy(ms->settings.imei, argv[0]);
617 strcpy(ms->settings.imeisv, argv[0]);
618 strcpy(ms->settings.imeisv + 15, sv);
623 DEFUN(cfg_ms_imei_fixed, cfg_ms_imei_fixed_cmd, "imei-fixed",
624 "Use fixed IMEI on every power on")
626 struct osmocom_ms *ms = vty->index;
628 ms->settings.imei_random = 0;
633 DEFUN(cfg_ms_imei_random, cfg_ms_imei_random_cmd, "imei-random <0-15>",
634 "Use random IMEI on every power on\n"
635 "Number of trailing digits to randomize")
637 struct osmocom_ms *ms = vty->index;
639 ms->settings.imei_random = atoi(argv[0]);
644 DEFUN(cfg_ms_emerg_imsi, cfg_ms_emerg_imsi_cmd, "emergency-imsi (none|IMSI)",
645 "Use IMSI for emergency calls\n"
646 "Use IMSI of SIM or IMEI for emergency calls\n15 digits IMSI")
648 struct osmocom_ms *ms = vty->index;
651 if (argv[0][0] == 'n') {
652 ms->settings.emergency_imsi[0] = '\0';
656 error = gsm_check_imsi(argv[0]);
658 vty_out(vty, "%s%s", error, VTY_NEWLINE);
661 strcpy(ms->settings.emergency_imsi, argv[0]);
666 DEFUN(cfg_no_cw, cfg_ms_no_cw_cmd, "no call-waiting",
667 NO_STR "Disallow waiting calls")
669 struct osmocom_ms *ms = vty->index;
676 DEFUN(cfg_cw, cfg_ms_cw_cmd, "call-waiting",
677 "Allow waiting calls")
679 struct osmocom_ms *ms = vty->index;
686 DEFUN(cfg_clip, cfg_ms_clip_cmd, "clip",
687 "Force caller ID presentation")
689 struct osmocom_ms *ms = vty->index;
691 ms->settings.clip = 1;
692 ms->settings.clir = 0;
697 DEFUN(cfg_clir, cfg_ms_clir_cmd, "clir",
698 "Force caller ID restriction")
700 struct osmocom_ms *ms = vty->index;
702 ms->settings.clip = 0;
703 ms->settings.clir = 1;
708 DEFUN(cfg_no_clip, cfg_ms_no_clip_cmd, "no clip",
709 NO_STR "Disable forcing of caller ID presentation")
711 struct osmocom_ms *ms = vty->index;
713 ms->settings.clip = 0;
718 DEFUN(cfg_no_clir, cfg_ms_no_clir_cmd, "no clir",
719 NO_STR "Disable forcing of caller ID restriction")
721 struct osmocom_ms *ms = vty->index;
723 ms->settings.clir = 0;
728 DEFUN(cfg_ms_sim, cfg_ms_sim_cmd, "sim (none|test)",
729 "Set sim card type when powering on\nNo sim interted\n"
732 struct osmocom_ms *ms = vty->index;
734 switch (argv[0][0]) {
736 ms->settings.simtype = GSM_SIM_TYPE_NONE;
739 ms->settings.simtype = GSM_SIM_TYPE_SLOT;
742 ms->settings.simtype = GSM_SIM_TYPE_TEST;
750 DEFUN(cfg_testsim, cfg_testsim_cmd, "test-sim",
751 "Configure test SIM emulation")
753 vty->node = TESTSIM_NODE;
758 static int config_write_dummy(struct vty *vty)
763 DEFUN(cfg_test_imsi, cfg_test_imsi_cmd, "imsi IMSI",
764 "Set IMSI on test card\n15 digits IMSI")
766 struct osmocom_ms *ms = vty->index;
767 char *error = gsm_check_imsi(argv[0]);
770 vty_out(vty, "%s%s", error, VTY_NEWLINE);
774 strcpy(ms->settings.test_imsi, argv[0]);
779 DEFUN(cfg_test_barr, cfg_test_barr_cmd, "barred-access",
780 "Allow access to barred cells")
782 struct osmocom_ms *ms = vty->index;
784 ms->settings.test_barr = 1;
789 DEFUN(cfg_test_no_barr, cfg_test_no_barr_cmd, "no barred-access",
790 NO_STR "Deny access to barred cells")
792 struct osmocom_ms *ms = vty->index;
794 ms->settings.test_barr = 0;
799 DEFUN(cfg_test_no_rplmn, cfg_test_no_rplmn_cmd, "no rplmn",
800 NO_STR "Unset Registered PLMN")
802 struct osmocom_ms *ms = vty->index;
804 ms->settings.test_rplmn_valid = 0;
809 DEFUN(cfg_test_rplmn, cfg_test_rplmn_cmd, "rplmn MCC MNC",
810 "Set Registered PLMN\nMobile Country Code\nMobile Network Code")
812 struct osmocom_ms *ms = vty->index;
813 uint16_t mcc = gsm_input_mcc((char *)argv[0]),
814 mnc = gsm_input_mnc((char *)argv[1]);
817 vty_out(vty, "Given MCC invalid%s", VTY_NEWLINE);
821 vty_out(vty, "Given MNC invalid%s", VTY_NEWLINE);
824 ms->settings.test_rplmn_valid = 1;
825 ms->settings.test_rplmn_mcc = mcc;
826 ms->settings.test_rplmn_mnc = mnc;
831 DEFUN(cfg_test_hplmn, cfg_test_hplmn_cmd, "hplmn-search (everywhere|foreign-country)",
832 "Set Home PLMN search mode\n"
833 "Search for HPLMN when on any other network\n"
834 "Search for HPLMN when in a different country")
836 struct osmocom_ms *ms = vty->index;
838 switch (argv[0][0]) {
840 ms->settings.test_always = 1;
843 ms->settings.test_always = 0;
850 enum node_type ms_vty_go_parent(struct vty *vty)
854 vty->node = CONFIG_NODE;
861 vty->node = CONFIG_NODE;
867 /* Down vty node level. */
869 ournode_exit_cmd, "exit", "Exit current mode and down to previous mode\n")
873 vty->node = CONFIG_NODE;
885 /* End of configuration. */
887 ournode_end_cmd, "end", "End current mode and change to enable mode.")
898 vty_config_unlock(vty);
899 vty->node = ENABLE_NODE;
901 vty->index_sub = NULL;
909 int ms_vty_init(void)
911 install_element_ve(&show_ms_cmd);
912 install_element_ve(&show_subscr_cmd);
913 install_element_ve(&show_support_cmd);
914 install_element_ve(&show_states_cmd);
915 install_element_ve(&show_cell_cmd);
916 install_element_ve(&show_cell_si_cmd);
917 install_element_ve(&show_ba_cmd);
918 install_element_ve(&show_forb_la_cmd);
919 install_element_ve(&show_forb_plmn_cmd);
921 install_element(ENABLE_NODE, &insert_test_cmd);
922 install_element(ENABLE_NODE, &remove_sim_cmd);
923 install_element(ENABLE_NODE, &network_search_cmd);
924 install_element(ENABLE_NODE, &network_show_cmd);
925 install_element(ENABLE_NODE, &network_select_cmd);
926 install_element(ENABLE_NODE, &call_cmd);
927 install_element(ENABLE_NODE, &call_retr_cmd);
929 install_element(CONFIG_NODE, &cfg_ms_cmd);
930 install_element(CONFIG_NODE, &ournode_end_cmd);
931 install_node(&ms_node, config_write_ms);
932 install_default(MS_NODE);
933 install_element(MS_NODE, &ournode_exit_cmd);
934 install_element(MS_NODE, &ournode_end_cmd);
935 install_element(MS_NODE, &cfg_ms_mode_cmd);
936 install_element(MS_NODE, &cfg_ms_imei_cmd);
937 install_element(MS_NODE, &cfg_ms_imei_fixed_cmd);
938 install_element(MS_NODE, &cfg_ms_imei_random_cmd);
939 install_element(MS_NODE, &cfg_ms_emerg_imsi_cmd);
940 install_element(MS_NODE, &cfg_ms_cw_cmd);
941 install_element(MS_NODE, &cfg_ms_no_cw_cmd);
942 install_element(MS_NODE, &cfg_ms_clip_cmd);
943 install_element(MS_NODE, &cfg_ms_clir_cmd);
944 install_element(MS_NODE, &cfg_ms_no_clip_cmd);
945 install_element(MS_NODE, &cfg_ms_no_clir_cmd);
946 install_element(MS_NODE, &cfg_ms_sim_cmd);
948 install_element(MS_NODE, &cfg_testsim_cmd);
949 install_node(&testsim_node, config_write_dummy);
950 install_default(TESTSIM_NODE);
951 install_element(TESTSIM_NODE, &ournode_exit_cmd);
952 install_element(TESTSIM_NODE, &ournode_end_cmd);
953 install_element(TESTSIM_NODE, &cfg_test_imsi_cmd);
954 install_element(TESTSIM_NODE, &cfg_test_barr_cmd);
955 install_element(TESTSIM_NODE, &cfg_test_no_barr_cmd);
956 install_element(TESTSIM_NODE, &cfg_test_no_rplmn_cmd);
957 install_element(TESTSIM_NODE, &cfg_test_rplmn_cmd);
958 install_element(TESTSIM_NODE, &cfg_test_hplmn_cmd);
963 void vty_notify(struct osmocom_ms *ms, const char *fmt, ...)
965 struct telnet_connection *connection;
972 vsnprintf(buffer, sizeof(buffer) - 1, fmt, args);
973 buffer[sizeof(buffer) - 1] = '\0';
980 llist_for_each_entry(connection, &active_connections, entry) {
981 vty = connection->vty;
985 vty_out(vty, "%s%% (MS %s)%s", VTY_NEWLINE, ms->name,
989 if (buffer[strlen(buffer) - 1] == '\n') {
990 buffer[strlen(buffer) - 1] = '\0';
991 vty_out(vty, "%% %s%s", buffer, VTY_NEWLINE);
992 buffer[strlen(buffer)] = '\n';
994 vty_out(vty, "%% %s", buffer);