aboutsummaryrefslogtreecommitdiffstats
path: root/src/diag_log_simcard.c
blob: 1365df15e027293c6b8acdea303cc78795a09a34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* Utility code for DIAG UIM (Simcard) Logging */
/*
 * (C) 2016 by Harald Welte <laforge@gnumonks.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include <errno.h>
#include <string.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/msgb.h>

#include "diag_log.h"
#include "diag_io.h"
#include "protocol/diagcmd.h"
#include "protocol/diag_log_1x.h"

static void handle_uim_data(struct log_hdr *lh, struct msgb *msg)
{
	struct diag_log_uim_msg *uim = (struct diag_log_uim_msg *) msgb_data(msg);
	printf("UIM_DATA { %s }\n", msgb_hexdump(msg));
}

static void handle_uim_ds_data(struct log_hdr *lh, struct msgb *msg)
{
	printf("UIM_DS_DATA {}\n");
}


static const struct diag_log_dispatch_tbl log_tbl[] = {
	{ L1X(LOG_UIM_DATA_C), handle_uim_data },
	{ L1X(LOG_UIM_DS_DATA_C), handle_uim_ds_data },
};

static __attribute__((constructor)) void on_dso_load_gsm(void)
{
	diag_log_reg_dispatch(log_tbl, ARRAY_SIZE(log_tbl));
}