Fix line endings per .gitattributes

v1.4
Travis Cross 2014-08-08 15:24:42 +00:00
parent 1e9505d853
commit 8414c498cf
199 changed files with 28770 additions and 28770 deletions

View File

@ -1,10 +1,10 @@
Copyright (c) 2005, Fabricio Zuardi
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright (c) 2005, Fabricio Zuardi
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File diff suppressed because it is too large Load Diff

View File

@ -1,132 +1,132 @@
/*****************************************************************************
FileName: 5ESSStateNT.c
Contents: AT&T 5ESS ISDN State Engine for NT (Network Mode).
The controlling state engine for Q.931 is the state engine
on the NT side. The state engine on the TE side is a slave
of this. The TE side maintain it's own states as described in
ITU-T Q931, but will in raise conditions be overridden by
the NT side.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Copyright (c) 2007, Michael S. Collins, All rights reserved.
email:mcollins@fcnetwork.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "5ESS.h"
/*****************************************************************************
Function: ATT5ESSCreateNT
Description: Will create the AT&T 5ESS ISDN NT as a Dialect in the stack. The first
bulk set up the message handlers, the second bulk the IE
encoders/coders, and the last bulk set up the state table.
Parameters: i Dialect index
*****************************************************************************/
void ATT5ESSCreateNT(L3UCHAR i)
{
Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingNT, Q931Umes_Alerting, Q931Pmes_Alerting);
Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingNT, Q931Umes_CallProceeding, Q931Pmes_CallProceeding);
Q931SetMesProc(Q931mes_CONNECT, i, Q931ProcConnectNT, Q931Umes_Connect, Q931Pmes_Connect);
Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, Q931ProcConnectAckNT, Q931Umes_ConnectAck, Q931Pmes_ConnectAck);
Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressNT, Q931Umes_Progress, Q931Pmes_Progress);
Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupNT, Q931Umes_Setup, Q931Pmes_Setup);
Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckNT, Q931Umes_SetupAck, Q931Pmes_SetupAck);
Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeNT, Q931Umes_Resume, Q931Pmes_Resume);
Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckNT, Q931Umes_ResumeAck, Q931Pmes_ResumeAck);
Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectNT, Q931Umes_ResumeReject, Q931Pmes_ResumeReject);
Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendNT, Q931Umes_Suspend, Q931Pmes_Suspend);
Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckNT, Q931Umes_SuspendAck, Q931Pmes_SuspendAck);
Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectNT, Q931Umes_SuspendReject, Q931Pmes_SuspendReject);
Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationNT, Q931Umes_UserInformation, Q931Pmes_UserInformation);
Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectNT, Q931Umes_Disconnect, Q931Pmes_Disconnect);
Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseNT, Q931Umes_Release, Q931Pmes_Release);
Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteNT, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete);
Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartNT, Q931Umes_Restart, Q931Pmes_Restart);
Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckNT, Q931Umes_RestartAck, Q931Pmes_RestartAck);
Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlNT, Q931Umes_CongestionControl, Q931Pmes_CongestionControl);
Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationNT, Q931Umes_Information, Q931Pmes_Information);
Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyNT, Q931Umes_Notify, Q931Pmes_Notify);
Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusNT, Q931Umes_Status, Q931Pmes_Status);
Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryNT, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry);
Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentNT, Q931Umes_Segment, Q931Pmes_Segment);
Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityNT, Q932Umes_Facility, Q932Pmes_Facility);
Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldNT, Q932Umes_Hold, Q932Pmes_Hold);
Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckNT, Q932Umes_HoldAck, Q932Pmes_HoldAck);
Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectNT, Q932Umes_HoldReject, Q932Pmes_HoldReject);
Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterNT, Q932Umes_Register, Q932Pmes_Register);
Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveNT, Q932Umes_Retrieve, Q932Pmes_Retrieve);
Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckNT, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck);
Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectNT, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject);
/* Set up the IE encoder/decoder handle table.*/
Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment);
Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap);
Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause);
Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID);
Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState);
Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID);
Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd);
Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac);
Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd);
Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display);
Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime);
Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac);
Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal);
Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum);
Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub);
Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum);
Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub);
Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd);
Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp);
Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp);
Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser);
Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits);
Q931SetIEProc(Q931ie_CONNECTED_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic);
Q931SetIEProc(Q931ie_FACILITY, i, Q931Pie_Generic, Q931Uie_Generic);
/* The following define a state machine. The point is that the Message */
/* procs can when search this to find out if the message/state */
/* combination is legale. If not, the proc for unexpected message apply.*/
/* TODO define state table here */
}
/*****************************************************************************
FileName: 5ESSStateNT.c
Contents: AT&T 5ESS ISDN State Engine for NT (Network Mode).
The controlling state engine for Q.931 is the state engine
on the NT side. The state engine on the TE side is a slave
of this. The TE side maintain it's own states as described in
ITU-T Q931, but will in raise conditions be overridden by
the NT side.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Copyright (c) 2007, Michael S. Collins, All rights reserved.
email:mcollins@fcnetwork.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "5ESS.h"
/*****************************************************************************
Function: ATT5ESSCreateNT
Description: Will create the AT&T 5ESS ISDN NT as a Dialect in the stack. The first
bulk set up the message handlers, the second bulk the IE
encoders/coders, and the last bulk set up the state table.
Parameters: i Dialect index
*****************************************************************************/
void ATT5ESSCreateNT(L3UCHAR i)
{
Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingNT, Q931Umes_Alerting, Q931Pmes_Alerting);
Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingNT, Q931Umes_CallProceeding, Q931Pmes_CallProceeding);
Q931SetMesProc(Q931mes_CONNECT, i, Q931ProcConnectNT, Q931Umes_Connect, Q931Pmes_Connect);
Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, Q931ProcConnectAckNT, Q931Umes_ConnectAck, Q931Pmes_ConnectAck);
Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressNT, Q931Umes_Progress, Q931Pmes_Progress);
Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupNT, Q931Umes_Setup, Q931Pmes_Setup);
Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckNT, Q931Umes_SetupAck, Q931Pmes_SetupAck);
Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeNT, Q931Umes_Resume, Q931Pmes_Resume);
Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckNT, Q931Umes_ResumeAck, Q931Pmes_ResumeAck);
Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectNT, Q931Umes_ResumeReject, Q931Pmes_ResumeReject);
Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendNT, Q931Umes_Suspend, Q931Pmes_Suspend);
Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckNT, Q931Umes_SuspendAck, Q931Pmes_SuspendAck);
Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectNT, Q931Umes_SuspendReject, Q931Pmes_SuspendReject);
Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationNT, Q931Umes_UserInformation, Q931Pmes_UserInformation);
Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectNT, Q931Umes_Disconnect, Q931Pmes_Disconnect);
Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseNT, Q931Umes_Release, Q931Pmes_Release);
Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteNT, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete);
Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartNT, Q931Umes_Restart, Q931Pmes_Restart);
Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckNT, Q931Umes_RestartAck, Q931Pmes_RestartAck);
Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlNT, Q931Umes_CongestionControl, Q931Pmes_CongestionControl);
Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationNT, Q931Umes_Information, Q931Pmes_Information);
Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyNT, Q931Umes_Notify, Q931Pmes_Notify);
Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusNT, Q931Umes_Status, Q931Pmes_Status);
Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryNT, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry);
Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentNT, Q931Umes_Segment, Q931Pmes_Segment);
Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityNT, Q932Umes_Facility, Q932Pmes_Facility);
Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldNT, Q932Umes_Hold, Q932Pmes_Hold);
Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckNT, Q932Umes_HoldAck, Q932Pmes_HoldAck);
Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectNT, Q932Umes_HoldReject, Q932Pmes_HoldReject);
Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterNT, Q932Umes_Register, Q932Pmes_Register);
Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveNT, Q932Umes_Retrieve, Q932Pmes_Retrieve);
Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckNT, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck);
Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectNT, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject);
/* Set up the IE encoder/decoder handle table.*/
Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment);
Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap);
Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause);
Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID);
Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState);
Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID);
Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd);
Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac);
Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd);
Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display);
Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime);
Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac);
Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal);
Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum);
Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub);
Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum);
Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub);
Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd);
Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp);
Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp);
Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser);
Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits);
Q931SetIEProc(Q931ie_CONNECTED_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic);
Q931SetIEProc(Q931ie_FACILITY, i, Q931Pie_Generic, Q931Uie_Generic);
/* The following define a state machine. The point is that the Message */
/* procs can when search this to find out if the message/state */
/* combination is legale. If not, the proc for unexpected message apply.*/
/* TODO define state table here */
}

View File

@ -1,291 +1,291 @@
/*****************************************************************************
FileName: 5ESSStateTE.c
Contents: AT&T 5ESS ISDN State Engine for TE (User Mode).
The controlling state engine for Q.931 is the state engine
on the NT side. The state engine on the TE side is a slave
of this. The TE side maintain it's own states as described in
ITU-T Q931, but will in raise conditions be overridden by
the NT side.
This reference implementation uses a process per message,
meaning that each message must check call states. This
is easier for dialect maintenance as each message proc
can be replaced individually. A new TE variant only
need to copy the Q931CreateTE and replace those procs or
need to override.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Copyright (c) 2007, Michael S. Collins, All rights reserved.
email:mcollins@fcnetwork.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "5ESS.h"
extern L3INT Q931L4HeaderSpace;
/*****************************************************************************
Function: ATT5ESSCreateTE
Description: Will create the AT&T 5ESS TE as a Dialect in the stack. The first
bulk set up the message handlers, the second bulk the IE
encoders/coders, and the last bulk set up the state table.
Parameters: i Dialect index
*****************************************************************************/
void ATT5ESSCreateTE(L3UCHAR i)
{
Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingTE, Q931Umes_Alerting, Q931Pmes_Alerting);
Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingTE, Q931Umes_CallProceeding, Q931Pmes_CallProceeding);
Q931SetMesProc(Q931mes_CONNECT, i, ATT5ESSProc0x07TE, ATT5ESSUmes_0x07, ATT5ESSPmes_0x07);
Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, ATT5ESSProc0x0fTE, ATT5ESSUmes_0x0f, ATT5ESSPmes_0x0f);
Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressTE, Q931Umes_Progress, Q931Pmes_Progress);
Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupTE, ATT5ESSUmes_Setup, ATT5ESSPmes_Setup);
Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckTE, Q931Umes_SetupAck, Q931Pmes_SetupAck);
Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeTE, Q931Umes_Resume, Q931Pmes_Resume);
Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckTE, Q931Umes_ResumeAck, Q931Pmes_ResumeAck);
Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectTE, Q931Umes_ResumeReject, Q931Pmes_ResumeReject);
Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendTE, Q931Umes_Suspend, Q931Pmes_Suspend);
Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckTE, Q931Umes_SuspendAck, Q931Pmes_SuspendAck);
Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectTE, Q931Umes_SuspendReject, Q931Pmes_SuspendReject);
Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationTE, Q931Umes_UserInformation, Q931Pmes_UserInformation);
Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectTE, Q931Umes_Disconnect, Q931Pmes_Disconnect);
Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseTE, Q931Umes_Release, Q931Pmes_Release);
Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteTE, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete);
Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartTE, Q931Umes_Restart, Q931Pmes_Restart);
Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckTE, Q931Umes_RestartAck, Q931Pmes_RestartAck);
Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlTE, Q931Umes_CongestionControl, Q931Pmes_CongestionControl);
Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationTE, Q931Umes_Information, Q931Pmes_Information);
Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyTE, Q931Umes_Notify, Q931Pmes_Notify);
Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusTE, Q931Umes_Status, Q931Pmes_Status);
Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryTE, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry);
Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentTE, Q931Umes_Segment, Q931Pmes_Segment);
Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityTE, Q932Umes_Facility, Q932Pmes_Facility);
Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldTE, Q932Umes_Hold, Q932Pmes_Hold);
Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckTE, Q932Umes_HoldAck, Q932Pmes_HoldAck);
Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectTE, Q932Umes_HoldReject, Q932Pmes_HoldReject);
Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterTE, Q932Umes_Register, Q932Pmes_Register);
Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveTE, Q932Umes_Retrieve, Q932Pmes_Retrieve);
Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckTE, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck);
Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectTE, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject);
/* Set up the IE encoder/decoder handle table.*/
Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment);
Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap);
Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause);
Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID);
Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState);
Q931SetIEProc(Q931ie_CHANGE_STATUS, i, Q931Pie_ChangeStatus, Q931Uie_ChangeStatus);
Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID);
Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd);
Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac);
Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd);
Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display);
Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime);
Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac);
Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal);
Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum);
Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub);
Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum);
Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub);
Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd);
Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp);
Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp);
Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser);
Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits);
Q931SetIEProc(Q931ie_CONNECTED_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic);
Q931SetIEProc(Q931ie_FACILITY, i, Q931Pie_Generic, Q931Uie_Generic);
/* The following define a state machine. The point is that the Message */
/* procs can when search this to find out if the message/state */
/* combination is legale. If not, the proc for unexpected message apply.*/
/* State 0 Idle */
Q931AddStateEntry(i, Q931_U0, Q931mes_RESUME, 2);
Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 4);
Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 2);
Q931AddStateEntry(i, Q931_U0, Q931mes_STATUS, 4);
Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE_COMPLETE, 4);
/* State 1 Call Initiating */
Q931AddStateEntry(i, Q931_U1, Q931mes_DISCONNECT, 2);
Q931AddStateEntry(i, Q931_U1, Q931mes_SETUP_ACKNOWLEDGE, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_RELEASE_COMPLETE, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_CALL_PROCEEDING, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_ALERTING, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_CONNECT, 4);
/* State 2 Overlap Sending */
Q931AddStateEntry(i, Q931_U2, Q931mes_INFORMATION, 2);
Q931AddStateEntry(i, Q931_U2, Q931mes_CALL_PROCEEDING, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_ALERTING, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_PROGRESS, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_CONNECT, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_RELEASE, 2);
/* State 3 Outgoing Call Proceeding */
Q931AddStateEntry(i, Q931_U3, Q931mes_PROGRESS, 4);
Q931AddStateEntry(i, Q931_U3, Q931mes_ALERTING, 4);
Q931AddStateEntry(i, Q931_U3, Q931mes_CONNECT, 4);
Q931AddStateEntry(i, Q931_U3, Q931mes_RELEASE, 2);
/* State 4 Call Delivered */
Q931AddStateEntry(i, Q931_U4, Q931mes_CONNECT, 4);
/* State 6 Call Precent */
Q931AddStateEntry(i, Q931_U6, Q931mes_INFORMATION, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_ALERTING, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_CALL_PROCEEDING, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_CONNECT, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE_COMPLETE, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U6, Q931mes_DISCONNECT, 4);
/* State 7 Call Received */
Q931AddStateEntry(i, Q931_U7, Q931mes_CONNECT, 2);
/* State 8 Connect request */
Q931AddStateEntry(i, Q931_U8, Q931mes_CONNECT_ACKNOWLEDGE, 4);
/* State 9 Incoming Call Proceeding */
Q931AddStateEntry(i, Q931_U9, Q931mes_CONNECT, 2);
Q931AddStateEntry(i, Q931_U9, Q931mes_ALERTING, 2);
Q931AddStateEntry(i, Q931_U9, Q931mes_PROGRESS, 2);
/* State 10 Active */
Q931AddStateEntry(i, Q931_U10, Q931mes_SUSPEND, 2);
Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 4);
Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 2);
/* State 11 Disconnect Request */
Q931AddStateEntry(i, Q931_U11, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U11, Q931mes_DISCONNECT, 4);
Q931AddStateEntry(i, Q931_U11, Q931mes_NOTIFY, 4);
/* State 12 Disconnect Ind */
Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 2);
/* State 15 Suspend Request */
Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_ACKNOWLEDGE, 4);
Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_REJECT, 4);
Q931AddStateEntry(i, Q931_U15, Q931mes_DISCONNECT, 4);
Q931AddStateEntry(i, Q931_U15, Q931mes_RELEASE, 4);
/* TODO
Q931AddStateEntry(i, Q931_U17,
Q931AddStateEntry(i, Q931_U19,
Q931AddStateEntry(i, Q931_U25,
*/
}
/*****************************************************************************
Function: ATT5ESSProc0x0fTE
*****************************************************************************/
L3INT ATT5ESSProc0x0fTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
{
Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
L3INT callIndex;
L3INT ret = Q931E_NO_ERROR;
if (pMes->ProtDisc == 8) {
/* Find the call using CRV */
ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
if (ret != Q931E_NO_ERROR)
return ret;
/* TODO chack against state table for illegal or unexpected message here*/
/* TODO - Set correct timer here */
Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
}
if (iFrom == 4) {
/* TODO Add proc here*/
ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
}
else if (iFrom ==2) {
/* TODO Add proc here*/
ret = Q931Tx34(pTrunk, buf, pMes->Size);
if (pMes->ProtDisc == 3 && pTrunk->autoServiceAck) {
printf("autoServiceAck is on, responding to Service Req from network...\n");
Q931AckService(pTrunk, buf);
}
}
return ret;
}
/*****************************************************************************
Function: ATT5ESSProc0x07TE
*****************************************************************************/
L3INT ATT5ESSProc0x07TE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
{
Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
L3INT callIndex;
L3INT ret = Q931E_NO_ERROR;
if (pMes->ProtDisc == 8) {
/* Find the call using CRV */
ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
if (ret != Q931E_NO_ERROR)
return ret;
/* TODO chack against state table for illegal or unexpected message here*/
/* TODO - Set correct timer here */
Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
}
if (iFrom == 4) {
/* TODO Add proc here*/
ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
}
else if (iFrom == 2) {
/* TODO Add proc here*/
ret = Q931Tx34(pTrunk, buf, pMes->Size);
}
return ret;
}
/*****************************************************************************
FileName: 5ESSStateTE.c
Contents: AT&T 5ESS ISDN State Engine for TE (User Mode).
The controlling state engine for Q.931 is the state engine
on the NT side. The state engine on the TE side is a slave
of this. The TE side maintain it's own states as described in
ITU-T Q931, but will in raise conditions be overridden by
the NT side.
This reference implementation uses a process per message,
meaning that each message must check call states. This
is easier for dialect maintenance as each message proc
can be replaced individually. A new TE variant only
need to copy the Q931CreateTE and replace those procs or
need to override.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Copyright (c) 2007, Michael S. Collins, All rights reserved.
email:mcollins@fcnetwork.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "5ESS.h"
extern L3INT Q931L4HeaderSpace;
/*****************************************************************************
Function: ATT5ESSCreateTE
Description: Will create the AT&T 5ESS TE as a Dialect in the stack. The first
bulk set up the message handlers, the second bulk the IE
encoders/coders, and the last bulk set up the state table.
Parameters: i Dialect index
*****************************************************************************/
void ATT5ESSCreateTE(L3UCHAR i)
{
Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingTE, Q931Umes_Alerting, Q931Pmes_Alerting);
Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingTE, Q931Umes_CallProceeding, Q931Pmes_CallProceeding);
Q931SetMesProc(Q931mes_CONNECT, i, ATT5ESSProc0x07TE, ATT5ESSUmes_0x07, ATT5ESSPmes_0x07);
Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, ATT5ESSProc0x0fTE, ATT5ESSUmes_0x0f, ATT5ESSPmes_0x0f);
Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressTE, Q931Umes_Progress, Q931Pmes_Progress);
Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupTE, ATT5ESSUmes_Setup, ATT5ESSPmes_Setup);
Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckTE, Q931Umes_SetupAck, Q931Pmes_SetupAck);
Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeTE, Q931Umes_Resume, Q931Pmes_Resume);
Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckTE, Q931Umes_ResumeAck, Q931Pmes_ResumeAck);
Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectTE, Q931Umes_ResumeReject, Q931Pmes_ResumeReject);
Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendTE, Q931Umes_Suspend, Q931Pmes_Suspend);
Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckTE, Q931Umes_SuspendAck, Q931Pmes_SuspendAck);
Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectTE, Q931Umes_SuspendReject, Q931Pmes_SuspendReject);
Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationTE, Q931Umes_UserInformation, Q931Pmes_UserInformation);
Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectTE, Q931Umes_Disconnect, Q931Pmes_Disconnect);
Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseTE, Q931Umes_Release, Q931Pmes_Release);
Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteTE, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete);
Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartTE, Q931Umes_Restart, Q931Pmes_Restart);
Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckTE, Q931Umes_RestartAck, Q931Pmes_RestartAck);
Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlTE, Q931Umes_CongestionControl, Q931Pmes_CongestionControl);
Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationTE, Q931Umes_Information, Q931Pmes_Information);
Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyTE, Q931Umes_Notify, Q931Pmes_Notify);
Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusTE, Q931Umes_Status, Q931Pmes_Status);
Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryTE, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry);
Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentTE, Q931Umes_Segment, Q931Pmes_Segment);
Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityTE, Q932Umes_Facility, Q932Pmes_Facility);
Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldTE, Q932Umes_Hold, Q932Pmes_Hold);
Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckTE, Q932Umes_HoldAck, Q932Pmes_HoldAck);
Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectTE, Q932Umes_HoldReject, Q932Pmes_HoldReject);
Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterTE, Q932Umes_Register, Q932Pmes_Register);
Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveTE, Q932Umes_Retrieve, Q932Pmes_Retrieve);
Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckTE, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck);
Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectTE, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject);
/* Set up the IE encoder/decoder handle table.*/
Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment);
Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap);
Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause);
Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID);
Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState);
Q931SetIEProc(Q931ie_CHANGE_STATUS, i, Q931Pie_ChangeStatus, Q931Uie_ChangeStatus);
Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID);
Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd);
Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac);
Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd);
Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display);
Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime);
Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac);
Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal);
Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum);
Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub);
Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum);
Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub);
Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd);
Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp);
Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp);
Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser);
Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits);
Q931SetIEProc(Q931ie_CONNECTED_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic);
Q931SetIEProc(Q931ie_FACILITY, i, Q931Pie_Generic, Q931Uie_Generic);
/* The following define a state machine. The point is that the Message */
/* procs can when search this to find out if the message/state */
/* combination is legale. If not, the proc for unexpected message apply.*/
/* State 0 Idle */
Q931AddStateEntry(i, Q931_U0, Q931mes_RESUME, 2);
Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 4);
Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 2);
Q931AddStateEntry(i, Q931_U0, Q931mes_STATUS, 4);
Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE_COMPLETE, 4);
/* State 1 Call Initiating */
Q931AddStateEntry(i, Q931_U1, Q931mes_DISCONNECT, 2);
Q931AddStateEntry(i, Q931_U1, Q931mes_SETUP_ACKNOWLEDGE, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_RELEASE_COMPLETE, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_CALL_PROCEEDING, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_ALERTING, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_CONNECT, 4);
/* State 2 Overlap Sending */
Q931AddStateEntry(i, Q931_U2, Q931mes_INFORMATION, 2);
Q931AddStateEntry(i, Q931_U2, Q931mes_CALL_PROCEEDING, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_ALERTING, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_PROGRESS, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_CONNECT, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_RELEASE, 2);
/* State 3 Outgoing Call Proceeding */
Q931AddStateEntry(i, Q931_U3, Q931mes_PROGRESS, 4);
Q931AddStateEntry(i, Q931_U3, Q931mes_ALERTING, 4);
Q931AddStateEntry(i, Q931_U3, Q931mes_CONNECT, 4);
Q931AddStateEntry(i, Q931_U3, Q931mes_RELEASE, 2);
/* State 4 Call Delivered */
Q931AddStateEntry(i, Q931_U4, Q931mes_CONNECT, 4);
/* State 6 Call Precent */
Q931AddStateEntry(i, Q931_U6, Q931mes_INFORMATION, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_ALERTING, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_CALL_PROCEEDING, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_CONNECT, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE_COMPLETE, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U6, Q931mes_DISCONNECT, 4);
/* State 7 Call Received */
Q931AddStateEntry(i, Q931_U7, Q931mes_CONNECT, 2);
/* State 8 Connect request */
Q931AddStateEntry(i, Q931_U8, Q931mes_CONNECT_ACKNOWLEDGE, 4);
/* State 9 Incoming Call Proceeding */
Q931AddStateEntry(i, Q931_U9, Q931mes_CONNECT, 2);
Q931AddStateEntry(i, Q931_U9, Q931mes_ALERTING, 2);
Q931AddStateEntry(i, Q931_U9, Q931mes_PROGRESS, 2);
/* State 10 Active */
Q931AddStateEntry(i, Q931_U10, Q931mes_SUSPEND, 2);
Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 4);
Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 2);
/* State 11 Disconnect Request */
Q931AddStateEntry(i, Q931_U11, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U11, Q931mes_DISCONNECT, 4);
Q931AddStateEntry(i, Q931_U11, Q931mes_NOTIFY, 4);
/* State 12 Disconnect Ind */
Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 2);
/* State 15 Suspend Request */
Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_ACKNOWLEDGE, 4);
Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_REJECT, 4);
Q931AddStateEntry(i, Q931_U15, Q931mes_DISCONNECT, 4);
Q931AddStateEntry(i, Q931_U15, Q931mes_RELEASE, 4);
/* TODO
Q931AddStateEntry(i, Q931_U17,
Q931AddStateEntry(i, Q931_U19,
Q931AddStateEntry(i, Q931_U25,
*/
}
/*****************************************************************************
Function: ATT5ESSProc0x0fTE
*****************************************************************************/
L3INT ATT5ESSProc0x0fTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
{
Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
L3INT callIndex;
L3INT ret = Q931E_NO_ERROR;
if (pMes->ProtDisc == 8) {
/* Find the call using CRV */
ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
if (ret != Q931E_NO_ERROR)
return ret;
/* TODO chack against state table for illegal or unexpected message here*/
/* TODO - Set correct timer here */
Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
}
if (iFrom == 4) {
/* TODO Add proc here*/
ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
}
else if (iFrom ==2) {
/* TODO Add proc here*/
ret = Q931Tx34(pTrunk, buf, pMes->Size);
if (pMes->ProtDisc == 3 && pTrunk->autoServiceAck) {
printf("autoServiceAck is on, responding to Service Req from network...\n");
Q931AckService(pTrunk, buf);
}
}
return ret;
}
/*****************************************************************************
Function: ATT5ESSProc0x07TE
*****************************************************************************/
L3INT ATT5ESSProc0x07TE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
{
Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
L3INT callIndex;
L3INT ret = Q931E_NO_ERROR;
if (pMes->ProtDisc == 8) {
/* Find the call using CRV */
ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
if (ret != Q931E_NO_ERROR)
return ret;
/* TODO chack against state table for illegal or unexpected message here*/
/* TODO - Set correct timer here */
Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
}
if (iFrom == 4) {
/* TODO Add proc here*/
ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
}
else if (iFrom == 2) {
/* TODO Add proc here*/
ret = Q931Tx34(pTrunk, buf, pMes->Size);
}
return ret;
}

View File

@ -1,361 +1,361 @@
/*****************************************************************************
FileName: 5ESSmes.c
Contents: Pack/Unpack functions. These functions will unpack a 5ESS ISDN
message from the bit packed original format into structs
that contains variables sized by the user. It will also pack
the struct back into a Q.931 message as required.
See 5ESS.h for description.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Copyright (c) 2007, Michael S. Collins, All rights reserved.
email:mcollins@fcnetwork.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "5ESS.h"
/*****************************************************************************
Function: ATT5ESSUmes_Setup
*****************************************************************************/
L3INT ATT5ESSUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
L3INT ir = 0;
L3INT OOff = 0;
L3INT rc = Q931E_NO_ERROR;
L3UCHAR last_codeset = 0, codeset = 0;
L3UCHAR shift_nolock = 1;
while (IOff < Size) {
if (shift_nolock) {
codeset = last_codeset;
}
if ((IBuf[IOff] & 0xF0) == Q931ie_SHIFT) {
shift_nolock = (IBuf[IOff] & 0x08);
if (shift_nolock) {
last_codeset = codeset;
}
codeset = ((IBuf[IOff] & 0x07));
IOff++;
}
if (codeset == 0) {
switch (IBuf[IOff])
{
case Q931ie_SENDING_COMPLETE:
case Q931ie_BEARER_CAPABILITY:
case Q931ie_CHANNEL_IDENTIFICATION:
case Q931ie_PROGRESS_INDICATOR:
case Q931ie_NETWORK_SPECIFIC_FACILITIES:
case Q931ie_DISPLAY:
case Q931ie_DATETIME:
case Q931ie_KEYPAD_FACILITY:
case Q931ie_SIGNAL:
case Q931ie_CALLING_PARTY_NUMBER:
case Q931ie_CALLING_PARTY_SUBADDRESS:
case Q931ie_CALLED_PARTY_NUMBER:
case Q931ie_CALLED_PARTY_SUBADDRESS:
case Q931ie_TRANSIT_NETWORK_SELECTION:
case Q931ie_LOW_LAYER_COMPATIBILITY:
case Q931ie_HIGH_LAYER_COMPATIBILITY:
case Q931ie_FACILITY:
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff);
if (rc != Q931E_NO_ERROR)
return rc;
break;
case Q931ie_REPEAT_INDICATOR:
if (ir < 2) {
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff);
ir++;
} else {
return Q931E_ILLEGAL_IE;
}
break;
default:
return Q931E_ILLEGAL_IE;
break;
}
} else if (codeset == 6) {
switch (IBuf[IOff])
{
case Q931ie_GENERIC_DIGITS:
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff);
if (rc != Q931E_NO_ERROR)
return rc;
break;
default:
return Q931E_ILLEGAL_IE;
break;
}
} else if (codeset == 7) {
switch (IBuf[IOff])
{
case Q931ie_DISPLAY:
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff);
if (rc != Q931E_NO_ERROR)
return rc;
break;
default:
return Q931E_ILLEGAL_IE;
break;
}
} else {
return Q931E_ILLEGAL_IE;
}
}
mes->Size = sizeof(Q931mes_Generic) - 1 + OOff;
return Q931E_NO_ERROR;
}
/*****************************************************************************
Function: ATT5ESSPmes_Setup
Decription: Pack a Q931mes_Generic into a real Q.931 message. The user will
set up a SETUP message and issue this to the stack where it
is processed by Q931ProcSetup that processes and validates
it before it actually sends it out. This function is called
to compute the real Q.931 message.
Parameters: IBuf[IN] Ptr to un-packed struct
ISize[IN] Size of input buffer (unpacked message).
OBuf[OUT] Ptr to packed 'octet' wise message.
OSize[OUT] Size of packed message.
Called By: Q931ProcSetup
*****************************************************************************/
L3INT ATT5ESSPmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3INT rc = Q931E_NO_ERROR;
Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf;
L3INT Octet = 0;
/* Q931 Message Header */
Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet);
/* Sending Complete */
if (Q931IsIEPresent(pMes->SendComplete)) {
OBuf[Octet++] = (L3UCHAR)(pMes->SendComplete & 0x00ff);
}
/* Repeat Indicator */
if (Q931IsIEPresent(pMes->RepeatInd)) {
OBuf[Octet++] = (L3UCHAR)(pMes->RepeatInd & 0x00ff);
}
/* Bearer capability */
if (Q931IsIEPresent(pMes->BearerCap)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_BEARER_CAPABILITY](pTrunk, Q931GetIEPtr(pMes->BearerCap,pMes->buf), OBuf, &Octet))!=0)
return rc;
} else {
rc = Q931E_BEARERCAP;
}
/* Channel Identification */
if (Q931IsIEPresent(pMes->ChanID)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Progress indicator */
if (Q931IsIEPresent(pMes->ProgInd)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_PROGRESS_INDICATOR](pTrunk, Q931GetIEPtr(pMes->ProgInd,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Network specific facilities */
if (Q931IsIEPresent(pMes->NetFac)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_NETWORK_SPECIFIC_FACILITIES](pTrunk, Q931GetIEPtr(pMes->NetFac,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Display */
if (Q931IsIEPresent(pMes->Display)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Date/Time */
if (Q931IsIEPresent(pMes->DateTime)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DATETIME](pTrunk, Q931GetIEPtr(pMes->DateTime,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Keypad Facility */
if (Q931IsIEPresent(pMes->KeypadFac)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_KEYPAD_FACILITY](pTrunk, Q931GetIEPtr(pMes->KeypadFac,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Signal */
if (Q931IsIEPresent(pMes->Signal)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Calling Party Number */
if (Q931IsIEPresent(pMes->CallingNum)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CallingNum,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Calling Party Subaddress */
if (Q931IsIEPresent(pMes->CallingSub)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CallingSub,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Called Party number */
if (Q931IsIEPresent(pMes->CalledNum)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CalledNum,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Called party subaddress */
if (Q931IsIEPresent(pMes->CalledSub)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CalledSub,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Transit network selection */
if (Q931IsIEPresent(pMes->TransNetSel)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_TRANSIT_NETWORK_SELECTION](pTrunk, Q931GetIEPtr(pMes->TransNetSel,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Repeat Indicator */
if (Q931IsIEPresent(pMes->LLRepeatInd)) {
rc = Q931E_UNKNOWN_IE;/* TODO */
}
/* Low Layer Compatibility */
if (Q931IsIEPresent(pMes->LLComp)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_LOW_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->LLComp,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* High Layer Compatibility */
if (Q931IsIEPresent(pMes->HLComp)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_HIGH_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->HLComp,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
*OSize = Octet;
return rc;
}
/*****************************************************************************
Function: ATT5ESSUmes_0x0f
*****************************************************************************/
L3INT ATT5ESSUmes_0x0f(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
if (mes->ProtDisc == 8) {
return Q931Umes_ConnectAck(pTrunk, IBuf, mes, IOff, Size);
}
if (mes->ProtDisc == 3) {
return Q931Umes_Service(pTrunk, IBuf, mes, IOff, Size);
}
return Q931E_UNKNOWN_MESSAGE;
}
/*****************************************************************************
Function: ATT5ESSPmes_0x0f
*****************************************************************************/
L3INT ATT5ESSPmes_0x0f(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
Q931mes_Generic *mes = (Q931mes_Generic *)IBuf;
if (mes->ProtDisc == 8) {
return Q931Pmes_ConnectAck(pTrunk, IBuf, ISize, OBuf, OSize);
}
if (mes->ProtDisc == 3) {
return Q931Pmes_Service(pTrunk, IBuf, ISize, OBuf, OSize);
}
return Q931E_UNKNOWN_MESSAGE;
}
/*****************************************************************************
Function: ATT5ESSUmes_0x07
*****************************************************************************/
L3INT ATT5ESSUmes_0x07(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
if (mes->ProtDisc == 8) {
return Q931Umes_Connect(pTrunk, IBuf, mes, IOff, Size);
}
if (mes->ProtDisc == 3) {
return Q931Umes_ServiceAck(pTrunk, IBuf, mes, IOff, Size);
}
return Q931E_UNKNOWN_MESSAGE;
}
/*****************************************************************************
Function: ATT5ESSPmes_0x07
*****************************************************************************/
L3INT ATT5ESSPmes_0x07(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
Q931mes_Generic *mes = (Q931mes_Generic *)IBuf;
if (mes->ProtDisc == 8) {
return Q931Pmes_Connect(pTrunk, IBuf, ISize, OBuf, OSize);
}
if (mes->ProtDisc == 3) {
return Q931Pmes_ServiceAck(pTrunk, IBuf, ISize, OBuf, OSize);
}
return Q931E_UNKNOWN_MESSAGE;
}
/*****************************************************************************
FileName: 5ESSmes.c
Contents: Pack/Unpack functions. These functions will unpack a 5ESS ISDN
message from the bit packed original format into structs
that contains variables sized by the user. It will also pack
the struct back into a Q.931 message as required.
See 5ESS.h for description.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Copyright (c) 2007, Michael S. Collins, All rights reserved.
email:mcollins@fcnetwork.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "5ESS.h"
/*****************************************************************************
Function: ATT5ESSUmes_Setup
*****************************************************************************/
L3INT ATT5ESSUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
L3INT ir = 0;
L3INT OOff = 0;
L3INT rc = Q931E_NO_ERROR;
L3UCHAR last_codeset = 0, codeset = 0;
L3UCHAR shift_nolock = 1;
while (IOff < Size) {
if (shift_nolock) {
codeset = last_codeset;
}
if ((IBuf[IOff] & 0xF0) == Q931ie_SHIFT) {
shift_nolock = (IBuf[IOff] & 0x08);
if (shift_nolock) {
last_codeset = codeset;
}