summaryrefslogtreecommitdiffstats
path: root/sys/netatm/uni
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1998-12-11 21:47:47 +0000
committerphk <phk@FreeBSD.org>1998-12-11 21:47:47 +0000
commit42c5874d2e9141522df7961184e6ec237a91e3c3 (patch)
tree913da2fcc6981c4ed3ea4c07086fc1e98ff63b5a /sys/netatm/uni
parentc55aa9c23d5c6f7f964fa71facbba34dd8c6bfc1 (diff)
downloadFreeBSD-src-42c5874d2e9141522df7961184e6ec237a91e3c3.zip
FreeBSD-src-42c5874d2e9141522df7961184e6ec237a91e3c3.tar.gz
Set and propagate the correct cause code values.
Submitted by: Mike Spengler <mks@circe.networkcs.com>
Diffstat (limited to 'sys/netatm/uni')
-rw-r--r--sys/netatm/uni/unisig_if.c6
-rw-r--r--sys/netatm/uni/unisig_msg.c7
-rw-r--r--sys/netatm/uni/unisig_subr.c42
-rw-r--r--sys/netatm/uni/unisig_var.h6
-rw-r--r--sys/netatm/uni/unisig_vc_state.c77
5 files changed, 92 insertions, 46 deletions
diff --git a/sys/netatm/uni/unisig_if.c b/sys/netatm/uni/unisig_if.c
index c85e462..0401154 100644
--- a/sys/netatm/uni/unisig_if.c
+++ b/sys/netatm/uni/unisig_if.c
@@ -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;
diff --git a/sys/netatm/uni/unisig_msg.c b/sys/netatm/uni/unisig_msg.c
index 510b92e..f52f46e 100644
--- a/sys/netatm/uni/unisig_msg.c
+++ b/sys/netatm/uni/unisig_msg.c
@@ -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
diff --git a/sys/netatm/uni/unisig_subr.c b/sys/netatm/uni/unisig_subr.c
index 18e0fa1..888cedc 100644
--- a/sys/netatm/uni/unisig_subr.c
+++ b/sys/netatm/uni/unisig_subr.c
@@ -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
*/
@@ -101,6 +104,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
*
* Called when a user wants to open a VC. This function will construct
@@ -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);
}
diff --git a/sys/netatm/uni/unisig_var.h b/sys/netatm/uni/unisig_var.h
index 1e3d01a7..b8d4229 100644
--- a/sys/netatm/uni/unisig_var.h
+++ b/sys/netatm/uni/unisig_var.h
@@ -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 *));
diff --git a/sys/netatm/uni/unisig_vc_state.c b/sys/netatm/uni/unisig_vc_state.c
index 28ae9de..84f995e 100644
--- a/sys/netatm/uni/unisig_vc_state.c
+++ b/sys/netatm/uni/unisig_vc_state.c
@@ -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);
@@ -887,18 +900,6 @@ unisig_vc_act08(usp, uvp, msg)
}
/*
- * 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
*/
if (msg->msg_ie_aalp->ie_aalp_aal_type != UNI_IE_AALP_AT_AAL3 &&
@@ -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);
OpenPOWER on IntegriCloud