blob: 0994a4cd2c1d24b407fa741f07c535e7151f01f2 [file] [log] [blame]
Harald Weltef78a3b22010-06-30 17:21:19 +02001/* 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 Welte9af6ddf2011-01-01 15:25:50 +01008 * 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 Weltef78a3b22010-06-30 17:21:19 +020010 * (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 Welte9af6ddf2011-01-01 15:25:50 +010015 * GNU Affero General Public License for more details.
Harald Weltef78a3b22010-06-30 17:21:19 +020016 *
Harald Welte9af6ddf2011-01-01 15:25:50 +010017 * 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 Weltef78a3b22010-06-30 17:21:19 +020019 *
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
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010029#include <osmocom/core/msgb.h>
Harald Welted36ff762011-03-23 18:26:56 +010030#include <osmocom/gsm/tlv.h>
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010031#include <osmocom/core/talloc.h>
32#include <osmocom/core/select.h>
33#include <osmocom/core/rate_ctr.h>
Neels Hofmeyr396f2e62017-09-04 15:13:25 +020034#include <osmocom/sgsn/debug.h>
35#include <osmocom/sgsn/signal.h>
36#include <osmocom/sgsn/gprs_llc.h>
37#include <osmocom/sgsn/gprs_sndcp.h>
Harald Weltef78a3b22010-06-30 17:21:19 +020038
39#include <osmocom/vty/vty.h>
40#include <osmocom/vty/command.h>
41
42static void vty_dump_sne(struct vty *vty, struct gprs_sndcp_entity *sne)
43{
Harald Weltef78a3b22010-06-30 17:21:19 +020044 vty_out(vty, " TLLI %08x SAPI=%u NSAPI=%u:%s",
45 sne->lle->llme->tlli, sne->lle->sapi, sne->nsapi, VTY_NEWLINE);
46 vty_out(vty, " Defrag: npdu=%u highest_seg=%u seg_have=0x%08x tot_len=%u%s",
47 sne->defrag.npdu, sne->defrag.highest_seg, sne->defrag.seg_have,
48 sne->defrag.tot_len, VTY_NEWLINE);
49}
50
51
52DEFUN(show_sndcp, show_sndcp_cmd,
53 "show sndcp",
54 SHOW_STR "Display information about the SNDCP protocol")
55{
56 struct gprs_sndcp_entity *sne;
57
58 vty_out(vty, "State of SNDCP Entities%s", VTY_NEWLINE);
59 llist_for_each_entry(sne, &gprs_sndcp_entities, list)
60 vty_dump_sne(vty, sne);
61
62 return CMD_SUCCESS;
63}
64
65int gprs_sndcp_vty_init(void)
66{
67 install_element_ve(&show_sndcp_cmd);
68
69 return 0;
70}