summaryrefslogtreecommitdiffstats
path: root/src/tcap_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tcap_test.c')
-rw-r--r--src/tcap_test.c68
1 files changed, 36 insertions, 32 deletions
diff --git a/src/tcap_test.c b/src/tcap_test.c
index 5f94f48..22667a6 100644
--- a/src/tcap_test.c
+++ b/src/tcap_test.c
@@ -43,25 +43,25 @@ static struct {
static int send_cont_end(uint32_t dialg_id, struct tcap_obj_ident *app_ctx, struct tcap_user_info *user_info,
int end)
{
- struct tcap_dialg_ind tcdi;
- enum tcap_primitive prim;
+ struct tcap_prim_buf tcpb;
+ struct tcap_dialg_ind *tcdi = &tcpb.dialg;
if (end)
- prim = TCAP_PR_TC_END;
+ tcpb.prim = TCAP_PR_TC_END;
else
- prim = TCAP_PR_TC_CONTINUE;
+ tcpb.prim = TCAP_PR_TC_CONTINUE;
- memset(&tcdi, 0, sizeof(tcdi));
- tcdi.dialg_id = dialg_id;
+ memset(&tcpb, 0, sizeof(tcpb));
+ tcdi->dialg_id = dialg_id;
if (app_ctx) {
- memcpy(&tcdi.app_ctx_name, app_ctx, sizeof(tcdi.app_ctx_name));
- tcdi.app_ctx_present = 1;
+ memcpy(&tcdi->app_ctx_name, app_ctx, sizeof(tcdi->app_ctx_name));
+ tcdi->app_ctx_present = 1;
}
if (user_info) {
- memcpy(&tcdi.user_info, user_info, sizeof(tcdi.user_info));
- tcdi.user_info_present = 1;
+ memcpy(&tcdi->user_info, user_info, sizeof(tcdi->user_info));
+ tcdi->user_info_present = 1;
}
- return tcap_user_req_dialg(prim, &tcdi);
+ return tcap_user_req(&tcpb);
}
/* UpdateGprsLocationArg */
@@ -78,37 +78,41 @@ static uint8_t gprs_loc_upd_param[] = {
static int send_comp_req(enum tcap_primitive prim, uint32_t dialg_id,
int8_t invoke_id, uint8_t *param, uint32_t param_len)
{
- struct tcap_component_ind tcci;
-
- memset(&tcci, 0, sizeof(tcci));
- tcci.dialg_id = dialg_id;
- tcci.invoke_id = invoke_id;
- tcci.linked_id = NULL;
- tcci.operation.local = 1;
- tcci.timeout_secs = 10;
- tcci.op_class = 1;
-
- if (param_len > sizeof(tcci.parameter.data))
+ struct tcap_prim_buf tcpb;
+ struct tcap_component_ind *tcci = &tcpb.comp;
+
+ memset(&tcpb, 0, sizeof(tcpb));
+ tcpb.prim = prim;
+ tcci->dialg_id = dialg_id;
+ tcci->invoke_id = invoke_id;
+ tcci->linked_id = NULL;
+ tcci->operation.local = 1;
+ tcci->timeout_secs = 10;
+ tcci->op_class = 1;
+
+ if (param_len > sizeof(tcci->parameter.data))
return -EINVAL;
- memcpy(&tcci.parameter.data, param, param_len);
- tcci.parameter.data_len = param_len;
+ memcpy(&tcci->parameter.data, param, param_len);
+ tcci->parameter.data_len = param_len;
- return tcap_user_req_comp(prim, &tcci);
+ return tcap_user_req(&tcpb);
}
static int send_begin(uint32_t dialg_id, struct tcap_obj_ident *app_ctx)
{
- struct tcap_dialg_ind tcdi;
+ struct tcap_prim_buf tcpb;
+ struct tcap_dialg_ind *tcdi = &tcpb.dialg;
- memset(&tcdi, 0, sizeof(tcdi));
- tcdi.dialg_id = dialg_id;
+ memset(&tcpb, 0, sizeof(tcpb));
+ tcpb.prim = TCAP_PR_TC_BEGIN;
+ tcdi->dialg_id = dialg_id;
if (app_ctx) {
- memcpy(&tcdi.app_ctx_name, app_ctx, sizeof(tcdi.app_ctx_name));
- tcdi.app_ctx_present = 1;
+ memcpy(&tcdi->app_ctx_name, app_ctx, sizeof(tcdi->app_ctx_name));
+ tcdi->app_ctx_present = 1;
}
- tcdi.transp_ent = test_state.tte;
+ tcdi->transp_ent = test_state.tte;
- return tcap_user_req_dialg(TCAP_PR_TC_BEGIN, &tcdi);
+ return tcap_user_req(&tcpb);
}
static int tcap_user_ind_dialg(enum tcap_primitive prim, struct tcap_dialg_ind *tcdi)