summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2010-08-05 00:19:54 +0200
committerPatrick McHardy <kaber@trash.net>2010-08-09 18:10:58 +0200
commitf920361f1291a95980f3444683aee8224bf676bc (patch)
tree27f9fc6705f1e4fdc0911ac64f67a6569fc5b8e2
parent79f63c91cff92733ef700032d9dc31777d66babd (diff)
example: add pp-common.c for common PP functions
Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r--example/Makefile.in4
-rw-r--r--example/common.h1
-rw-r--r--example/pp-access-rights.c22
-rw-r--r--example/pp-common.c36
-rw-r--r--example/pp-location-update.c20
5 files changed, 41 insertions, 42 deletions
diff --git a/example/Makefile.in b/example/Makefile.in
index 46d7981..4d03153 100644
--- a/example/Makefile.in
+++ b/example/Makefile.in
@@ -7,7 +7,7 @@ PROGRAMS += pp-detach pp-info-request pp-list-access pp-wait-page
destdir := usr/share/dect/examples
common-obj += common.o event_ops.o keys.o dummy_ops.o debug.o
-pp-common-obj += $(common-obj) pp-auth.o
+pp-common-obj += $(common-obj) pp-common.o pp-auth.o
cc-destdir := $(destdir)
cc-obj += $(common-obj)
@@ -24,7 +24,7 @@ mm-fp-obj += $(common-obj)
mm-fp-obj += mm-fp.o
pp-access-rights-destdir := $(destdir)
-pp-access-rights-obj += $(common-obj)
+pp-access-rights-obj += $(pp-common-obj)
pp-access-rights-obj += pp-access-rights.o
pp-access-rights-terminate-destdir := $(destdir)
diff --git a/example/common.h b/example/common.h
index 2be4802..24621e4 100644
--- a/example/common.h
+++ b/example/common.h
@@ -24,6 +24,7 @@ extern int dect_read_uak(const struct dect_ipui *ipui,
extern void dect_pp_auth_init(struct dect_ops *ops,
const struct dect_ipui *ipui);
+extern void dect_pp_init_terminal_capability(struct dect_ie_terminal_capability *tcap);
struct mm_auth_priv {
uint8_t dck[DECT_CIPHER_KEY_LEN];
diff --git a/example/pp-access-rights.c b/example/pp-access-rights.c
index 5a28ce4..5d74650 100644
--- a/example/pp-access-rights.c
+++ b/example/pp-access-rights.c
@@ -125,26 +125,6 @@ static void mm_key_allocate_ind(struct dect_handle *dh,
dect_mm_authenticate_req(dh, mme, &reply);
}
-static void init_terminal_capability(struct dect_ie_terminal_capability *terminal_capability)
-{
- terminal_capability->tone = DECT_TONE_CAPABILITY_DIAL_TONE_ONLY;
- terminal_capability->echo = DECT_ECHO_PARAMETER_FULL_TCLW;
- terminal_capability->noise_rejection = DECT_NOISE_REJECTION_NONE;
- terminal_capability->volume_ctrl = DECT_ADAPTIVE_VOLUME_PP_CONTROL_NONE;
- terminal_capability->slot = DECT_SLOT_CAPABILITY_FULL_SLOT;
-
- terminal_capability->display = DECT_DISPLAY_CAPABILITY_FULL_DISPLAY;
- terminal_capability->display_memory = 48;
- terminal_capability->display_lines = 3;
- terminal_capability->display_columns = 16;
- terminal_capability->display_control = DECT_DISPLAY_CONTROL_CODE_CODING_1;
- terminal_capability->display_charsets = 0;
- terminal_capability->scrolling = DECT_SCROLLING_NOT_SPECIFIED;
- terminal_capability->profile_indicator = DECT_PROFILE_GAP_SUPPORTED |
- DECT_PROFILE_NG_DECT_PART_1 |
- DECT_PROFILE_NG_DECT_PART_3;
-}
-
static void mm_access_rights_cfm(struct dect_handle *dh,
struct dect_mm_endpoint *mme, bool accept,
struct dect_mm_access_rights_param *param)
@@ -172,7 +152,7 @@ static int mm_access_rights_req(struct dect_handle *dh, struct dect_mm_endpoint
auth_type.cipher_key_num = 0;
auth_type.flags = 0;
- init_terminal_capability(&terminal_capability);
+ dect_pp_init_terminal_capability(&terminal_capability);
return dect_mm_access_rights_req(dh, mme, &param);
}
diff --git a/example/pp-common.c b/example/pp-common.c
new file mode 100644
index 0000000..1b13959
--- /dev/null
+++ b/example/pp-common.c
@@ -0,0 +1,36 @@
+/*
+ * DECT PP common functions
+ *
+ * Copyright (c) 2010 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 <dect/libdect.h>
+#include <dect/auth.h>
+#include "common.h"
+
+#define debug(fmt, args...) printf("P-IWU: " fmt, ## args)
+
+void dect_pp_init_terminal_capability(struct dect_ie_terminal_capability *tcap)
+{
+ tcap->tone = DECT_TONE_CAPABILITY_DIAL_TONE_ONLY;
+ tcap->echo = DECT_ECHO_PARAMETER_FULL_TCLW;
+ tcap->noise_rejection = DECT_NOISE_REJECTION_NONE;
+ tcap->volume_ctrl = DECT_ADAPTIVE_VOLUME_PP_CONTROL_NONE;
+ tcap->slot = DECT_SLOT_CAPABILITY_FULL_SLOT;
+
+ tcap->display = DECT_DISPLAY_CAPABILITY_FULL_DISPLAY;
+ tcap->display_memory = 48;
+ tcap->display_lines = 3;
+ tcap->display_columns = 16;
+ tcap->display_control = DECT_DISPLAY_CONTROL_CODE_CODING_1;
+ tcap->display_charsets = 0;
+ tcap->scrolling = DECT_SCROLLING_NOT_SPECIFIED;
+ tcap->profile_indicator = DECT_PROFILE_GAP_SUPPORTED |
+ DECT_PROFILE_REKEYING_EARLY_ENCRYPTION_SUPPORTED |
+ DECT_PROFILE_NG_DECT_PART_1 |
+ DECT_PROFILE_NG_DECT_PART_3;
+}
diff --git a/example/pp-location-update.c b/example/pp-location-update.c
index 41db3a6..97b550e 100644
--- a/example/pp-location-update.c
+++ b/example/pp-location-update.c
@@ -22,24 +22,6 @@ static const struct dect_ipui ipui = {
}
};
-static void init_terminal_capability(struct dect_ie_terminal_capability *tcap)
-{
- tcap->tone = DECT_TONE_CAPABILITY_DIAL_TONE_ONLY;
- tcap->echo = DECT_ECHO_PARAMETER_FULL_TCLW;
- tcap->noise_rejection = DECT_NOISE_REJECTION_NONE;
- tcap->volume_ctrl = DECT_ADAPTIVE_VOLUME_PP_CONTROL_NONE;
- tcap->slot = DECT_SLOT_CAPABILITY_FULL_SLOT;
-
- tcap->display = DECT_DISPLAY_CAPABILITY_FULL_DISPLAY;
- tcap->display_memory = 48;
- tcap->display_lines = 3;
- tcap->display_columns = 16;
- tcap->display_control = DECT_DISPLAY_CONTROL_CODE_CODING_1;
- tcap->display_charsets = 0;
- tcap->scrolling = DECT_SCROLLING_NOT_SPECIFIED;
- tcap->profile_indicator = DECT_PROFILE_GAP_SUPPORTED;
-}
-
static void mm_locate_cfm(struct dect_handle *dh, struct dect_mm_endpoint *mme,
bool accept, struct dect_mm_locate_param *param)
{
@@ -63,7 +45,7 @@ static int mm_locate_req(struct dect_handle *dh, struct dect_mm_endpoint *mme)
location_area.type = DECT_LOCATION_AREA_LEVEL;
location_area.level = 36;
- init_terminal_capability(&terminal_capability);
+ dect_pp_init_terminal_capability(&terminal_capability);
return dect_mm_locate_req(dh, mme, &param);
}