summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2011-03-20 02:00:00 +0100
committerPatrick McHardy <kaber@trash.net>2011-03-20 02:00:00 +0100
commit8a59a4cd9d732a546998471d3ffa3d4f0ebc28b7 (patch)
tree61b19acfe3a8ab9c2a4ed1caf5e89255963f468c
parentf3a25140f0e6aba963556099776abcbdada97e6b (diff)
example: fp-locate-suggest
Not working properly without changes to src/mm.c, concretely all FP transactions only transmitting a single message are currently broken since the transaction is closed before the PP can respond to the page message. Uncomment dect_transaction_close() in dect_mm_info_req() for testing. Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r--example/.gitignore1
-rw-r--r--example/Makefile.in6
-rw-r--r--example/fp-locate-suggest.c60
3 files changed, 66 insertions, 1 deletions
diff --git a/example/.gitignore b/example/.gitignore
index 5354a71..d07bdf5 100644
--- a/example/.gitignore
+++ b/example/.gitignore
@@ -2,6 +2,7 @@ ss
mm-pp
hijack
fp-mm
+fp-locate-suggest
fp-cc
fp-clms
fp-broadcast-page
diff --git a/example/Makefile.in b/example/Makefile.in
index 20ae41c..e3d2a8f 100644
--- a/example/Makefile.in
+++ b/example/Makefile.in
@@ -1,7 +1,7 @@
CFLAGS += $(EVENT_CFLAGS)
LDFLAGS += -Wl,-rpath $(PWD)/src -Lsrc -ldect $(EVENT_LDFLAGS)
PROGRAMS += ss hijack
-PROGRAMS += fp-mm fp-cc fp-clms fp-broadcast-page
+PROGRAMS += fp-mm fp-locate-suggest fp-cc fp-clms fp-broadcast-page
PROGRAMS += fp-siemens-proprietary
PROGRAMS += pp-access-rights pp-access-rights-terminate pp-location-update
PROGRAMS += pp-detach pp-info-request pp-cc pp-list-access pp-clms
@@ -21,6 +21,10 @@ fp-mm-destdir := $(destdir)
fp-mm-obj += $(fp-common-obj)
fp-mm-obj += fp-mm.o
+fp-locate-suggest-destdir := $(destdir)
+fp-locate-suggest-obj += $(fp-common-obj)
+fp-locate-suggest-obj += fp-locate-suggest.o
+
fp-cc-destdir := $(destdir)
fp-cc-obj += $(fp-common-obj)
fp-cc-obj += audio.o
diff --git a/example/fp-locate-suggest.c b/example/fp-locate-suggest.c
new file mode 100644
index 0000000..9f16d3d
--- /dev/null
+++ b/example/fp-locate-suggest.c
@@ -0,0 +1,60 @@
+/*
+ * DECT Mobility Management FP LOCATE-SUGGEST example
+ *
+ * Copyright (c) 2011 Patrick McHardy <kaber@trash.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <dect/libdect.h>
+#include "common.h"
+
+static void mm_locate_ind(struct dect_handle *dh,
+ struct dect_mm_endpoint *mme,
+ struct dect_mm_locate_param *param)
+{
+}
+
+static void mm_info_req(struct dect_handle *dh,
+ const struct dect_ipui *ipui)
+{
+ struct dect_ie_info_type info_type;
+ struct dect_mm_info_param req = { .info_type = &info_type };
+ struct dect_mm_endpoint *mme;
+
+ mme = dect_mm_endpoint_alloc(dh, ipui);
+ if (mme == NULL)
+ return;
+
+ info_type.num = 1;
+ info_type.type[0] = DECT_INFO_LOCATE_SUGGEST;
+ dect_mm_info_req(dh, mme, &req);
+}
+
+static struct dect_mm_ops mm_ops = {
+ .mm_locate_ind = mm_locate_ind,
+};
+
+static struct dect_ops ops = {
+ .mm_ops = &mm_ops,
+};
+
+int main(int argc, char **argv)
+{
+ dect_fp_common_options(argc, argv);
+ dect_common_init(&ops, argv[1]);
+
+ mm_info_req(dh, &ipui);
+ dect_event_loop();
+
+ dect_common_cleanup(dh);
+ return 0;
+}