From ad41863b8d3f3ac7df0c34b2c7d342b864d944cc Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 10 Sep 2012 10:49:59 +0200 Subject: sim: add copyright notices and merge file_codec.c into core.c --- src/sim/core.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 4 deletions(-) (limited to 'src/sim/core.c') 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 + * + * 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 #include #include #include +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; } - - - - -- cgit v1.2.3