Common library for all Osmocom projects (libosmocore, libosmogsm, libosmovty, libosmogb, libosmosim, libosmousb, ...) https://osmocom.org/projects/libosmocore
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
libosmocore/src/sim/file_codec.c

34 lines
643 B

#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);
}