summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-09-10 10:49:59 +0200
committerHarald Welte <laforge@gnumonks.org>2014-10-26 19:09:22 +0100
commitad41863b8d3f3ac7df0c34b2c7d342b864d944cc (patch)
treed8c28dce9b084dccc01b942e3fa3a69e927a7dbb /src
parenta0ba4d943816a10e78984d8bbca56fbdbdfe82bb (diff)
sim: add copyright notices and merge file_codec.c into core.c
Diffstat (limited to 'src')
-rw-r--r--src/sim/Makefile.am2
-rw-r--r--src/sim/card_fs_sim.c21
-rw-r--r--src/sim/card_fs_uicc.c23
-rw-r--r--src/sim/card_fs_usim.c22
-rw-r--r--src/sim/core.c54
-rw-r--r--src/sim/file_codec.c34
-rw-r--r--src/sim/reader.c23
-rw-r--r--src/sim/reader_pcsc.c23
8 files changed, 163 insertions, 39 deletions
diff --git a/src/sim/Makefile.am b/src/sim/Makefile.am
index f3f8069c..53f78bdf 100644
--- a/src/sim/Makefile.am
+++ b/src/sim/Makefile.am
@@ -9,7 +9,7 @@ noinst_HEADERS = sim_int.h gsm_int.h
lib_LTLIBRARIES = libosmosim.la
-libosmosim_la_SOURCES = core.c card_fs_sim.c card_fs_usim.c card_fs_uicc.c file_codec.c reader.c reader_pcsc.c
+libosmosim_la_SOURCES = core.c card_fs_sim.c card_fs_usim.c card_fs_uicc.c reader.c reader_pcsc.c
# FIXME: use autoconf to determine pcsc include path / library name
libosmosim_la_LDFLAGS = -version-info $(LIBVERSION) -lpcsclite
libosmosim_la_CFLAGS = -I/usr/include/PCSC
diff --git a/src/sim/card_fs_sim.c b/src/sim/card_fs_sim.c
index d8421505..df6e4e63 100644
--- a/src/sim/card_fs_sim.c
+++ b/src/sim/card_fs_sim.c
@@ -1,3 +1,24 @@
+/* classic SIM card specific structures/routines */
+/*
+ * (C) 2012 by Harald Welte <laforge@gnumonks.org>
+ *
+ * All Rights Reserved
+ *
+ * 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>
diff --git a/src/sim/card_fs_uicc.c b/src/sim/card_fs_uicc.c
index 03dbad32..70737b6f 100644
--- a/src/sim/card_fs_uicc.c
+++ b/src/sim/card_fs_uicc.c
@@ -1,3 +1,26 @@
+/* ETSI UICC specific structures / routines */
+/*
+ * (C) 2012 by Harald Welte <laforge@gnumonks.org>
+ *
+ * All Rights Reserved
+ *
+ * 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 <osmocom/sim/sim.h>
#include <osmocom/gsm/tlv.h>
diff --git a/src/sim/card_fs_usim.c b/src/sim/card_fs_usim.c
index 361c2e88..5a351b82 100644
--- a/src/sim/card_fs_usim.c
+++ b/src/sim/card_fs_usim.c
@@ -1,3 +1,25 @@
+/* 3GPP USIM specific structures / routines */
+/*
+ * (C) 2012 by Harald Welte <laforge@gnumonks.org>
+ *
+ * All Rights Reserved
+ *
+ * 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>
diff --git a/src/sim/core.c b/src/sim/core.c
index 40a49cf2..bc0d05c8 100644
--- a/src/sim/core.c
+++ b/src/sim/core.c
@@ -1,9 +1,59 @@
+/* Core routines for SIM/UICC/USIM access */
+/*
+ * (C) 2012 by Harald Welte <laforge@gnumonks.org>
+ *
+ * All Rights Reserved
+ *
+ * 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 <stdlib.h>
#include <stdint.h>
#include <osmocom/core/talloc.h>
#include <osmocom/sim/sim.h>
+struct osim_decoded_data *osim_file_decode(struct osim_file *file,
+ int len, uint8_t *data)
+{
+ struct osim_decoded_data *dd;
+
+ if (!file->desc->ops.parse)
+ return NULL;
+
+ dd = talloc_zero(file, struct osim_decoded_data);
+ dd->file = file;
+
+ if (file->desc->ops.parse(dd, file->desc, len, data) < 0) {
+ talloc_free(dd);
+ return NULL;
+ } else
+ return dd;
+}
+
+struct msgb *osim_file_encode(const struct osim_file_desc *desc,
+ const struct osim_decoded_data *data)
+{
+ if (!desc->ops.encode)
+ return NULL;
+
+ return desc->ops.encode(desc, data);
+}
+
static struct osim_decoded_element *
__element_alloc(void *ctx, const char *name, enum osim_element_type type,
enum osim_element_repr repr)
@@ -166,7 +216,3 @@ struct msgb *osim_new_apdumsg(uint8_t cla, uint8_t ins, uint8_t p1,
return msg;
}
-
-
-
-
diff --git a/src/sim/file_codec.c b/src/sim/file_codec.c
deleted file mode 100644
index 5bf5bc68..00000000
--- a/src/sim/file_codec.c
+++ /dev/null
@@ -1,34 +0,0 @@
-
-#include <unistd.h>
-
-#include <osmocom/core/talloc.h>
-#include <osmocom/sim/sim.h>
-
-struct osim_decoded_data *osim_file_decode(struct osim_file *file,
- int len, uint8_t *data)
-{
- struct osim_decoded_data *dd;
-
- if (!file->desc->ops.parse)
- return NULL;
-
- dd = talloc_zero(file, struct osim_decoded_data);
- dd->file = file;
-
- if (file->desc->ops.parse(dd, file->desc, len, data) < 0) {
- talloc_free(dd);
- return NULL;
- } else
- return dd;
-}
-
-struct msgb *osim_file_encode(const struct osim_file_desc *desc,
- const struct osim_decoded_data *data)
-{
- if (!desc->ops.encode)
- return NULL;
-
- return desc->ops.encode(desc, data);
-}
-
-
diff --git a/src/sim/reader.c b/src/sim/reader.c
index 52cf18e9..71fb763d 100644
--- a/src/sim/reader.c
+++ b/src/sim/reader.c
@@ -1,3 +1,26 @@
+/* Card reader abstraction for libosmosim */
+/*
+ * (C) 2012 by Harald Welte <laforge@gnumonks.org>
+ *
+ * All Rights Reserved
+ *
+ * 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 <stdint.h>
#include <stdlib.h>
diff --git a/src/sim/reader_pcsc.c b/src/sim/reader_pcsc.c
index 0a36f49c..60a9dee1 100644
--- a/src/sim/reader_pcsc.c
+++ b/src/sim/reader_pcsc.c
@@ -1,3 +1,26 @@
+/* PC/SC Card reader backend for libosmosim */
+/*
+ * (C) 2012 by Harald Welte <laforge@gnumonks.org>
+ *
+ * All Rights Reserved
+ *
+ * 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 <string.h>
#include <stdint.h>
#include <stdio.h>