summaryrefslogtreecommitdiffstats
path: root/src/tcu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tcu.c')
-rw-r--r--src/tcu.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/tcu.c b/src/tcu.c
index 584644f..e736d42 100644
--- a/src/tcu.c
+++ b/src/tcu.c
@@ -60,17 +60,22 @@ LIB_EXPORTED const char *tcap_prim_name(enum tcap_primitive prim)
return get_value_string(tcap_prim_names, prim);
}
+static struct tcap_prim_buf *tcap_prim_buf_alloc(enum tcap_primitive prim)
+{
+ struct tcap_prim_buf *tcpb = talloc_zero(tcap_ind_ctx,
+ struct tcap_prim_buf);
+ if (!tcpb)
+ return NULL;
+
+ tcpb->prim = prim;
+
+ return tcpb;
+}
+
/***********************************************************************/
/* Dialogue Primitives */
/***********************************************************************/
-static struct tcap_dialg_ind *tcap_dialg_ind_alloc(void)
-{
- struct tcap_dialg_ind *tcdi = talloc_zero(tcap_ind_ctx,
- struct tcap_dialg_ind);
- return tcdi;
-}
-
/* fill the application context and user information part of 'tcap_dialg_ind' */
static int fill_tcap_dialg_ind(struct tcap_dialg_ind *tcdi,
OBJECT_IDENTIFIER_t *app_ctx_name,
@@ -109,7 +114,8 @@ static int _tcap_tcu_dialg_ind(enum tcap_primitive prim, struct tcap_dialogue *t
OBJECT_IDENTIFIER_t *app_ctx_name,
struct user_information *user_info, int comp_present)
{
- struct tcap_dialg_ind *tcdi = tcap_dialg_ind_alloc();
+ struct tcap_prim_buf *tcpb = tcap_prim_buf_alloc(prim);
+ struct tcap_dialg_ind *tcdi = &tcpb->dialg;
int rc;
if (!tcdi)
@@ -125,7 +131,7 @@ static int _tcap_tcu_dialg_ind(enum tcap_primitive prim, struct tcap_dialogue *t
if (comp_present)
tcdi->components_present = 1;
- return tcap_user_ind_dialg(prim, tcdi);
+ return tcap_user_ind_cb(tcpb);
}
/* TC-BEGIN.ind from DHA */
@@ -234,17 +240,11 @@ LIB_EXPORTED int tcap_user_req_dialg(enum tcap_primitive prim, struct tcap_dialg
/* Component Primitives */
/***********************************************************************/
-static struct tcap_component_ind *tcap_comp_ind_alloc(void)
-{
- struct tcap_component_ind *tcci = talloc_zero(tcap_ind_ctx,
- struct tcap_component_ind);
- return tcci;
-}
-
static int _tcu_comp_ind(enum tcap_primitive prim, struct tcap_invocation *ti, struct OPERATION *oper,
Parameter_t *param, int last)
{
- struct tcap_component_ind *tcci = tcap_comp_ind_alloc();
+ struct tcap_prim_buf *tcpb = tcap_prim_buf_alloc(prim);
+ struct tcap_component_ind *tcci = &tcpb->comp;
int rc;
tcci->dialg_id = ti->dialogue->dialogue_id;
@@ -281,10 +281,10 @@ static int _tcu_comp_ind(enum tcap_primitive prim, struct tcap_invocation *ti, s
}
tcci->last_component = last;
- return tcap_user_ind_comp(prim, tcci);
+ return tcap_user_ind_cb(tcpb);
out_free:
- talloc_free(tcci);
+ talloc_free(tcpb);
return rc;
}
@@ -422,3 +422,12 @@ LIB_EXPORTED int tcap_user_req_comp(enum tcap_primitive prim, struct tcap_compon
return rc;
}
+
+/* primitive received from TC-User */
+LIB_EXPORTED int tcap_user_req(struct tcap_prim_buf *tcpb)
+{
+ if (tcpb->prim > _TCAP_PR_COMP_BASE)
+ return tcap_user_req_comp(tcpb->prim, &tcpb->comp);
+ else
+ return tcap_user_req_dialg(tcpb->prim, &tcpb->dialg);
+}