Harald Welte | 9413503 | 2010-06-30 17:21:19 +0200 | [diff] [blame] | 1 | /* VTY interface for our GPRS SNDCP implementation */ |
| 2 | |
| 3 | /* (C) 2010 by Harald Welte <laforge@gnumonks.org> |
| 4 | * |
| 5 | * All Rights Reserved |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 8 | * it under the terms of the GNU Affero General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or |
Harald Welte | 9413503 | 2010-06-30 17:21:19 +0200 | [diff] [blame] | 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 15 | * GNU Affero General Public License for more details. |
Harald Welte | 9413503 | 2010-06-30 17:21:19 +0200 | [diff] [blame] | 16 | * |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 17 | * You should have received a copy of the GNU Affero General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
Harald Welte | 9413503 | 2010-06-30 17:21:19 +0200 | [diff] [blame] | 19 | * |
| 20 | */ |
| 21 | |
| 22 | #include <stdlib.h> |
| 23 | #include <unistd.h> |
| 24 | #include <errno.h> |
| 25 | #include <stdint.h> |
| 26 | |
| 27 | #include <arpa/inet.h> |
| 28 | |
| 29 | #include <openbsc/gsm_data.h> |
Pablo Neira Ayuso | dd5fff4 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 30 | #include <osmocom/core/msgb.h> |
Harald Welte | 8b1713a | 2011-03-23 18:26:56 +0100 | [diff] [blame] | 31 | #include <osmocom/gsm/tlv.h> |
Pablo Neira Ayuso | dd5fff4 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 32 | #include <osmocom/core/talloc.h> |
| 33 | #include <osmocom/core/select.h> |
| 34 | #include <osmocom/core/rate_ctr.h> |
Harald Welte | 9413503 | 2010-06-30 17:21:19 +0200 | [diff] [blame] | 35 | #include <openbsc/debug.h> |
| 36 | #include <openbsc/signal.h> |
| 37 | #include <openbsc/gprs_llc.h> |
Philipp | 247a339 | 2016-08-10 12:12:43 +0200 | [diff] [blame] | 38 | #include <openbsc/gprs_sndcp.h> |
Harald Welte | 9413503 | 2010-06-30 17:21:19 +0200 | [diff] [blame] | 39 | |
| 40 | #include <osmocom/vty/vty.h> |
| 41 | #include <osmocom/vty/command.h> |
| 42 | |
| 43 | static void vty_dump_sne(struct vty *vty, struct gprs_sndcp_entity *sne) |
| 44 | { |
Harald Welte | 9413503 | 2010-06-30 17:21:19 +0200 | [diff] [blame] | 45 | vty_out(vty, " TLLI %08x SAPI=%u NSAPI=%u:%s", |
| 46 | sne->lle->llme->tlli, sne->lle->sapi, sne->nsapi, VTY_NEWLINE); |
| 47 | vty_out(vty, " Defrag: npdu=%u highest_seg=%u seg_have=0x%08x tot_len=%u%s", |
| 48 | sne->defrag.npdu, sne->defrag.highest_seg, sne->defrag.seg_have, |
| 49 | sne->defrag.tot_len, VTY_NEWLINE); |
| 50 | } |
| 51 | |
| 52 | |
| 53 | DEFUN(show_sndcp, show_sndcp_cmd, |
| 54 | "show sndcp", |
| 55 | SHOW_STR "Display information about the SNDCP protocol") |
| 56 | { |
| 57 | struct gprs_sndcp_entity *sne; |
| 58 | |
| 59 | vty_out(vty, "State of SNDCP Entities%s", VTY_NEWLINE); |
| 60 | llist_for_each_entry(sne, &gprs_sndcp_entities, list) |
| 61 | vty_dump_sne(vty, sne); |
| 62 | |
| 63 | return CMD_SUCCESS; |
| 64 | } |
| 65 | |
| 66 | int gprs_sndcp_vty_init(void) |
| 67 | { |
| 68 | install_element_ve(&show_sndcp_cmd); |
| 69 | |
| 70 | return 0; |
| 71 | } |