blob: 5a755d5f718676a00619f948fd67369c459004bc [file] [log] [blame]
Jonathan Santos03fd8d02011-05-25 13:54:02 -04001/* 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 Affero General Public License as published by
9 * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
16 *
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/>.
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>
30#include <osmocore/msgb.h>
31#include <osmocore/tlv.h>
32#include <osmocore/talloc.h>
33#include <osmocore/select.h>
34#include <osmocore/rate_ctr.h>
35#include <openbsc/debug.h>
36#include <openbsc/signal.h>
37#include <openbsc/gprs_llc.h>
38
39#include "gprs_sndcp.h"
40
41#include <osmocom/vty/vty.h>
42#include <osmocom/vty/command.h>
43
44static void vty_dump_sne(struct vty *vty, struct gprs_sndcp_entity *sne)
45{
46 unsigned int i;
47
48 vty_out(vty, " TLLI %08x SAPI=%u NSAPI=%u:%s",
49 sne->lle->llme->tlli, sne->lle->sapi, sne->nsapi, VTY_NEWLINE);
50 vty_out(vty, " Defrag: npdu=%u highest_seg=%u seg_have=0x%08x tot_len=%u%s",
51 sne->defrag.npdu, sne->defrag.highest_seg, sne->defrag.seg_have,
52 sne->defrag.tot_len, VTY_NEWLINE);
53}
54
55
56DEFUN(show_sndcp, show_sndcp_cmd,
57 "show sndcp",
58 SHOW_STR "Display information about the SNDCP protocol")
59{
60 struct gprs_sndcp_entity *sne;
61
62 vty_out(vty, "State of SNDCP Entities%s", VTY_NEWLINE);
63 llist_for_each_entry(sne, &gprs_sndcp_entities, list)
64 vty_dump_sne(vty, sne);
65
66 return CMD_SUCCESS;
67}
68
69int gprs_sndcp_vty_init(void)
70{
71 install_element_ve(&show_sndcp_cmd);
72
73 return 0;
74}