Set and propagate the correct cause code values.

Submitted by: Mike Spengler <mks@circe.networkcs.com>
This commit is contained in:
Poul-Henning Kamp 1998-12-11 21:47:47 +00:00
parent 439872d909
commit 93e31e2f3c
5 changed files with 92 additions and 46 deletions

View file

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: unisig_if.c,v 1.3 1998/10/31 20:07:01 phk Exp $
* @(#) $Id: unisig_if.c,v 1.4 1998/12/04 22:54:53 archie Exp $
*
*/
@ -47,7 +47,7 @@
#include <netatm/uni/unisig_msg.h>
#ifndef lint
__RCSID("@(#) $Id: unisig_if.c,v 1.3 1998/10/31 20:07:01 phk Exp $");
__RCSID("@(#) $Id: unisig_if.c,v 1.4 1998/12/04 22:54:53 archie Exp $");
#endif
@ -863,7 +863,7 @@ unisig_ioctl(code, data, arg1)
/*
* Schedule VCC termination
*/
unisig_set_cause_attr(&uvp->uv_connvc->cvc_attr,
unisig_cause_attr_from_user(&uvp->uv_connvc->cvc_attr,
T_ATM_CAUSE_UNSPECIFIED_NORMAL);
err = unisig_abort((struct vccb *)uvp);
break;

View file

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: unisig_msg.c,v 1.2 1998/09/17 09:35:02 phk Exp $
* @(#) $Id: unisig_msg.c,v 1.3 1998/10/31 20:07:01 phk Exp $
*
*/
@ -44,7 +44,7 @@
#include <netatm/uni/unisig_print.h>
#ifndef lint
__RCSID("@(#) $Id: unisig_msg.c,v 1.2 1998/09/17 09:35:02 phk Exp $");
__RCSID("@(#) $Id: unisig_msg.c,v 1.3 1998/10/31 20:07:01 phk Exp $");
#endif
@ -68,8 +68,7 @@ static int unisig_print_msg = 0;
*
* Arguments:
* iep pointer to a cause IE
* msg pointer to message
* cause cause code for the error
* aap pointer to attribute block
*
* Returns:
* 0 message sent OK

View file

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: unisig_subr.c,v 1.3 1998/10/31 20:07:01 phk Exp $
* @(#) $Id: unisig_subr.c,v 1.4 1998/10/31 20:08:03 phk Exp $
*
*/
@ -42,7 +42,7 @@
#include <netatm/uni/unisig_msg.h>
#ifndef lint
__RCSID("@(#) $Id: unisig_subr.c,v 1.3 1998/10/31 20:07:01 phk Exp $");
__RCSID("@(#) $Id: unisig_subr.c,v 1.4 1998/10/31 20:08:03 phk Exp $");
#endif
@ -73,7 +73,7 @@ extern struct ie_epst ie_epst_absent;
/*
* Set a cause code in an ATM attribute block
* Set a User Location cause code in an ATM attribute block
*
* Arguments:
* aap pointer to attribute block
@ -84,10 +84,13 @@ extern struct ie_epst ie_epst_absent;
*
*/
void
unisig_set_cause_attr(aap, cause)
unisig_cause_attr_from_user(aap, cause)
Atm_attributes *aap;
int cause;
{
if (cause == T_ATM_ABSENT)
return;
/*
* Set the fields in the attribute block
*/
@ -100,6 +103,35 @@ unisig_set_cause_attr(aap, cause)
}
/*
* Set a cause code in an ATM attribute block from a Cause IE
*
* Arguments:
* aap pointer to attribute block
* iep pointer to Cause IE
*
* Returns:
* none
*
*/
void
unisig_cause_attr_from_ie(aap, iep)
Atm_attributes *aap;
struct ie_generic *iep;
{
/*
* Set the fields in the attribute block
*/
aap->cause.tag = T_ATM_PRESENT;
aap->cause.v.coding_standard = iep->ie_coding;
aap->cause.v.location = iep->ie_caus_loc;
aap->cause.v.cause_value = iep->ie_caus_cause;
KM_ZERO(aap->cause.v.diagnostics, sizeof(aap->cause.v.diagnostics));
KM_COPY(iep->ie_caus_diagnostic, aap->cause.v.diagnostics,
MIN(sizeof(aap->cause.v.diagnostics), iep->ie_caus_diag_len));
}
/*
* Open a UNI VCC
*
@ -402,7 +434,7 @@ unisig_clear_vcc(usp, uvp, cause)
outstate == UNI_SSCF_RECOV ||
outstate == UNI_PVC_ACT_DOWN ||
outstate == UNI_PVC_ACTIVE) {
unisig_set_cause_attr(&uvp->uv_connvc->cvc_attr, cause);
unisig_cause_attr_from_user(&uvp->uv_connvc->cvc_attr, cause);
atm_cm_cleared(uvp->uv_connvc);
}

View file

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: unisig_var.h,v 1.12 1998/07/24 20:24:34 mks Exp $
* @(#) $Id: unisig_var.h,v 1.1 1998/09/15 08:23:13 phk Exp $
*
*/
@ -276,7 +276,9 @@ int unisig_sigmgr_state __P((struct unisig *, int,
KBuffer *));
/* unisig_subr.c */
void unisig_set_cause_attr __P((Atm_attributes *, int));
void unisig_cause_attr_from_user __P((Atm_attributes *, int));
void unisig_cause_attr_from_ie __P((Atm_attributes *,
struct ie_generic *));
int unisig_open_vcc __P((struct unisig *, Atm_connvc *));
int unisig_close_vcc __P((struct unisig *,
struct unisig_vccb *));

View file

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: unisig_vc_state.c,v 1.2 1998/09/17 09:35:02 phk Exp $
* @(#) $Id: unisig_vc_state.c,v 1.3 1998/10/31 20:07:01 phk Exp $
*
*/
@ -44,7 +44,7 @@
#include <netatm/uni/unisig_decode.h>
#ifndef lint
__RCSID("@(#) $Id: unisig_vc_state.c,v 1.2 1998/09/17 09:35:02 phk Exp $");
__RCSID("@(#) $Id: unisig_vc_state.c,v 1.3 1998/10/31 20:07:01 phk Exp $");
#endif
@ -380,13 +380,22 @@ unisig_vc_act03(usp, uvp, msg)
struct unisig_vccb *uvp;
struct unisig_msg *msg;
{
int rc;
int rc, cause;
/*
* Set cause code
*/
if ((msg != NULL) && (msg->msg_ie_caus != NULL)) {
unisig_cause_attr_from_ie(&uvp->uv_connvc->cvc_attr,
msg->msg_ie_caus);
cause = T_ATM_ABSENT;
} else
cause = T_ATM_CAUSE_DESTINATION_OUT_OF_ORDER;
/*
* Clear the VCCB
*/
rc = unisig_clear_vcc(usp, uvp,
T_ATM_CAUSE_DESTINATION_OUT_OF_ORDER);
rc = unisig_clear_vcc(usp, uvp, cause);
return(rc);
}
@ -813,7 +822,11 @@ unisig_vc_act07(usp, uvp, msg)
/*
* Notify the user
*/
unisig_set_cause_attr(&uvp->uv_connvc->cvc_attr,
if ((msg != NULL) && (msg->msg_ie_caus != NULL))
unisig_cause_attr_from_ie(&uvp->uv_connvc->cvc_attr,
msg->msg_ie_caus);
else
unisig_cause_attr_from_user(&uvp->uv_connvc->cvc_attr,
T_ATM_CAUSE_NORMAL_CALL_CLEARING);
atm_cm_cleared(uvp->uv_connvc);
@ -886,18 +899,6 @@ unisig_vc_act08(usp, uvp, msg)
goto response08;
}
/*
* See if we can handle the specified encapsulation
*/
if (msg->msg_ie_blli->ie_blli_l2_id != UNI_IE_BLLI_L2P_LLC &&
(msg->msg_ie_blli->ie_blli_l2_id != 0 ||
msg->msg_ie_blli->ie_blli_l3_id !=
UNI_IE_BLLI_L3P_ISO9577)) {
cause = UNI_IE_CAUS_UNAVAIL;
ATM_DEBUG0("unisig_vc_act08: bad encapsulation\n");
goto response08;
}
/*
* See if we recognize the specified AAL
*/
@ -1151,13 +1152,20 @@ unisig_vc_act11(usp, uvp, msg)
struct unisig_vccb *uvp;
struct unisig_msg *msg;
{
int rc;
int rc, cause;
/*
* Send generic cause code if one is not already set
*/
if (uvp->uv_connvc->cvc_attr.cause.tag == T_ATM_PRESENT)
cause = T_ATM_ABSENT;
else
cause = T_ATM_CAUSE_CALL_REJECTED;
/*
* Send a RELEASE COMPLETE message
*/
rc = unisig_send_release_complete(usp, uvp, msg,
UNI_IE_CAUS_REJECT);
rc = unisig_send_release_complete(usp, uvp, msg, cause);
/*
* Clear the call VCCB
@ -1206,7 +1214,7 @@ unisig_vc_act12(usp, uvp, msg)
/*
* Send the RELEASE message
*/
rc = unisig_vc_clear_call(usp, uvp, (struct unisig_msg *)0,
rc = unisig_vc_clear_call(usp, uvp, (struct unisig_msg *)NULL,
T_ATM_ABSENT);
return(rc);
@ -1255,8 +1263,9 @@ unisig_vc_act13(usp, uvp, msg)
/*
* Notify the user that the call is now closed
*/
unisig_set_cause_attr(&uvp->uv_connvc->cvc_attr,
T_ATM_CAUSE_NORMAL_CALL_CLEARING);
if (msg->msg_ie_caus != NULL)
unisig_cause_attr_from_ie(&uvp->uv_connvc->cvc_attr,
msg->msg_ie_caus);
atm_cm_cleared(uvp->uv_connvc);
return(0);
@ -1395,8 +1404,12 @@ unisig_vc_act15(usp, uvp, msg)
/*
* Notify the user that the call is cleared
*/
unisig_set_cause_attr(&uvp->uv_connvc->cvc_attr,
T_ATM_CAUSE_NORMAL_CALL_CLEARING);
if (msg->msg_ie_caus != NULL)
unisig_cause_attr_from_ie(&uvp->uv_connvc->cvc_attr,
msg->msg_ie_caus);
else
unisig_cause_attr_from_user(&uvp->uv_connvc->cvc_attr,
T_ATM_CAUSE_UNSPECIFIED_NORMAL);
atm_cm_cleared(uvp->uv_connvc);
return(rc);
@ -1435,8 +1448,7 @@ unisig_vc_act16(usp, uvp, msg)
/*
* Clear the VCCB
*/
rc = unisig_clear_vcc(usp, uvp,
T_ATM_CAUSE_NORMAL_CALL_CLEARING);
rc = unisig_clear_vcc(usp, uvp, T_ATM_ABSENT);
return(rc);
}
@ -1672,7 +1684,7 @@ unisig_vc_act21(usp, uvp, msg)
return(0);
}
rc = unisig_clear_vcc(usp, uvp,
T_ATM_CAUSE_NORMAL_CALL_CLEARING);
T_ATM_CAUSE_MESSAGE_INCOMPATIBLE_WITH_CALL_STATE);
}
/*
@ -1688,8 +1700,7 @@ unisig_vc_act21(usp, uvp, msg)
cause,
msg->msg_ie_caus->ie_caus_diagnostic[0]);
if (uvp) {
(void)unisig_clear_vcc(usp, uvp,
T_ATM_CAUSE_INVALID_INFO_ELEMENT_CONTENTS);
(void)unisig_clear_vcc(usp, uvp, cause);
}
}
@ -1958,8 +1969,10 @@ unisig_vc_act26(usp, uvp, msg)
/*
* Notify the user
*/
unisig_set_cause_attr(&uvp->uv_connvc->cvc_attr,
if (uvp->uv_connvc->cvc_attr.cause.tag != T_ATM_PRESENT)
unisig_cause_attr_from_user(&uvp->uv_connvc->cvc_attr,
T_ATM_CAUSE_NORMAL_CALL_CLEARING);
atm_cm_cleared(uvp->uv_connvc);
return(0);