example: add pp-common.c for common PP functions
Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
parent
79f63c91cf
commit
f920361f12
|
@ -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)
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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, ¶m);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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, ¶m);
|
||||
}
|
||||
|
|
Reference in New Issue