implement TC-U-REJECT.req

This commit is contained in:
Harald Welte 2010-07-19 19:46:11 +02:00
parent d5c4b8ef20
commit fead1fffd4
4 changed files with 60 additions and 9 deletions

View File

@ -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) */

View File

@ -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);

View File

@ -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;

View File

@ -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: