blob: 430881fc8e15fe0532e396f69b2a9726bf7d317c [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
29#include <openbsc/gsm_data.h>
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010030#include <osmocom/core/msgb.h>
Harald Welted36ff762011-03-23 18:26:56 +010031#include <osmocom/gsm/tlv.h>
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010032#include <osmocom/core/talloc.h>
33#include <osmocom/core/select.h>
34#include <osmocom/core/rate_ctr.h>
Harald Weltef78a3b22010-06-30 17:21:19 +020035#include <openbsc/debug.h>
36#include <openbsc/signal.h>
37#include <openbsc/gprs_llc.h>
Philipp3ec03d52016-08-10 12:12:43 +020038#include <openbsc/gprs_sndcp.h>
Harald Weltef78a3b22010-06-30 17:21:19 +020039
40#include <osmocom/vty/vty.h>
41#include <osmocom/vty/command.h>
42
43static void vty_dump_sne(struct vty *vty, struct gprs_sndcp_entity *sne)
44{
Harald Weltef78a3b22010-06-30 17:21:19 +020045 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
53DEFUN(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
66int gprs_sndcp_vty_init(void)
67{
68 install_element_ve(&show_sndcp_cmd);
69
70 return 0;
71}