summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-07-19 19:46:11 +0200
committerHarald Welte <laforge@gnumonks.org>2010-07-19 19:46:11 +0200
commitfead1fffd4960c1f30eba7cec7c6e39209674b00 (patch)
tree552e0e9d90489056afd8da7204de8ca9fe22d5a3
parentd5c4b8ef20e8daae592744dd5b4573abb34bafcd (diff)
implement TC-U-REJECT.req
-rw-r--r--src/csl_cha_cco.c44
-rw-r--r--src/tcap.h3
-rw-r--r--src/tcap_user.h19
-rw-r--r--src/tcu.c3
4 files changed, 60 insertions, 9 deletions
diff --git a/src/csl_cha_cco.c b/src/csl_cha_cco.c
index 0d958e0..fca653a 100644
--- a/src/csl_cha_cco.c
+++ b/src/csl_cha_cco.c
@@ -208,9 +208,48 @@ int tcap_cha_tc_u_error_req(struct tcap_dialogue *td, int8_t inv_id,
}
/* TC-U-REJECT.req (TCU -> CHA) */
-int tcap_cha_tc_u_rej_req(struct tcap_invocation *ti, enum problem_PR problem)
+int tcap_cha_tc_u_rej_req(struct tcap_dialogue *td, int8_t *invoke_id,
+ enum problem_PR problem, long problem_code)
{
+ struct tcap_invocation *ti;
+ struct Component *comp = talloc_zero(td, struct Component);
+ struct Reject *rej;
+ INTEGER_t *err_code_int = NULL;
+
+ if (!comp)
+ return -ENOMEM;
+
/* Assemble reject component */
+ comp->present = Component_PR_reject;
+ rej = &comp->choice.reject;
+ if (invoke_id) {
+ rej->invokeIDRej.present = invokeIDRej_PR_derivable;
+ rej->invokeIDRej.choice.derivable = *invoke_id;
+ } else
+ rej->invokeIDRej.present = invokeIDRej_PR_not_derivable;
+
+ rej->problem.present = problem;
+ switch (problem) {
+ case problem_PR_generalProblem:
+ err_code_int = &rej->problem.choice.generalProblem;
+ break;
+ case problem_PR_invokeProblem:
+ err_code_int = &rej->problem.choice.invokeProblem;
+ break;
+ case problem_PR_returnResultProblem:
+ err_code_int = &rej->problem.choice.returnResultProblem;
+ break;
+ case problem_PR_returnErrorProblem:
+ err_code_int = &rej->problem.choice.returnErrorProblem;
+ break;
+ case problem_PR_NOTHING:
+ default:
+ break;
+ }
+
+ if (err_code_int)
+ asn_long2INTEGER(err_code_int, problem_code);
+
/* Problem type invoke? */
if (problem == problem_PR_returnResultProblem ||
problem == problem_PR_returnErrorProblem) {
@@ -219,6 +258,9 @@ int tcap_cha_tc_u_rej_req(struct tcap_invocation *ti, enum problem_PR problem)
}
/* FIXME: Mark component available for this dialogue ID */
+ asn_sequence_add(&td->pend_comp->list, comp);
+
+ return 0;
}
/* Components (CHA <- DHA) */
diff --git a/src/tcap.h b/src/tcap.h
index 622a231..f634057 100644
--- a/src/tcap.h
+++ b/src/tcap.h
@@ -156,7 +156,8 @@ int tcap_cha_tc_result_l_req(struct tcap_dialogue *td, int8_t inv_id, int last,
struct OPERATION *op, uint8_t *param, uint32_t param_len);
/* TC-U-REJECT.req (TCU -> CHA) */
-int tcap_cha_tc_u_rej_req(struct tcap_invocation *ti, enum problem_PR problem);
+int tcap_cha_tc_u_rej_req(struct tcap_dialogue *td, int8_t *invoke_id,
+ enum problem_PR problem, long problem_code);
/* Components (CHA <- DHA) */
int tcap_cha_proc_components(struct tcap_dialogue *td, struct ComponentPortion *comp_por);
diff --git a/src/tcap_user.h b/src/tcap_user.h
index 5f13682..b396384 100644
--- a/src/tcap_user.h
+++ b/src/tcap_user.h
@@ -100,6 +100,8 @@ struct tcap_component_ind {
/* public */
uint32_t dialg_id; /* Dialogue ID */
int8_t invoke_id; /* Invoke ID */
+ uint8_t op_class; /* Operation Class (1-4) */
+ int8_t _linked_id; /* actual storage for linked ID */
int8_t *linked_id; /* Linked ID */
struct {
int is_global:1; /* is it global (1) or local (0) */
@@ -113,13 +115,16 @@ struct tcap_component_ind {
struct tcap_user_info parameter;
int last_component; /* is this the last component in the msg? */
uint32_t timeout_secs; /* Timeout in seconds */
- struct {
- int is_private:1; /* Is this a private (1) or national (0) error code? */
- long err;
- } error;
- uint8_t op_class;
- /* private */
- int8_t _linked_id; /* actual storage for linked ID */
+ union {
+ struct {
+ int is_private:1; /* Is this a private (1) or national (0) error code? */
+ long err;
+ } error;
+ struct {
+ uint8_t problem_type;
+ long problem_code;
+ } reject;
+ };
};
struct scxp_entity;
diff --git a/src/tcu.c b/src/tcu.c
index 4c707d8..89af4ed 100644
--- a/src/tcu.c
+++ b/src/tcu.c
@@ -399,6 +399,9 @@ LIB_EXPORTED int tcap_user_req_comp(enum tcap_primitive prim, struct tcap_compon
tcci->parameter.data, tcci->parameter.data_len);
break;
case TCAP_PR_TC_U_REJECT:
+ rc = tcap_cha_tc_u_rej_req(td, &tcci->invoke_id, tcci->reject.problem_type,
+ tcci->reject.problem_code);
+ break;
case TCAP_PR_TC_CANCEL:
case TCAP_PR_TC_TIMER_RESET:
default: