blob: adca3721eb2402bdf789f269ddcfd5c0e0c6a995 [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
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
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
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 */
22
23#include <stdlib.h>
24#include <unistd.h>
25#include <errno.h>
26#include <stdint.h>
27
28#include <arpa/inet.h>
29
30#include <openbsc/gsm_data.h>
31#include <osmocore/msgb.h>
32#include <osmocore/tlv.h>
33#include <osmocore/talloc.h>
34#include <osmocore/select.h>
35#include <osmocore/rate_ctr.h>
36#include <openbsc/debug.h>
37#include <openbsc/signal.h>
38#include <openbsc/gprs_llc.h>
39
40#include "gprs_sndcp.h"
41
42#include <osmocom/vty/vty.h>
43#include <osmocom/vty/command.h>
44
45static void vty_dump_sne(struct vty *vty, struct gprs_sndcp_entity *sne)
46{
47 unsigned int i;
48
49 vty_out(vty, " TLLI %08x SAPI=%u NSAPI=%u:%s",
50 sne->lle->llme->tlli, sne->lle->sapi, sne->nsapi, VTY_NEWLINE);
51 vty_out(vty, " Defrag: npdu=%u highest_seg=%u seg_have=0x%08x tot_len=%u%s",
52 sne->defrag.npdu, sne->defrag.highest_seg, sne->defrag.seg_have,
53 sne->defrag.tot_len, VTY_NEWLINE);
54}
55
56
57DEFUN(show_sndcp, show_sndcp_cmd,
58 "show sndcp",
59 SHOW_STR "Display information about the SNDCP protocol")
60{
61 struct gprs_sndcp_entity *sne;
62
63 vty_out(vty, "State of SNDCP Entities%s", VTY_NEWLINE);
64 llist_for_each_entry(sne, &gprs_sndcp_entities, list)
65 vty_dump_sne(vty, sne);
66
67 return CMD_SUCCESS;
68}
69
70int gprs_sndcp_vty_init(void)
71{
72 install_element_ve(&show_sndcp_cmd);
73
74 return 0;
75}