aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gprs_llc.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-12-26 11:56:29 +0100
committerHarald Welte <laforge@gnumonks.org>2010-12-26 11:56:29 +0100
commitc7d8e582acf83bbe1f0cca1894ffdc46cd8804cd (patch)
treebcb6d8541d34f58acd7a0424314a46df6c85ecd4 /openbsc/src/gprs/gprs_llc.c
parent7bf59a94a50d6c923058c1020e5e27d08761aa7b (diff)
HACK / unfinished: persistent storage of SGSN statelaforge/gprs_persistent
Diffstat (limited to 'openbsc/src/gprs/gprs_llc.c')
-rw-r--r--openbsc/src/gprs/gprs_llc.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c
index e873420ad..68510bedf 100644
--- a/openbsc/src/gprs/gprs_llc.c
+++ b/openbsc/src/gprs/gprs_llc.c
@@ -851,3 +851,31 @@ int gprs_llc_init(const char *cipher_plugin_path)
{
return gprs_cipher_load(cipher_plugin_path);
}
+
+
+int gprs_llc_dump(struct osmo_dumper *od)
+{
+ llist_for_each_entry(llme, &gprs_llc_llmes, list)
+ osmo_dump_struct(od, OD_TYPE_LLC_ME, llme, sizeof(*llme));
+}
+
+/* callback to restore one data structure from disk */
+static int gprs_llc_restore(int type, uint8_t *data, int data_len)
+{
+ struct gprs_llc_llme *llme;
+
+ if (type != OD_TYPE_LLC_ME)
+ return -EINVAL;
+ if (sizeof(*llme) != data_len)
+ return -EMSGSIZE;
+
+ llme = talloc_zero(llc_tall_ctx, struct gprs_llc_llme);
+ if (!llme)
+ return -ENOMEM;
+
+ memcpy(llme, data, sizeof(*llme));
+
+ llist_add(&llme->list, &gprs_llc_llmes);
+
+ return 0;
+}