[thirdparty-commits] rmudgett: mISDNuser/trunk r34 - /mISDNuser/trunk/suppserv/

SVN commits to the Digium third-party software repository thirdparty-commits at lists.digium.com
Wed Dec 24 12:33:41 CST 2008


Author: rmudgett
Date: Wed Dec 24 12:33:40 2008
New Revision: 34

URL: http://svn.digium.com/view/thirdparty?view=rev&rev=34
Log:
JIRA AST-1666/AST-115
*  Removed the original Diversion Supplementary Services
ETS 300 207-1 Table 3 decode/encode code and replaced with
full implementation.
*  Removed the original Addressing-Data-Elements
ETS 300 196-1 D.3 decode/encode code and replaced with full
implementation of needed structures.

Removed:
    mISDNuser/trunk/suppserv/asn1_basic_service.c
Modified:
    mISDNuser/trunk/suppserv/Makefile
    mISDNuser/trunk/suppserv/asn1.h
    mISDNuser/trunk/suppserv/asn1_address.c
    mISDNuser/trunk/suppserv/asn1_aoc.c
    mISDNuser/trunk/suppserv/asn1_ccbs.c
    mISDNuser/trunk/suppserv/asn1_comp.c
    mISDNuser/trunk/suppserv/asn1_diversion.c
    mISDNuser/trunk/suppserv/asn1_diversion.h
    mISDNuser/trunk/suppserv/asn1_ect.c
    mISDNuser/trunk/suppserv/fac.c
    mISDNuser/trunk/suppserv/suppserv.h

Modified: mISDNuser/trunk/suppserv/Makefile
URL: http://svn.digium.com/view/thirdparty/mISDNuser/trunk/suppserv/Makefile?view=diff&rev=34&r1=33&r2=34
==============================================================================
--- mISDNuser/trunk/suppserv/Makefile (original)
+++ mISDNuser/trunk/suppserv/Makefile Wed Dec 24 12:33:40 2008
@@ -8,7 +8,6 @@
 	asn1.o \
 	asn1_address.o \
 	asn1_aoc.o \
-	asn1_basic_service.o \
 	asn1_ccbs.o \
 	asn1_comp.o \
 	asn1_diversion.o \

Modified: mISDNuser/trunk/suppserv/asn1.h
URL: http://svn.digium.com/view/thirdparty/mISDNuser/trunk/suppserv/asn1.h?view=diff&rev=34&r1=33&r2=34
==============================================================================
--- mISDNuser/trunk/suppserv/asn1.h (original)
+++ mISDNuser/trunk/suppserv/asn1.h Wed Dec 24 12:33:40 2008
@@ -1,3 +1,9 @@
+/*
+ * $Id$
+ *
+ * Abstract Syntax Notation.1 (ASN.1) ITU-T X.208
+ */
+
 #ifndef __ASN1_H__
 #define __ASN1_H__
 
@@ -5,6 +11,13 @@
 #include <asm/types.h>
 #include <sys/types.h>
 #include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ------------------------------------------------------------------- */
+
 
 typedef enum {
 	invoke       = 1,
@@ -20,6 +33,7 @@
 	ReturnErrorP = 3,
 } asn1Problem;
 
+#if 0	/* BUGBUG delete this conditional code */
 struct PublicPartyNumber {
 	int publicTypeOfNumber;
 	char numberDigits[30];
@@ -75,14 +89,17 @@
 struct IntResultList {
 	struct IntResult intResult[10];
 };
+#endif
 
 struct asn1Invoke {
 	__s16 invokeId;
 	__u16 operationValue;
 	union {
+#if 0	/* BUGBUG delete this conditional code */
 		struct ActDivNotification actNot;
 		struct DeactDivNotification deactNot;
 		struct ReqCallDeflection reqCD;
+#endif
 		struct FacAOCDChargingUnit AOCDchu;
 		struct FacAOCDCurrency AOCDcur;
 
@@ -118,6 +135,19 @@
 		struct FacSubaddressTransfer SubaddressTransfer;
 		struct FacEctInform EctInform;
 		struct FacEctLoopTest_ARG EctLoopTest;
+
+		/* Diversion support */
+		struct FacActivationDiversion_ARG ActivationDiversion;
+		struct FacDeactivationDiversion_ARG DeactivationDiversion;
+		struct FacActivationStatusNotificationDiv ActivationStatusNotificationDiv;
+		struct FacDeactivationStatusNotificationDiv DeactivationStatusNotificationDiv;
+		struct FacInterrogationDiversion_ARG InterrogationDiversion;
+		struct FacDiversionInformation DiversionInformation;
+		struct FacCallDeflection_ARG CallDeflection;
+		struct FacCallRerouteing_ARG CallRerouteing;
+		struct FacDivertingLegInformation1 DivertingLegInformation1;
+		struct FacDivertingLegInformation2 DivertingLegInformation2;
+		struct FacDivertingLegInformation3 DivertingLegInformation3;
 	} o;
 };
 
@@ -126,8 +156,10 @@
 	int operationValuePresent;
 	int operationValue;
 	union {
+#if 0	/* BUGBUG delete this conditional code */
 		struct ServedUserNumberList list;
 		struct IntResultList resultList;
+#endif
 
 		struct FacStatusRequest_RES StatusRequest;
 
@@ -151,6 +183,10 @@
 		/* ECT support */
 		struct FacEctLinkIdRequest_RES EctLinkIdRequest;
 		struct FacEctLoopTest_RES EctLoopTest;
+
+		/* Diversion support */
+		struct FacForwardingList InterrogationDiversion;
+		struct FacServedUserNumberList InterrogateServedUserNumbers;
 	} o;
 };
 
@@ -372,6 +408,7 @@
 int encodeComponent_Length_Long_u8(__u8 *msg, __u8 *p);
 
 __u8 *encodeComponentInvoke_Head(__u8 *Dest, int InvokeID, enum FacFunction OperationValue);
+__u8 *encodeComponentInvoke_Head_Long_u8(__u8 *Dest, int InvokeID, enum FacFunction OperationValue);
 
 int encodeOperationValue(__u8 *dest, int operationValue);
 int encodeErrorValue(__u8 *dest, int errorValue);
@@ -397,10 +434,13 @@
 int encodePartySubaddress_Full(__u8 *Dest, const struct FacPartySubaddress *PartySubaddress);
 int encodeAddress_Full(__u8 *Dest, const struct FacAddress *Address);
 int encodePresentedNumberUnscreened_Full(__u8 *Dest, const struct FacPresentedNumberUnscreened *Presented);
-
+int encodePresentedAddressScreened_Full(__u8 *Dest, const struct FacPresentedAddressScreened *Presented);
+
+#if 0	/* BUGBUG delete this conditional code */
 int encodePublicPartyNumber(__u8 *dest, __s8 *facilityPartyNumber);
 int encodePartyNumber(__u8 *dest, __s8 *facilityPartyNumber);
 int encodeAddress(__u8 *dest, __s8 *facilityPartyNumber, __s8 *calledPartySubaddress);
+#endif
 
 /*
 ** ASN.1 Parsing
@@ -430,7 +470,9 @@
 int ParsePartySubaddress_Full(struct asn1_parm *pc, u_char *p, u_char *end, struct FacPartySubaddress *PartySubaddress);
 int ParseAddress_Full(struct asn1_parm *pc, u_char *p, u_char *end, struct FacAddress *Address);
 int ParsePresentedNumberUnscreened_Full(struct asn1_parm *pc, u_char *p, u_char *end, struct FacPresentedNumberUnscreened *Presented);
-
+int ParsePresentedAddressScreened_Full(struct asn1_parm *pc, u_char *p, u_char *end, struct FacPresentedAddressScreened *Presented);
+
+#if 0	/* BUGBUG delete this conditional code */
 int ParsePresentedAddressScreened(struct asn1_parm *pc, u_char *p, u_char *end, char *str);
 int ParsePresentedNumberScreened(struct asn1_parm *pc, u_char *p, u_char *end, char *str);
 int ParsePresentedNumberUnscreened(struct asn1_parm *pc, u_char *p, u_char *end, char *str);
@@ -447,6 +489,7 @@
 int ParseNSAPSubaddress(struct asn1_parm *pc, u_char *p, u_char *end, char *str);
 int ParseSubaddressInformation(struct asn1_parm *pc, u_char *p, u_char *end, char *str);
 int ParseScreeningIndicator(struct asn1_parm *pc, u_char *p, u_char *end, char *str);
+#endif
 
 /* Advice Of Charge (AOC) prototypes */
 int ParseAOCECurrency(struct asn1_parm *pc, u_char *p, u_char *end, int dummy);
@@ -471,7 +514,18 @@
 int ParseChargingAssociation(struct asn1_parm *pc,u_char *p, u_char *end, int dummy);
 int ParseChargeIdentifier(struct asn1_parm *pc,u_char *p, u_char *end, int dummy);
 
+#if 0	/* BUGBUG delete this conditional code */
 /* Basic-Service-Elements prototypes */
 int ParseBasicService(struct asn1_parm *pc, u_char *p, u_char *end, int *basicService);
-
-#endif
+#endif
+
+
+/* ------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* __ASN1_H__ */
+/* ------------------------------------------------------------------- */
+/* end asn1.h */

Modified: mISDNuser/trunk/suppserv/asn1_address.c
URL: http://svn.digium.com/view/thirdparty/mISDNuser/trunk/suppserv/asn1_address.c?view=diff&rev=34&r1=33&r2=34
==============================================================================
--- mISDNuser/trunk/suppserv/asn1_address.c (original)
+++ mISDNuser/trunk/suppserv/asn1_address.c Wed Dec 24 12:33:40 2008
@@ -1,15 +1,15 @@
 /* $Id$
  *
+ * Addressing-Data-Elements ETS 300 196-1 D.3
+ *
+ * Addressing-Data-Elements encode/decode
  */
 
 #include "asn1.h"
 #include <string.h>
 
-
-
-// ======================================================================
-// Address Types EN 300 196-1 D.3
-
+/* ------------------------------------------------------------------- */
+#if 0	/* BUGBUG delete this section */
 static int ParseNumberDigits(struct asn1_parm *pc, u_char *p, u_char *end, char *str)
 {
 	struct asn1ParseString number;
@@ -302,6 +302,7 @@
 
 	return p - dest;
 }
+#else
 
 
 
@@ -382,6 +383,7 @@
 
 	Dest[0] = ASN1_TAG_SEQUENCE;
 	p = &Dest[2];
+
 	p += encodeEnum(p, ASN1_TAG_ENUM, TypeOfNumber);
 	p += encodeNumericString(p, ASN1_TAG_NUMERIC_STRING, Number, LengthOfNumber);
 
@@ -622,6 +624,7 @@
 	case 0: /* UserSpecified */
 		Dest[0] = ASN1_TAG_SEQUENCE;
 		p = &Dest[2];
+
 		p += encodeOctetString(p, ASN1_TAG_OCTET_STRING, (const __s8 *) PartySubaddress->u.UserSpecified.Information, PartySubaddress->Length);
 		if (PartySubaddress->u.UserSpecified.OddCountPresent) {
 			p += encodeBoolean(p, ASN1_TAG_BOOLEAN, PartySubaddress->u.UserSpecified.OddCount);
@@ -686,6 +689,7 @@
 
 	Dest[0] = ASN1_TAG_SEQUENCE;
 	p = &Dest[2];
+
 	p += encodePartyNumber_Full(p, &Address->Party);
 	if (Address->Subaddress.Length) {
 		p += encodePartySubaddress_Full(p, &Address->Subaddress);
@@ -810,3 +814,148 @@
 	XCHOICE_DEFAULT;
 }	/* end ParsePresentedNumberUnscreened_Full() */
 
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Encode the AddressScreened type.
+ *
+ * \param Dest Where to put the encoding
+ * \param Address Address information to encode.
+ *
+ * \retval length
+ */
+static int encodeAddressScreened_Full(__u8 *Dest, const struct FacAddressScreened *Address)
+{
+	__u8 *p;
+
+	Dest[0] = ASN1_TAG_SEQUENCE;
+	p = &Dest[2];
+
+	p += encodePartyNumber_Full(p, &Address->Party);
+	p += encodeEnum(p, ASN1_TAG_ENUM, Address->ScreeningIndicator);
+	if (Address->Subaddress.Length) {
+		p += encodePartySubaddress_Full(p, &Address->Subaddress);
+	}
+
+	/* length */
+	Dest[1] = p - &Dest[2];
+
+	return p - Dest;
+}	/* end encodeAddressScreened_Full() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Parse the AddressScreened argument parameters.
+ *
+ * \param pc Complete component message storage data.
+ * \param p Starting buffer position to parse arguments
+ * \param end End buffer position that must not go past.
+ * \param Address Parameter storage to fill.
+ *
+ * \retval length of buffer consumed
+ * \retval -1 on error.
+ */
+static int ParseAddressScreened_Full(struct asn1_parm *pc, u_char *p, u_char *end, struct FacAddressScreened *Address)
+{
+	int Value;
+	INIT;
+
+	XSEQUENCE_1(ParsePartyNumber_Full, ASN1_NOT_TAGGED, ASN1_NOT_TAGGED, &Address->Party);
+	XSEQUENCE_1(ParseEnum, ASN1_TAG_ENUM, ASN1_NOT_TAGGED, &Value);
+	Address->ScreeningIndicator = Value;
+	if (p < end) {
+		/* The optional subaddress must be present since there is something left. */
+		XSEQUENCE_1(ParsePartySubaddress_Full, ASN1_NOT_TAGGED, ASN1_NOT_TAGGED, &Address->Subaddress);
+	} else {
+		Address->Subaddress.Length = 0;/* Subaddress not present */
+	}
+
+	return p - beg;
+}	/* end ParseAddressScreened_Full() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \brief Encode the PresentedAddressScreened type.
+ *
+ * \param Dest Where to put the encoding
+ * \param Presented Address information to encode.
+ *
+ * \retval length
+ */
+int encodePresentedAddressScreened_Full(__u8 *Dest, const struct FacPresentedAddressScreened *Presented)
+{
+	__u8 *p;
+	__u8 *TagStart;
+
+	p = Dest;
+	switch (Presented->Type) {
+	case 0: /* presentationAllowedAddress */
+		TagStart = p;
+		p += encodeAddressScreened_Full(p, &Presented->Address);
+		TagStart[0] = ASN1_TAG_CONTEXT_SPECIFIC | ASN1_TAG_CONSTRUCTED | 0;
+		break;
+	case 1: /* presentationRestricted */
+		p += encodeNull(p, ASN1_TAG_CONTEXT_SPECIFIC | 1);
+		break;
+	case 2: /* numberNotAvailableDueToInterworking */
+		p += encodeNull(p, ASN1_TAG_CONTEXT_SPECIFIC | 2);
+		break;
+	case 3: /* presentationRestrictedAddress */
+		TagStart = p;
+		p += encodeAddressScreened_Full(p, &Presented->Address);
+		TagStart[0] = ASN1_TAG_CONTEXT_SPECIFIC | ASN1_TAG_CONSTRUCTED | 3;
+		break;
+	default:
+		break;
+	}	/* end switch */
+
+	return p - Dest;
+}	/* end encodePresentedAddressScreened_Full() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \brief Parse the PresentedAddressScreened argument parameters.
+ *
+ * \param pc Complete component message storage data.
+ * \param p Starting buffer position to parse arguments
+ * \param end End buffer position that must not go past.
+ * \param Presented Parameter storage to fill.
+ *
+ * \retval length of buffer consumed
+ * \retval -1 on error.
+ */
+int ParsePresentedAddressScreened_Full(struct asn1_parm *pc, u_char *p, u_char *end, struct FacPresentedAddressScreened *Presented)
+{
+	INIT;
+
+	Presented->Type = 0;
+	XCHOICE_1(ParseAddressScreened_Full, ASN1_TAG_CONTEXT_SPECIFIC | ASN1_TAG_CONSTRUCTED, 0, &Presented->Address);
+	Presented->Type = 1;
+	XCHOICE(ParseNull, ASN1_TAG_CONTEXT_SPECIFIC, 1);
+	Presented->Type = 2;
+	XCHOICE(ParseNull, ASN1_TAG_CONTEXT_SPECIFIC, 2);
+	Presented->Type = 3;
+	XCHOICE_1(ParseAddressScreened_Full, ASN1_TAG_CONTEXT_SPECIFIC | ASN1_TAG_CONSTRUCTED, 3, &Presented->Address);
+
+	XCHOICE_DEFAULT;
+}	/* end ParsePresentedAddressScreened_Full() */
+#endif
+
+
+
+
+/* ------------------------------------------------------------------- */
+/* end asn1_address.c */

Modified: mISDNuser/trunk/suppserv/asn1_aoc.c
URL: http://svn.digium.com/view/thirdparty/mISDNuser/trunk/suppserv/asn1_aoc.c?view=diff&rev=34&r1=33&r2=34
==============================================================================
--- mISDNuser/trunk/suppserv/asn1_aoc.c (original)
+++ mISDNuser/trunk/suppserv/asn1_aoc.c Wed Dec 24 12:33:40 2008
@@ -12,6 +12,8 @@
 ParseAOCDCurrency(struct asn1_parm *pc, u_char *p, u_char *end, struct FacAOCDCurrency *cur)
 {
 	INIT;
+
+	cur->invokeId = pc->u.inv.invokeId;
 
 	cur->chargeNotAvailable = 1;
 	cur->freeOfCharge = 0;
@@ -31,6 +33,8 @@
 {
 	INIT;
 
+	chu->invokeId = pc->u.inv.invokeId;
+
 	chu->chargeNotAvailable = 1;
 	chu->freeOfCharge = 0;
 	chu->recordedUnits = 0;

Modified: mISDNuser/trunk/suppserv/asn1_ccbs.c
URL: http://svn.digium.com/view/thirdparty/mISDNuser/trunk/suppserv/asn1_ccbs.c?view=diff&rev=34&r1=33&r2=34
==============================================================================
--- mISDNuser/trunk/suppserv/asn1_ccbs.c (original)
+++ mISDNuser/trunk/suppserv/asn1_ccbs.c Wed Dec 24 12:33:40 2008
@@ -32,9 +32,9 @@
 
 	/* [APPLICATION 0] IMPLICIT OCTET STRING */
 	Dest[0] = ASN1_TAG_APPLICATION_WIDE | 0;
+	p = &Dest[2];
 
 	/* Store value */
-	p = &Dest[2];
 	if (Q931ie->Bc.Length) {
 		*p++ = 0x04; /* Q.931 Bearer Capability ie tag */
 		*p++ = Q931ie->Bc.Length;
@@ -142,6 +142,7 @@
 
 	Dest[0] = ASN1_TAG_SEQUENCE;
 	p = &Dest[2];
+
 	p += encodeAddress_Full(p, &CallInformation->AddressOfB);
 	p += encodeQ931ie_CCBS(p, &CallInformation->Q931ie);
 	p += encodeInt(p, ASN1_TAG_INTEGER, CallInformation->CCBSReference);
@@ -212,6 +213,7 @@
 
 	Dest[0] = ASN1_TAG_SEQUENCE;
 	p = &Dest[1 + ASN1_NUM_OCTETS_LONG_LENGTH_u8];
+
 	for (Index = 0; Index < NumRecords; ++Index) {
 		p += encodeCallInformation(p, &CallDetails[Index]);
 	}	/* end for */
@@ -280,9 +282,11 @@
 
 		SeqStart = p;
 		SeqStart[0] = ASN1_TAG_SEQUENCE;
+
 		p = &SeqStart[2];
 		p += encodeEnum(p, ASN1_TAG_ENUM, StatusRequest->Component.Invoke.CompatibilityMode);
 		p += encodeQ931ie_CCBS(p, &StatusRequest->Component.Invoke.Q931ie);
+
 		/* sequence Length */
 		SeqStart[1] = p - &SeqStart[2];
 
@@ -295,8 +299,11 @@
 		SeqStart = p;
 		SeqStart[0] = ASN1_TAG_SEQUENCE;
 		p = &SeqStart[2];
+
 		p += encodeOperationValue(p, Fac_StatusRequest);
+
 		p += encodeEnum(p, ASN1_TAG_ENUM, StatusRequest->Component.Result.Status);
+
 		/* sequence Length */
 		SeqStart[1] = p - &SeqStart[2];
 
@@ -508,7 +515,9 @@
 		SeqStart = p;
 		SeqStart[0] = ASN1_TAG_SEQUENCE;
 		p = &SeqStart[2];
+
 		p += encodeOperationValue(p, Fac_CCBSDeactivate);
+
 		/* sequence Length */
 		SeqStart[1] = p - &SeqStart[2];
 
@@ -575,11 +584,13 @@
 	SeqStart = p;
 	SeqStart[0] = ASN1_TAG_SEQUENCE;
 	p = &SeqStart[2];
+
 	p += encodeEnum(p, ASN1_TAG_ENUM, CCBSErase->RecallMode);
 	p += encodeInt(p, ASN1_TAG_INTEGER, CCBSErase->CCBSReference);
 	p += encodeAddress_Full(p, &CCBSErase->AddressOfB);
 	p += encodeQ931ie_CCBS(p, &CCBSErase->Q931ie);
 	p += encodeEnum(p, ASN1_TAG_ENUM, CCBSErase->Reason);
+
 	/* sequence Length */
 	SeqStart[1] = p - &SeqStart[2];
 
@@ -647,10 +658,12 @@
 	SeqStart = p;
 	SeqStart[0] = ASN1_TAG_SEQUENCE;
 	p = &SeqStart[2];
+
 	p += encodeEnum(p, ASN1_TAG_ENUM, CCBSRemoteUserFree->RecallMode);
 	p += encodeInt(p, ASN1_TAG_INTEGER, CCBSRemoteUserFree->CCBSReference);
 	p += encodeAddress_Full(p, &CCBSRemoteUserFree->AddressOfB);
 	p += encodeQ931ie_CCBS(p, &CCBSRemoteUserFree->Q931ie);
+
 	/* sequence Length */
 	SeqStart[1] = p - &SeqStart[2];
 
@@ -770,10 +783,12 @@
 	SeqStart = p;
 	SeqStart[0] = ASN1_TAG_SEQUENCE;
 	p = &SeqStart[2];
+
 	p += encodeEnum(p, ASN1_TAG_ENUM, CCBSBFree->RecallMode);
 	p += encodeInt(p, ASN1_TAG_INTEGER, CCBSBFree->CCBSReference);
 	p += encodeAddress_Full(p, &CCBSBFree->AddressOfB);
 	p += encodeQ931ie_CCBS(p, &CCBSBFree->Q931ie);
+
 	/* sequence Length */
 	SeqStart[1] = p - &SeqStart[2];
 
@@ -895,9 +910,11 @@
 		SeqStart = p;
 		SeqStart[0] = ASN1_TAG_SEQUENCE;
 		p = &SeqStart[2];
+
 		p += encodeEnum(p, ASN1_TAG_ENUM, CCBSStatusRequest->Component.Invoke.RecallMode);
 		p += encodeInt(p, ASN1_TAG_INTEGER, CCBSStatusRequest->Component.Invoke.CCBSReference);
 		p += encodeQ931ie_CCBS(p, &CCBSStatusRequest->Component.Invoke.Q931ie);
+
 		/* sequence Length */
 		SeqStart[1] = p - &SeqStart[2];
 
@@ -910,8 +927,11 @@
 		SeqStart = p;
 		SeqStart[0] = ASN1_TAG_SEQUENCE;
 		p = &SeqStart[2];
+
 		p += encodeOperationValue(p, Fac_CCBSStatusRequest);
+
 		p += encodeBoolean(p, ASN1_TAG_BOOLEAN, CCBSStatusRequest->Component.Result.Free);
+
 		/* sequence Length */
 		SeqStart[1] = p - &SeqStart[2];
 
@@ -1019,14 +1039,19 @@
 		SeqStart = p;
 		SeqStart[0] = ASN1_TAG_SEQUENCE;
 		p = &SeqStart[2];
+
 		p += encodeOperationValue(p, MsgType);
+
 		ResultSeqStart = p;
 		ResultSeqStart[0] = ASN1_TAG_SEQUENCE;
 		p = &ResultSeqStart[2];
+
 		p += encodeEnum(p, ASN1_TAG_ENUM, CCBSRequest->Component.Result.RecallMode);
 		p += encodeInt(p, ASN1_TAG_INTEGER, CCBSRequest->Component.Result.CCBSReference);
+
 		/* sequence Length */
 		ResultSeqStart[1] = p - &ResultSeqStart[2];
+
 		/* sequence Length */
 		SeqStart[1] = p - &SeqStart[2];
 
@@ -1203,12 +1228,14 @@
 		SeqStart = p;
 		SeqStart[0] = ASN1_TAG_SEQUENCE;
 		p = &SeqStart[2];
+
 		if (CCBSInterrogate->Component.Invoke.CCBSReferencePresent) {
 			p += encodeInt(p, ASN1_TAG_INTEGER, CCBSInterrogate->Component.Invoke.CCBSReference);
 		}
 		if (CCBSInterrogate->Component.Invoke.AParty.LengthOfNumber) {
 			p += encodePartyNumber_Full(p, &CCBSInterrogate->Component.Invoke.AParty);
 		}
+
 		/* sequence Length */
 		SeqStart[1] = p - &SeqStart[2];
 
@@ -1221,16 +1248,21 @@
 		SeqStart = p;
 		SeqStart[0] = ASN1_TAG_SEQUENCE;
 		p = &SeqStart[1 + ASN1_NUM_OCTETS_LONG_LENGTH_u8];
+
 		p += encodeOperationValue(p, MsgType);
+
 		ResultSeqStart = p;
 		ResultSeqStart[0] = ASN1_TAG_SEQUENCE;
 		p = &ResultSeqStart[1 + ASN1_NUM_OCTETS_LONG_LENGTH_u8];
+
 		p += encodeEnum(p, ASN1_TAG_ENUM, CCBSInterrogate->Component.Result.RecallMode);
 		if (CCBSInterrogate->Component.Result.NumRecords) {
 			p += encodeCallDetails(p, CCBSInterrogate->Component.Result.NumRecords, CCBSInterrogate->Component.Result.CallDetails);
 		}
+
 		/* sequence Length */
 		encodeLen_Long_u8(&ResultSeqStart[1], p - &ResultSeqStart[1 + ASN1_NUM_OCTETS_LONG_LENGTH_u8]);
+
 		/* sequence Length */
 		encodeLen_Long_u8(&SeqStart[1], p - &SeqStart[1 + ASN1_NUM_OCTETS_LONG_LENGTH_u8]);
 

Modified: mISDNuser/trunk/suppserv/asn1_comp.c
URL: http://svn.digium.com/view/thirdparty/mISDNuser/trunk/suppserv/asn1_comp.c?view=diff&rev=34&r1=33&r2=34
==============================================================================
--- mISDNuser/trunk/suppserv/asn1_comp.c (original)
+++ mISDNuser/trunk/suppserv/asn1_comp.c Wed Dec 24 12:33:40 2008
@@ -142,49 +142,58 @@
 
 	switch (operationValue) {
 	/* Diversion support */
-#if 0
 	case Fac_ActivationDiversion:
-		XSEQUENCE(ParseARGActivationDiversion, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED);
+		XSEQUENCE_1(ParseActivationDiversion_ARG, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.ActivationDiversion);
 		break;
 	case Fac_DeactivationDiversion:
-		XSEQUENCE(ParseARGDeactivationDiversion, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED);
-		break;
-#endif
+		XSEQUENCE_1(ParseDeactivationDiversion_ARG, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.DeactivationDiversion);
+		break;
 	case Fac_ActivationStatusNotificationDiv:
-		XSEQUENCE_1(ParseARGActivationStatusNotificationDiv, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.actNot);
+		XSEQUENCE_1(ParseActivationStatusNotificationDiv_ARG, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.ActivationStatusNotificationDiv);
 		break;
 	case Fac_DeactivationStatusNotificationDiv:
-		XSEQUENCE_1(ParseARGDeactivationStatusNotificationDiv, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.deactNot);
-		break;
-#if 0
+		XSEQUENCE_1(ParseDeactivationStatusNotificationDiv_ARG, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.DeactivationStatusNotificationDiv);
+		break;
 	case Fac_InterrogationDiversion:
-		XSEQUENCE(ParseARGInterrogationDiversion, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED);
+		XSEQUENCE_1(ParseInterrogationDiversion_ARG, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.InterrogationDiversion);
 		break;
 	case Fac_DiversionInformation:
-		XSEQUENCE(ParseARGDiversionInformation, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED);
-		break;
-#endif
+		XSEQUENCE_1(ParseDiversionInformation_ARG, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.DiversionInformation);
+		break;
 	case Fac_CallDeflection:
-		XSEQUENCE_1(ParseARGReqCallDeflection, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.reqCD);
-		break;
-#if 0
+		XSEQUENCE_1(ParseCallDeflection_ARG, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.CallDeflection);
+		break;
+	case Fac_CallRerouteing:
+		XSEQUENCE_1(ParseCallRerouteing_ARG, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.CallRerouteing);
+		break;
 	case Fac_InterrogateServedUserNumbers:
-		XSEQUENCE(ParseARGInterrogateServedUserNumbers, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED);
-		break;
-#endif
+		/* No additional invoke parameters */
+		break;
+	case Fac_DivertingLegInformation1:
+		XSEQUENCE_1(ParseDivertingLegInformation1_ARG, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.DivertingLegInformation1);
+		break;
+	case Fac_DivertingLegInformation2:
+		XSEQUENCE_1(ParseDivertingLegInformation2_ARG, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.DivertingLegInformation2);
+		break;
+	case Fac_DivertingLegInformation3:
+		XSEQUENCE_1(ParseDivertingLegInformation3_ARG, ASN1_NOT_TAGGED, ASN1_NOT_TAGGED, &pc->u.inv.o.DivertingLegInformation3);
+		break;
 
 	/* ECT support */
 	case Fac_EctExecute:
+		/* No additional invoke parameters */
 		break;
 	case Fac_ExplicitEctExecute:
 		XSEQUENCE_1(ParseExplicitEctExecute_ARG, ASN1_NOT_TAGGED, ASN1_NOT_TAGGED, &pc->u.inv.o.ExplicitEctExecute);
 		break;
 	case Fac_RequestSubaddress:
+		/* No additional invoke parameters */
 		break;
 	case Fac_SubaddressTransfer:
 		XSEQUENCE_1(ParseSubaddressTransfer_ARG, ASN1_NOT_TAGGED, ASN1_NOT_TAGGED, &pc->u.inv.o.SubaddressTransfer);
 		break;
 	case Fac_EctLinkIdRequest:
+		/* No additional invoke parameters */
 		break;
 	case Fac_EctInform:
 		XSEQUENCE_1(ParseEctInform_ARG, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &pc->u.inv.o.EctInform);
@@ -195,15 +204,10 @@
 
 	/* AOC support */
 #if 0
-	//case Fac_ChargingRequest:
-	//	XSEQUENCE(ParseChargingRequest, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED);
-	//	break;
-	//case Fac_AOCSCurrency:
-	//	XSEQUENCE(ParseAOCSCurrency, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED);
-	//	break;
-	//case Fac_AOCSSpecialArr:
-	//	XSEQUENCE(ParseAOCSSpecialArr, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED);
-	//	break;
+	case Fac_ChargingRequest:
+	case Fac_AOCSCurrency:
+	case Fac_AOCSSpecialArr:
+		break;
 #endif
 	case Fac_AOCDCurrency:
 		XSEQUENCE_1(ParseAOCDCurrency, ASN1_NOT_TAGGED, ASN1_NOT_TAGGED, &pc->u.inv.o.AOCDcur);
@@ -213,10 +217,7 @@
 		break;
 #if 0
 	case Fac_AOCECurrency:
-		XSEQUENCE(ParseAOCECurrency, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED);
-		break;
 	case Fac_AOCEChargingUnit:
-		XSEQUENCE(ParseAOCEChargingUnit, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED);
 		break;
 #endif
 
@@ -297,14 +298,20 @@
 
 	switch (pc->u.retResult.operationValue) {
 	/* Diversion support */
-#if 0
+	case Fac_ActivationDiversion:
+	case Fac_DeactivationDiversion:
+		/* No additional result parameters */
+		break;
 	case Fac_InterrogationDiversion:
-		XSEQUENCE(ParseRESInterrogationDiversion, ASN1_NOT_TAGGED, ASN1_NOT_TAGGED);
+		XSEQUENCE_1(ParseInterrogationDiversion_RES, ASN1_TAG_SET, ASN1_NOT_TAGGED, &pc->u.retResult.o.InterrogationDiversion);
+		break;
+	case Fac_CallDeflection:
+	case Fac_CallRerouteing:
+		/* No additional result parameters */
 		break;
 	case Fac_InterrogateServedUserNumbers:
-		XSEQUENCE(ParseRESInterrogateServedUserNumbers, ASN1_NOT_TAGGED, ASN1_NOT_TAGGED);
-		break;
-#endif
+		XSEQUENCE_1(ParseInterrogateServedUserNumbers_RES, ASN1_TAG_SET, ASN1_NOT_TAGGED, &pc->u.retResult.o.InterrogateServedUserNumbers);
+		break;
 
 	/* ECT support */
 	case Fac_EctLinkIdRequest:
@@ -317,6 +324,12 @@
 	case Fac_StatusRequest:
 		XSEQUENCE_1(ParseStatusRequest_RES, ASN1_NOT_TAGGED, ASN1_NOT_TAGGED, &pc->u.retResult.o.StatusRequest);
 		break;
+
+#if 0
+	/* AOC support */
+	case Fac_ChargingRequest:
+		break;
+#endif
 
 	/* CCBS/CCNR support */
 	case Fac_CCBSDeactivate:
@@ -499,11 +512,11 @@
 		error = msg;
 		break;
 	}
-	print_asn1msg(PRT_DEBUG_DECODE, "%s Error: %s\n", __FUNCTION__, error);
+	print_asn1msg(PRT_DEBUG_DECODE, "%s Decoded-Error: %s\n", __FUNCTION__, error);
 #endif	/* defined(ASN1_DEBUG) */
 
 	return p - beg;
-}
+}	/* end of ParseReturnErrorComponent() */
 
 int
 ParseProblemValue(struct asn1_parm *pc, u_char *p, u_char *end, asn1Problem prob)

Modified: mISDNuser/trunk/suppserv/asn1_diversion.c
URL: http://svn.digium.com/view/thirdparty/mISDNuser/trunk/suppserv/asn1_diversion.c?view=diff&rev=34&r1=33&r2=34
==============================================================================
--- mISDNuser/trunk/suppserv/asn1_diversion.c (original)
+++ mISDNuser/trunk/suppserv/asn1_diversion.c Wed Dec 24 12:33:40 2008
@@ -1,13 +1,16 @@
 /* $Id$
  *
+ * Diversion Supplementary Services ETS 300 207-1 Table 3
+ *
+ * Diversion Facility ie encode/decode
  */
 
 #include "asn1.h"
 #include "asn1_diversion.h"
-
-// ======================================================================
-// Diversion Supplementary Services ETS 300 207-1 Table 3
-
+#include <string.h>
+
+/* ------------------------------------------------------------------- */
+#if 0	/* BUGBUG delete this section */
 int
 ParseARGReqCallDeflection(struct asn1_parm *pc, u_char *p, u_char *end, struct ReqCallDeflection *reqCD)
 {
@@ -79,7 +82,7 @@
 }
 
 #if 0
-int 
+int
 ParseARGInterrogationDiversion(struct asn1_parm *pc, u_char *p, u_char *end, int dummy)
 {
 	int procedure, basicService;
@@ -96,7 +99,7 @@
 }
 #endif
 
-int 
+int
 ParseRESInterrogationDiversion(struct asn1_parm *pc, u_char *p, u_char *end, int dummy)
 {
 	print_asn1msg(PRT_SHOWNUMBERS, "Interrogation Diversion Result\n");
@@ -104,7 +107,7 @@
 }
 
 #if 0
-int 
+int
 ParseARGInterrogateServedUserNumbers(struct asn1_parm *pc, u_char *p, u_char *end, int dummy)
 {
 	print_asn1msg(PRT_SHOWNUMBERS, "Interrogate Served User Numbers\n");
@@ -112,7 +115,7 @@
 }
 #endif
 
-int 
+int
 ParseRESInterrogateServedUserNumbers(struct asn1_parm *pc, u_char *p, u_char *end, int dummy)
 {
 	int ret;
@@ -122,11 +125,11 @@
 		return ret;
 
 	print_asn1msg(PRT_SHOWNUMBERS, "Interrogate Served User Numbers:\n");
-	
+
 	return ret;
 }
 
-int 
+int
 ParseARGDiversionInformation(struct asn1_parm *pc, u_char *p, u_char *end, int dummy)
 {
 	char diversionReason[20];
@@ -137,7 +140,7 @@
 	char lastDivertingNr[80];
 	char lastDivertingReason[20];
 	INIT;
-	
+
 	servedUserSubaddress[0] = 0;
 	callingAddress[0] = 0;
 	originalCalledNr[0] = 0;
@@ -160,7 +163,7 @@
 	return p - beg;
 }
 
-int 
+int
 ParseIntResultList(struct asn1_parm *pc, u_char *p, u_char *end, struct IntResultList *intResultList)
 {
 	int i;
@@ -168,14 +171,14 @@
 
 	for (i = 0; i < 10; i++) {
 		intResultList->intResult[i].basicService = -1;
-		XSEQUENCE_OPT_1(ParseIntResult, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, 
+		XSEQUENCE_OPT_1(ParseIntResult, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED,
 				&intResultList->intResult[i] );
 	}
 
 	return p - beg;
 }
 
-int 
+int
 ParseIntResult(struct asn1_parm *pc, u_char *p, u_char *end, struct IntResult *intResult)
 {
 	INIT;
@@ -240,7 +243,7 @@
 	ret = ParseEnum(pc, p, end, &diversionReason);
 	if (ret < 0)
 		return ret;
-	
+
 	switch (diversionReason) {
 	case 0: sprintf(str, "unknown"); break;
 	case 1: sprintf(str, "CFU"); break;
@@ -349,4 +352,1642 @@
 
 	return encodeComponent_Length(dest, p);
 }
-
+#else
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Encode the Q.931 ie UserUser value used for Diversion.
+ *
+ * \param Dest Where to put the encoding
+ * \param Q931ie Q931 ie information to encode.
+ *
+ * \retval length
+ */
+static int encodeQ931_Div_UserInfo(__u8 *Dest, const struct Q931_UserUserInformation *Q931ie)
+{
+	int Length;
+	__u8 *p;
+
+	/* [APPLICATION 0] IMPLICIT OCTET STRING */
+	Dest[0] = ASN1_TAG_APPLICATION_WIDE | 0;
+
+	/* Pre-calculate content length */
+	if (Q931ie->Length) {
+		Length = 2 + Q931ie->Length;
+	} else {
+		Length = 0;
+	}
+
+	/* Store length */
+	if (Length < 0x80) {
+		Dest[1] = Length;
+		p = &Dest[2];
+	} else {
+		encodeLen_Long_u8(&Dest[1], Length);
+		p = &Dest[1 + ASN1_NUM_OCTETS_LONG_LENGTH_u8];
+	}
+
+	/* Store value */
+	if (Q931ie->Length) {
+		*p++ = 0x7E; /* Q.931 User-User-Information ie tag */
+		*p++ = Q931ie->Length;
+		memcpy(p, Q931ie->Contents, Q931ie->Length);
+		p += Q931ie->Length;
+	}
+
+	return p - Dest;
+}	/* end encodeQ931_Div_UserInfo() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Parse the Q.931 argument contents for Diversion.
+ *
+ * \param pc Complete component message storage data.
+ * \param p Starting buffer position to parse arguments
+ * \param end End buffer position that must not go past.
+ * \param Q931ie Parameter storage to fill.
+ *
+ * \retval length of buffer consumed
+ * \retval -1 on error.
+ */
+static int ParseQ931_Div_UserInfo(struct asn1_parm *pc, u_char *p, u_char *end, struct Q931_UserUserInformation *Q931ie)
+{
+	__u8 Ie_type;
+	size_t Length;
+	INIT;
+
+	memset(Q931ie, 0, sizeof(*Q931ie));
+	do {
+		if (end < p + 2) {
+			/* Q.931 ie length error */
+			return -1;
+		}
+		Ie_type = *p++;
+		Length = *p++;
+		if (end < p + Length) {
+			/* Q.931 ie length error */
+			return -1;
+		}
+		switch (Ie_type) {
+		case 0x7E: /* Q.931 User-User-Information ie tag */
+			if (Length <= sizeof(Q931ie->Contents)) {
+				Q931ie->Length = Length;
+				memcpy(Q931ie->Contents, p, Length);
+			}
+			break;
+		default:
+			/* Unknown Q.931 ie in Diversion message */
+			break;
+		}	/* end switch */
+		p += Length;
+	} while (p < end);
+
+	return p - beg;
+}	/* end ParseQ931_Div_UserInfo() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Encode the Q.931 ie value used for Diversion.
+ *
+ * \param Dest Where to put the encoding
+ * \param Q931ie Q931 ie information to encode.
+ *
+ * \retval length
+ */
+static int encodeQ931_Div(__u8 *Dest, const struct Q931_Bc_Hlc_Llc_Uu *Q931ie)
+{
+	int Length;
+	__u8 *p;
+
+	/* [APPLICATION 0] IMPLICIT OCTET STRING */
+	Dest[0] = ASN1_TAG_APPLICATION_WIDE | 0;
+
+	/* Pre-calculate content length */
+	Length = 0;
+	if (Q931ie->Bc.Length) {
+		Length += 2 + Q931ie->Bc.Length;
+	}
+	if (Q931ie->Hlc.Length) {
+		Length += 2 + Q931ie->Hlc.Length;
+	}
+	if (Q931ie->Llc.Length) {
+		Length += 2 + Q931ie->Llc.Length;
+	}
+	if (Q931ie->UserInfo.Length) {
+		Length += 2 + Q931ie->UserInfo.Length;
+	}
+
+	/* Store length */
+	if (Length < 0x80) {
+		Dest[1] = Length;
+		p = &Dest[2];
+	} else {
+		encodeLen_Long_u8(&Dest[1], Length);
+		p = &Dest[1 + ASN1_NUM_OCTETS_LONG_LENGTH_u8];
+	}
+
+	/* Store value */
+	if (Q931ie->Bc.Length) {
+		*p++ = 0x04; /* Q.931 Bearer Capability ie tag */
+		*p++ = Q931ie->Bc.Length;
+		memcpy(p, Q931ie->Bc.Contents, Q931ie->Bc.Length);
+		p += Q931ie->Bc.Length;
+	}
+	if (Q931ie->Llc.Length) {
+		*p++ = 0x7C; /* Q.931 Low Layer Compatibility ie tag */
+		*p++ = Q931ie->Llc.Length;
+		memcpy(p, Q931ie->Llc.Contents, Q931ie->Llc.Length);
+		p += Q931ie->Llc.Length;
+	}
+	if (Q931ie->Hlc.Length) {
+		*p++ = 0x7D; /* Q.931 High Layer Compatibility ie tag */
+		*p++ = Q931ie->Hlc.Length;
+		memcpy(p, Q931ie->Hlc.Contents, Q931ie->Hlc.Length);
+		p += Q931ie->Hlc.Length;
+	}
+	if (Q931ie->UserInfo.Length) {
+		*p++ = 0x7E; /* Q.931 User-User-Information ie tag */
+		*p++ = Q931ie->UserInfo.Length;
+		memcpy(p, Q931ie->UserInfo.Contents, Q931ie->UserInfo.Length);
+		p += Q931ie->UserInfo.Length;
+	}
+
+	return p - Dest;
+}	/* end encodeQ931_Div() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Parse the Q.931 argument contents for Diversion.
+ *
+ * \param pc Complete component message storage data.
+ * \param p Starting buffer position to parse arguments
+ * \param end End buffer position that must not go past.
+ * \param Q931ie Parameter storage to fill.
+ *
+ * \retval length of buffer consumed
+ * \retval -1 on error.
+ */
+static int ParseQ931_Div(struct asn1_parm *pc, u_char *p, u_char *end, struct Q931_Bc_Hlc_Llc_Uu *Q931ie)
+{
+	__u8 Ie_type;
+	size_t Length;
+	INIT;
+
+	memset(Q931ie, 0, sizeof(*Q931ie));
+	do {
+		if (end < p + 2) {
+			/* Q.931 ie length error */
+			return -1;
+		}
+		Ie_type = *p++;
+		Length = *p++;
+		if (end < p + Length) {
+			/* Q.931 ie length error */
+			return -1;
+		}
+		switch (Ie_type) {
+		case 0x04: /* Q.931 Bearer Capability ie tag */
+			if (Length <= sizeof(Q931ie->Bc.Contents)) {
+				Q931ie->Bc.Length = Length;
+				memcpy(Q931ie->Bc.Contents, p, Length);
+			}
+			break;
+		case 0x7C: /* Q.931 Low Layer Compatibility ie tag */
+			if (Length <= sizeof(Q931ie->Llc.Contents)) {
+				Q931ie->Llc.Length = Length;
+				memcpy(Q931ie->Llc.Contents, p, Length);
+			}
+			break;
+		case 0x7D: /* Q.931 High Layer Compatibility ie tag */
+			if (Length <= sizeof(Q931ie->Hlc.Contents)) {
+				Q931ie->Hlc.Length = Length;
+				memcpy(Q931ie->Hlc.Contents, p, Length);
+			}
+			break;
+		case 0x7E: /* Q.931 User-User-Information ie tag */
+			if (Length <= sizeof(Q931ie->UserInfo.Contents)) {
+				Q931ie->UserInfo.Length = Length;
+				memcpy(Q931ie->UserInfo.Contents, p, Length);
+			}
+			break;
+		default:
+			/* Unknown Q.931 ie in Diversion message */
+			break;
+		}	/* end switch */
+		p += Length;
+	} while (p < end);
+
+	return p - beg;
+}	/* end ParseQ931_Div() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Encode the ServedUserNr type.
+ *
+ * \param Dest Where to put the encoding
+ * \param ServedUser Served user number information to encode.
+ *
+ * \retval length
+ */
+static int encodeServedUserNumber_Full(__u8 *Dest, const struct FacPartyNumber *ServedUser)
+{
+	int Length;
+
+	if (ServedUser->LengthOfNumber) {
+		/* Forward this number */
+		Length = encodePartyNumber_Full(Dest, ServedUser);
+	} else {
+		/* Forward all numbers */
+		Length = encodeNull(Dest, ASN1_TAG_NULL);
+	}
+
+	return Length;
+}	/* end encodeServedUserNumber_Full() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \brief Parse the ServedUserNr argument parameters.
+ *
+ * \param pc Complete component message storage data.
+ * \param p Starting buffer position to parse arguments
+ * \param end End buffer position that must not go past.
+ * \param ServedUser Parameter storage to fill.
+ *
+ * \retval length of buffer consumed
+ * \retval -1 on error.
+ */
+static int ParseServedUserNumber_Full(struct asn1_parm *pc, u_char *p, u_char *end, struct FacPartyNumber *ServedUser)
+{
+	INIT;
+
+	ServedUser->LengthOfNumber = 0;
+	XCHOICE(ParseNull, ASN1_TAG_NULL, ASN1_NOT_TAGGED);
+
+	/* Must be a PartyNumber (Which is itself a CHOICE) */
+	return ParsePartyNumber_Full(pc, beg, end, ServedUser);
+}	/* end ParseServedUserNumber_Full() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Encode the IntResult type.
+ *
+ * \param Dest Where to put the encoding
+ * \param IntResult Forwarding record information to encode.
+ *
+ * \retval length
+ */
+static int encodeIntResult(__u8 *Dest, const struct FacForwardingRecord *IntResult)
+{
+	__u8 *p;
+
+	Dest[0] = ASN1_TAG_SEQUENCE;
+	p = &Dest[2];
+
+	p += encodeServedUserNumber_Full(p, &IntResult->ServedUser);
+	p += encodeEnum(p, ASN1_TAG_ENUM, IntResult->BasicService);
+	p += encodeEnum(p, ASN1_TAG_ENUM, IntResult->Procedure);
+	p += encodeAddress_Full(p, &IntResult->ForwardedTo);
+
+	/* length */
+	Dest[1] = p - &Dest[2];
+
+	return p - Dest;
+}	/* end encodeIntResult() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Parse the IntResult argument parameters.
+ *
+ * \param pc Complete component message storage data.
+ * \param p Starting buffer position to parse arguments
+ * \param end End buffer position that must not go past.
+ * \param IntResult Forwarding record storage to fill.
+ *
+ * \retval length of buffer consumed
+ * \retval -1 on error.
+ */
+static int ParseIntResult(struct asn1_parm *pc, u_char *p, u_char *end, struct FacForwardingRecord *IntResult)
+{
+	int Value;
+	INIT;
+
+	XSEQUENCE_1(ParseServedUserNumber_Full, ASN1_NOT_TAGGED, ASN1_NOT_TAGGED, &IntResult->ServedUser);
+	XSEQUENCE_1(ParseEnum, ASN1_TAG_ENUM, ASN1_NOT_TAGGED, &Value);
+	IntResult->BasicService = Value;
+	XSEQUENCE_1(ParseEnum, ASN1_TAG_ENUM, ASN1_NOT_TAGGED, &Value);
+	IntResult->Procedure = Value;
+	XSEQUENCE_1(ParseAddress_Full, ASN1_TAG_SEQUENCE, ASN1_NOT_TAGGED, &IntResult->ForwardedTo);
+
+	return p - beg;
+}	/* end ParseIntResult() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Encode the IntResultList type.
+ *
+ * \param Dest Where to put the encoding
+ * \param IntResultList Forwarding record list information to encode.
+ *
+ * \retval length
+ */
+static int encodeIntResultList(__u8 *Dest, const struct FacForwardingList *IntResultList)
+{
+	unsigned Index;
+	__u8 *p;
+
+	Dest[0] = ASN1_TAG_SET;
+	p = &Dest[1 + ASN1_NUM_OCTETS_LONG_LENGTH_u8];
+
+	for (Index = 0; Index < IntResultList->NumRecords; ++Index) {
+		p += encodeIntResult(p, &IntResultList->List[Index]);
+	}	/* end for */
+
+	/* length */
+	encodeLen_Long_u8(&Dest[1], p - &Dest[1 + ASN1_NUM_OCTETS_LONG_LENGTH_u8]);
+
+	return p - Dest;
+}	/* end encodeIntResultList() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \brief Parse the IntResultList argument parameters.
+ *
+ * \param pc Complete component message storage data.
+ * \param p Starting buffer position to parse arguments
+ * \param end End buffer position that must not go past.
+ * \param IntResultList Forwarding record list storage to fill.
+ *
+ * \retval length of buffer consumed
+ * \retval -1 on error.
+ */
+int ParseIntResultList(struct asn1_parm *pc, u_char *p, u_char *end, struct FacForwardingList *IntResultList)
+{
+	INIT;
+
+	IntResultList->NumRecords = 0;
+	while (p < end) {

[... 2425 lines stripped ...]



More information about the thirdparty-commits mailing list