change linefeeds
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@85 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
4fb5220f5b
commit
65bf12a048
|
@ -1,46 +1,46 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
FileName: EuroISDNStateNT.c
|
FileName: EuroISDNStateNT.c
|
||||||
|
|
||||||
Contents: EuroISDN State Engine for NT (Network Mode).
|
Contents: EuroISDN State Engine for NT (Network Mode).
|
||||||
|
|
||||||
The controlling state engine for Q.931 is the state engine
|
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
|
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
|
of this. The TE side maintain it's own states as described in
|
||||||
ITU-T Q931, but will in raise conditions be overridden by
|
ITU-T Q931, but will in raise conditions be overridden by
|
||||||
the NT side.
|
the NT side.
|
||||||
|
|
||||||
License/Copyright:
|
License/Copyright:
|
||||||
|
|
||||||
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
||||||
email:janvb@caselaboratories.com
|
email:janvb@caselaboratories.com
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
modification, are permitted provided that the following conditions are
|
||||||
met:
|
met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
this list of conditions and the following disclaimer.
|
this list of conditions and the following disclaimer.
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
* Neither the name of the Case Labs, Ltd nor the names of its contributors
|
* 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
|
may be used to endorse or promote products derived from this software
|
||||||
without specific prior written permission.
|
without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
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
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "Q931.h"
|
#include "Q931.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,57 +1,57 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
FileName: EuroISDNStateTE.c
|
FileName: EuroISDNStateTE.c
|
||||||
|
|
||||||
Contents: EuroISDN State Engine for TE (User Mode).
|
Contents: EuroISDN State Engine for TE (User Mode).
|
||||||
|
|
||||||
The controlling state engine for Q.931 is the state engine
|
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
|
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
|
of this. The TE side maintain it's own states as described in
|
||||||
ITU-T Q931, but will in raise conditions be overridden by
|
ITU-T Q931, but will in raise conditions be overridden by
|
||||||
the NT side.
|
the NT side.
|
||||||
|
|
||||||
License/Copyright:
|
License/Copyright:
|
||||||
|
|
||||||
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
||||||
email:janvb@caselaboratories.com
|
email:janvb@caselaboratories.com
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
modification, are permitted provided that the following conditions are
|
||||||
met:
|
met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
this list of conditions and the following disclaimer.
|
this list of conditions and the following disclaimer.
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
* Neither the name of the Case Labs, Ltd nor the names of its contributors
|
* 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
|
may be used to endorse or promote products derived from this software
|
||||||
without specific prior written permission.
|
without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
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
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "Q931.h"
|
#include "Q931.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
EuroISDN is a sub-set of Q.931. Q.931 is very generic as it embrase a lot,
|
EuroISDN is a sub-set of Q.931. Q.931 is very generic as it embrase a lot,
|
||||||
while EuroISDN is more exact and make decitions on some of the
|
while EuroISDN is more exact and make decitions on some of the
|
||||||
'implementation options' in the original standard. EuroISDN will
|
'implementation options' in the original standard. EuroISDN will
|
||||||
however run smoothly under the generic space, so these functions are more
|
however run smoothly under the generic space, so these functions are more
|
||||||
for show
|
for show
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void EuroISDNCreateTE(L3UCHAR i)
|
void EuroISDNCreateTE(L3UCHAR i)
|
||||||
{
|
{
|
||||||
Q931CreateTE(i);
|
Q931CreateTE(i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,424 +1,424 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
FileName: q921.c
|
FileName: q921.c
|
||||||
|
|
||||||
Description: Contains the implementation of a Q.921 protocol on top of the
|
Description: Contains the implementation of a Q.921 protocol on top of the
|
||||||
Comet Driver.
|
Comet Driver.
|
||||||
|
|
||||||
Most of the work required to execute a Q.921 protocol is
|
Most of the work required to execute a Q.921 protocol is
|
||||||
taken care of by the Comet ship and it's driver. This layer
|
taken care of by the Comet ship and it's driver. This layer
|
||||||
will simply configure and make use of these features to
|
will simply configure and make use of these features to
|
||||||
complete a Q.921 implementation.
|
complete a Q.921 implementation.
|
||||||
|
|
||||||
Created: 27.dec.2000/JVB
|
Created: 27.dec.2000/JVB
|
||||||
|
|
||||||
License/Copyright:
|
License/Copyright:
|
||||||
|
|
||||||
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
||||||
email:janvb@caselaboratories.com
|
email:janvb@caselaboratories.com
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
modification, are permitted provided that the following conditions are
|
||||||
met:
|
met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
this list of conditions and the following disclaimer.
|
this list of conditions and the following disclaimer.
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
* Neither the name of the Case Labs, Ltd nor the names of its contributors
|
* 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
|
may be used to endorse or promote products derived from this software
|
||||||
without specific prior written permission.
|
without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
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
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#include "Q921.h"
|
#include "Q921.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "mfifo.h"
|
#include "mfifo.h"
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Global Tables & Variables.
|
Global Tables & Variables.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
Q921Data Q921DevSpace[Q921MAXTRUNK];
|
Q921Data Q921DevSpace[Q921MAXTRUNK];
|
||||||
int Q921HeaderSpace={0};
|
int Q921HeaderSpace={0};
|
||||||
|
|
||||||
int (*Q921Tx21Proc)(int dev, L2UCHAR *, int)={NULL};
|
int (*Q921Tx21Proc)(int dev, L2UCHAR *, int)={NULL};
|
||||||
int (*Q921Tx23Proc)(int dev, L2UCHAR *, int)={NULL};
|
int (*Q921Tx23Proc)(int dev, L2UCHAR *, int)={NULL};
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q921Init
|
Function: Q921Init
|
||||||
|
|
||||||
Decription: Initialize the Q.921 stack so it is ready for use. This
|
Decription: Initialize the Q.921 stack so it is ready for use. This
|
||||||
function MUST be called as part of initializing the
|
function MUST be called as part of initializing the
|
||||||
application.
|
application.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void Q921Init()
|
void Q921Init()
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
for(x=0; x<Q921MAXTRUNK;x++)
|
for(x=0; x<Q921MAXTRUNK;x++)
|
||||||
{
|
{
|
||||||
MFIFOCreate(Q921DevSpace[x].HDLCInQueue, Q921MAXHDLCSPACE, 10);
|
MFIFOCreate(Q921DevSpace[x].HDLCInQueue, Q921MAXHDLCSPACE, 10);
|
||||||
Q921DevSpace[x].vr=0;
|
Q921DevSpace[x].vr=0;
|
||||||
Q921DevSpace[x].vs=0;
|
Q921DevSpace[x].vs=0;
|
||||||
Q921DevSpace[x].state=0;;
|
Q921DevSpace[x].state=0;;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Q921SetHeaderSpace(int hspace)
|
void Q921SetHeaderSpace(int hspace)
|
||||||
{
|
{
|
||||||
Q921HeaderSpace=hspace;
|
Q921HeaderSpace=hspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Q921SetTx21CB(int (*callback)(int dev, L2UCHAR *, int))
|
void Q921SetTx21CB(int (*callback)(int dev, L2UCHAR *, int))
|
||||||
{
|
{
|
||||||
Q921Tx21Proc = callback;
|
Q921Tx21Proc = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Q921SetTx23CB(int (*callback)(int dev, L2UCHAR *, int))
|
void Q921SetTx23CB(int (*callback)(int dev, L2UCHAR *, int))
|
||||||
{
|
{
|
||||||
Q921Tx23Proc = callback;
|
Q921Tx23Proc = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q921QueueHDLCFrame
|
Function: Q921QueueHDLCFrame
|
||||||
|
|
||||||
Description: Called to receive and queue an incoming HDLC frame. Will
|
Description: Called to receive and queue an incoming HDLC frame. Will
|
||||||
queue this in Q921HDLCInQueue. The called must either call
|
queue this in Q921HDLCInQueue. The called must either call
|
||||||
Q921Rx12 directly afterwards or signal Q921Rx12 to be called
|
Q921Rx12 directly afterwards or signal Q921Rx12 to be called
|
||||||
later. Q921Rx12 will read from the same queue and process
|
later. Q921Rx12 will read from the same queue and process
|
||||||
the frame.
|
the frame.
|
||||||
|
|
||||||
This function assumes that the message contains header
|
This function assumes that the message contains header
|
||||||
space. This is removed for internal Q921 processing, but
|
space. This is removed for internal Q921 processing, but
|
||||||
must be keept for I frames.
|
must be keept for I frames.
|
||||||
|
|
||||||
Parameters: trunk trunk #
|
Parameters: trunk trunk #
|
||||||
b ptr to frame;
|
b ptr to frame;
|
||||||
size size of frame in bytes
|
size size of frame in bytes
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int Q921QueueHDLCFrame(int trunk, L2UCHAR *b, int size)
|
int Q921QueueHDLCFrame(int trunk, L2UCHAR *b, int size)
|
||||||
{
|
{
|
||||||
return MFIFOWriteMes(Q921DevSpace[trunk].HDLCInQueue, b, size);
|
return MFIFOWriteMes(Q921DevSpace[trunk].HDLCInQueue, b, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q921SendI
|
Function: Q921SendI
|
||||||
|
|
||||||
Description: Compose and Send I Frame to layer. Will receive an I frame
|
Description: Compose and Send I Frame to layer. Will receive an I frame
|
||||||
with space for L2 header and fill out that header before
|
with space for L2 header and fill out that header before
|
||||||
it call Q921Tx21Proc.
|
it call Q921Tx21Proc.
|
||||||
|
|
||||||
Parameters: trunk trunk #
|
Parameters: trunk trunk #
|
||||||
Sapi Sapi
|
Sapi Sapi
|
||||||
cr C/R field.
|
cr C/R field.
|
||||||
Tei Tei.
|
Tei Tei.
|
||||||
pf P fiels octet 5
|
pf P fiels octet 5
|
||||||
mes ptr to I frame message.
|
mes ptr to I frame message.
|
||||||
size size of message in bytes.
|
size size of message in bytes.
|
||||||
|
|
||||||
Return Value: 0 if failed, 1 if Send.
|
Return Value: 0 if failed, 1 if Send.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int Q921SendI(int trunk, L2UCHAR Sapi, char cr, L2UCHAR Tei, char pf, L2UCHAR *mes, int size)
|
int Q921SendI(int trunk, L2UCHAR Sapi, char cr, L2UCHAR Tei, char pf, L2UCHAR *mes, int size)
|
||||||
{
|
{
|
||||||
mes[Q921HeaderSpace+0] = (Sapi&0xfc) | ((cr<<1)&0x02);
|
mes[Q921HeaderSpace+0] = (Sapi&0xfc) | ((cr<<1)&0x02);
|
||||||
mes[Q921HeaderSpace+1] = (Tei<<1) | 0x01;
|
mes[Q921HeaderSpace+1] = (Tei<<1) | 0x01;
|
||||||
mes[Q921HeaderSpace+2] = Q921DevSpace[trunk].vs<<1;
|
mes[Q921HeaderSpace+2] = Q921DevSpace[trunk].vs<<1;
|
||||||
mes[Q921HeaderSpace+3] = (Q921DevSpace[trunk].vr<<1) | (pf & 0x01);
|
mes[Q921HeaderSpace+3] = (Q921DevSpace[trunk].vr<<1) | (pf & 0x01);
|
||||||
Q921DevSpace[trunk].vs++;
|
Q921DevSpace[trunk].vs++;
|
||||||
|
|
||||||
return Q921Tx21Proc(trunk, mes, size);
|
return Q921Tx21Proc(trunk, mes, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q921SendRR
|
Function: Q921SendRR
|
||||||
|
|
||||||
Description: Compose and send Receive Ready.
|
Description: Compose and send Receive Ready.
|
||||||
|
|
||||||
Parameters: trunk trunk #
|
Parameters: trunk trunk #
|
||||||
Sapi Sapi
|
Sapi Sapi
|
||||||
cr C/R field.
|
cr C/R field.
|
||||||
Tei Tei.
|
Tei Tei.
|
||||||
pf P/F fiels octet 5
|
pf P/F fiels octet 5
|
||||||
|
|
||||||
Return Value: 0 if failed, 1 if Send.
|
Return Value: 0 if failed, 1 if Send.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
int Q921SendRR(int trunk, int Sapi, int cr, int Tei, int pf)
|
int Q921SendRR(int trunk, int Sapi, int cr, int Tei, int pf)
|
||||||
{
|
{
|
||||||
L2UCHAR mes[400];
|
L2UCHAR mes[400];
|
||||||
|
|
||||||
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
||||||
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
||||||
mes[Q921HeaderSpace+2] = (L2UCHAR)0x01;
|
mes[Q921HeaderSpace+2] = (L2UCHAR)0x01;
|
||||||
mes[Q921HeaderSpace+3] = (L2UCHAR)((Q921DevSpace[trunk].vr<<1) | (pf & 0x01));
|
mes[Q921HeaderSpace+3] = (L2UCHAR)((Q921DevSpace[trunk].vr<<1) | (pf & 0x01));
|
||||||
|
|
||||||
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+4);
|
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q921SendRNR
|
Function: Q921SendRNR
|
||||||
|
|
||||||
Description: Compose and send Receive Nor Ready
|
Description: Compose and send Receive Nor Ready
|
||||||
|
|
||||||
Parameters: trunk trunk #
|
Parameters: trunk trunk #
|
||||||
Sapi Sapi
|
Sapi Sapi
|
||||||
cr C/R field.
|
cr C/R field.
|
||||||
Tei Tei.
|
Tei Tei.
|
||||||
pf P/F fiels octet 5
|
pf P/F fiels octet 5
|
||||||
|
|
||||||
Return Value: 0 if failed, 1 if Send.
|
Return Value: 0 if failed, 1 if Send.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int Q921SendRNR(int trunk, int Sapi, int cr, int Tei, int pf)
|
int Q921SendRNR(int trunk, int Sapi, int cr, int Tei, int pf)
|
||||||
{
|
{
|
||||||
L2UCHAR mes[400];
|
L2UCHAR mes[400];
|
||||||
|
|
||||||
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
||||||
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
||||||
mes[Q921HeaderSpace+2] = (L2UCHAR)0x05;
|
mes[Q921HeaderSpace+2] = (L2UCHAR)0x05;
|
||||||
mes[Q921HeaderSpace+3] = (L2UCHAR)((Q921DevSpace[trunk].vr<<1) | (pf & 0x01));
|
mes[Q921HeaderSpace+3] = (L2UCHAR)((Q921DevSpace[trunk].vr<<1) | (pf & 0x01));
|
||||||
|
|
||||||
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+4);
|
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q921SendREJ
|
Function: Q921SendREJ
|
||||||
|
|
||||||
Description: Compose and Send Reject.
|
Description: Compose and Send Reject.
|
||||||
|
|
||||||
Parameters: trunk trunk #
|
Parameters: trunk trunk #
|
||||||
Sapi Sapi
|
Sapi Sapi
|
||||||
cr C/R field.
|
cr C/R field.
|
||||||
Tei Tei.
|
Tei Tei.
|
||||||
pf P/F fiels octet 5
|
pf P/F fiels octet 5
|
||||||
|
|
||||||
Return Value: 0 if failed, 1 if Send.
|
Return Value: 0 if failed, 1 if Send.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int Q921SendREJ(int trunk, int Sapi, int cr, int Tei, int pf)
|
int Q921SendREJ(int trunk, int Sapi, int cr, int Tei, int pf)
|
||||||
{
|
{
|
||||||
L2UCHAR mes[400];
|
L2UCHAR mes[400];
|
||||||
|
|
||||||
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
||||||
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
||||||
mes[Q921HeaderSpace+2] = (L2UCHAR)0x09;
|
mes[Q921HeaderSpace+2] = (L2UCHAR)0x09;
|
||||||
mes[Q921HeaderSpace+3] = (L2UCHAR)((Q921DevSpace[trunk].vr<<1) | (pf & 0x01));
|
mes[Q921HeaderSpace+3] = (L2UCHAR)((Q921DevSpace[trunk].vr<<1) | (pf & 0x01));
|
||||||
|
|
||||||
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+4);
|
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q921SendSABME
|
Function: Q921SendSABME
|
||||||
|
|
||||||
Description: Compose and send SABME
|
Description: Compose and send SABME
|
||||||
|
|
||||||
Parameters: trunk trunk #
|
Parameters: trunk trunk #
|
||||||
Sapi Sapi
|
Sapi Sapi
|
||||||
cr C/R field.
|
cr C/R field.
|
||||||
Tei Tei.
|
Tei Tei.
|
||||||
pf P fiels octet 4
|
pf P fiels octet 4
|
||||||
|
|
||||||
Return Value: 0 if failed, 1 if Send.
|
Return Value: 0 if failed, 1 if Send.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int Q921SendSABME(int trunk, int Sapi, int cr, int Tei, int pf)
|
int Q921SendSABME(int trunk, int Sapi, int cr, int Tei, int pf)
|
||||||
{
|
{
|
||||||
L2UCHAR mes[400];
|
L2UCHAR mes[400];
|
||||||
|
|
||||||
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
||||||
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
||||||
mes[Q921HeaderSpace+2] = (L2UCHAR)(0x6f | ((pf<<4)&0x10));
|
mes[Q921HeaderSpace+2] = (L2UCHAR)(0x6f | ((pf<<4)&0x10));
|
||||||
|
|
||||||
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+3);
|
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q921SendDM
|
Function: Q921SendDM
|
||||||
|
|
||||||
Description: Comose and Send DM (Disconnected Mode)
|
Description: Comose and Send DM (Disconnected Mode)
|
||||||
|
|
||||||
Parameters: trunk trunk #
|
Parameters: trunk trunk #
|
||||||
Sapi Sapi
|
Sapi Sapi
|
||||||
cr C/R field.
|
cr C/R field.
|
||||||
Tei Tei.
|
Tei Tei.
|
||||||
pf F fiels octet 4
|
pf F fiels octet 4
|
||||||
|
|
||||||
Return Value: 0 if failed, 1 if Send.
|
Return Value: 0 if failed, 1 if Send.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int Q921SendDM(int trunk, int Sapi, int cr, int Tei, int pf)
|
int Q921SendDM(int trunk, int Sapi, int cr, int Tei, int pf)
|
||||||
{
|
{
|
||||||
L2UCHAR mes[400];
|
L2UCHAR mes[400];
|
||||||
|
|
||||||
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
||||||
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
||||||
mes[Q921HeaderSpace+2] = (L2UCHAR)(0x0f | ((pf<<4)&0x10));
|
mes[Q921HeaderSpace+2] = (L2UCHAR)(0x0f | ((pf<<4)&0x10));
|
||||||
|
|
||||||
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+3);
|
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q921SendDISC
|
Function: Q921SendDISC
|
||||||
|
|
||||||
Description: Compose and Send Disconnect
|
Description: Compose and Send Disconnect
|
||||||
|
|
||||||
Parameters: trunk trunk #
|
Parameters: trunk trunk #
|
||||||
Sapi Sapi
|
Sapi Sapi
|
||||||
cr C/R field.
|
cr C/R field.
|
||||||
Tei Tei.
|
Tei Tei.
|
||||||
pf P fiels octet 4
|
pf P fiels octet 4
|
||||||
|
|
||||||
Return Value: 0 if failed, 1 if Send.
|
Return Value: 0 if failed, 1 if Send.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int Q921SendDISC(int trunk, int Sapi, int cr, int Tei, int pf)
|
int Q921SendDISC(int trunk, int Sapi, int cr, int Tei, int pf)
|
||||||
{
|
{
|
||||||
L2UCHAR mes[400];
|
L2UCHAR mes[400];
|
||||||
|
|
||||||
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
||||||
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
||||||
mes[Q921HeaderSpace+2] = (L2UCHAR)(0x43 | ((pf<<4)&0x10));
|
mes[Q921HeaderSpace+2] = (L2UCHAR)(0x43 | ((pf<<4)&0x10));
|
||||||
|
|
||||||
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+3);
|
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q921SendUA
|
Function: Q921SendUA
|
||||||
|
|
||||||
Description: Compose and Send UA
|
Description: Compose and Send UA
|
||||||
|
|
||||||
Parameters: trunk trunk #
|
Parameters: trunk trunk #
|
||||||
Sapi Sapi
|
Sapi Sapi
|
||||||
cr C/R field.
|
cr C/R field.
|
||||||
Tei Tei.
|
Tei Tei.
|
||||||
pf F fiels octet 4
|
pf F fiels octet 4
|
||||||
|
|
||||||
Return Value: 0 if failed, 1 if Send.
|
Return Value: 0 if failed, 1 if Send.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int Q921SendUA(int trunk, int Sapi, int cr, int Tei, int pf)
|
int Q921SendUA(int trunk, int Sapi, int cr, int Tei, int pf)
|
||||||
{
|
{
|
||||||
L2UCHAR mes[400];
|
L2UCHAR mes[400];
|
||||||
|
|
||||||
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
mes[Q921HeaderSpace+0] = (L2UCHAR)((Sapi&0xfc) | ((cr<<1)&0x02));
|
||||||
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
mes[Q921HeaderSpace+1] = (L2UCHAR)((Tei<<1) | 0x01);
|
||||||
mes[Q921HeaderSpace+2] = (L2UCHAR)(0x63 | ((pf<<4)&0x10));
|
mes[Q921HeaderSpace+2] = (L2UCHAR)(0x63 | ((pf<<4)&0x10));
|
||||||
|
|
||||||
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+3);
|
return Q921Tx21Proc(trunk, mes, Q921HeaderSpace+3);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Q921ProcSABME(int trunk, L2UCHAR *mes, int size)
|
int Q921ProcSABME(int trunk, L2UCHAR *mes, int size)
|
||||||
{
|
{
|
||||||
/* TODO: Do we need these paramaters? */
|
/* TODO: Do we need these paramaters? */
|
||||||
(void)mes;
|
(void)mes;
|
||||||
(void)size;
|
(void)size;
|
||||||
|
|
||||||
Q921DevSpace[trunk].vr=0;
|
Q921DevSpace[trunk].vr=0;
|
||||||
Q921DevSpace[trunk].vs=0;
|
Q921DevSpace[trunk].vs=0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q921Rx12
|
Function: Q921Rx12
|
||||||
|
|
||||||
Description: Called to process a message frame from layer 1. Will
|
Description: Called to process a message frame from layer 1. Will
|
||||||
identify the message and call the proper 'processor' for
|
identify the message and call the proper 'processor' for
|
||||||
layer 2 messages and forward I frames to the layer 3 entity.
|
layer 2 messages and forward I frames to the layer 3 entity.
|
||||||
|
|
||||||
Q921Rx12 will check the input fifo for a message, and if a
|
Q921Rx12 will check the input fifo for a message, and if a
|
||||||
message exist process one message before it exits. The caller
|
message exist process one message before it exits. The caller
|
||||||
must either call Q921Rx12 polling or keep track on #
|
must either call Q921Rx12 polling or keep track on #
|
||||||
messages in the queue.
|
messages in the queue.
|
||||||
|
|
||||||
Parameters: trunk trunk #.
|
Parameters: trunk trunk #.
|
||||||
|
|
||||||
Return Value: # messages processed (always 1 or 0).
|
Return Value: # messages processed (always 1 or 0).
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int Q921Rx12(long trunk)
|
int Q921Rx12(long trunk)
|
||||||
{
|
{
|
||||||
L2UCHAR *mes;
|
L2UCHAR *mes;
|
||||||
int rs,size; /* receive size & Q921 frame size*/
|
int rs,size; /* receive size & Q921 frame size*/
|
||||||
L2UCHAR *smes = MFIFOGetMesPtr(Q921DevSpace[trunk].HDLCInQueue, &size);
|
L2UCHAR *smes = MFIFOGetMesPtr(Q921DevSpace[trunk].HDLCInQueue, &size);
|
||||||
if(smes != NULL)
|
if(smes != NULL)
|
||||||
{
|
{
|
||||||
rs = size - Q921HeaderSpace;
|
rs = size - Q921HeaderSpace;
|
||||||
mes = &smes[Q921HeaderSpace];
|
mes = &smes[Q921HeaderSpace];
|
||||||
/* check for I frame */
|
/* check for I frame */
|
||||||
if((mes[2] & 0x01) == 0)
|
if((mes[2] & 0x01) == 0)
|
||||||
{
|
{
|
||||||
if(Q921Tx23Proc(trunk, smes, size-2)) /* -2 to clip away CRC */
|
if(Q921Tx23Proc(trunk, smes, size-2)) /* -2 to clip away CRC */
|
||||||
{
|
{
|
||||||
Q921DevSpace[trunk].vr++;
|
Q921DevSpace[trunk].vr++;
|
||||||
Q921SendRR(trunk, (mes[0]&0xfc)>>2, (mes[0]>>1)&0x01,mes[1]>>1, mes[3]&0x01);
|
Q921SendRR(trunk, (mes[0]&0xfc)>>2, (mes[0]>>1)&0x01,mes[1]>>1, mes[3]&0x01);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* todo: whatever*/
|
/* todo: whatever*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for RR */
|
/* check for RR */
|
||||||
else if(mes[2] ==0x01)
|
else if(mes[2] ==0x01)
|
||||||
{
|
{
|
||||||
/* todo: check if RR is responce to I */
|
/* todo: check if RR is responce to I */
|
||||||
Q921SendRR(trunk, (mes[0]&0xfc)>>2, (mes[0]>>1)&0x01,mes[1]>>1, mes[2]&0x01);
|
Q921SendRR(trunk, (mes[0]&0xfc)>>2, (mes[0]>>1)&0x01,mes[1]>>1, mes[2]&0x01);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for RNR */
|
/* check for RNR */
|
||||||
/* check for REJ */
|
/* check for REJ */
|
||||||
/* check for SABME */
|
/* check for SABME */
|
||||||
else if((mes[2] & 0xef) == 0x6f)
|
else if((mes[2] & 0xef) == 0x6f)
|
||||||
{
|
{
|
||||||
Q921ProcSABME(trunk, mes, rs);
|
Q921ProcSABME(trunk, mes, rs);
|
||||||
Q921SendUA(trunk, (mes[0]&0xfc)>>2, (mes[0]>>1)&0x01,mes[1]>>1, (mes[2]&0x10)>>4);
|
Q921SendUA(trunk, (mes[0]&0xfc)>>2, (mes[0]>>1)&0x01,mes[1]>>1, (mes[2]&0x10)>>4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for DM */
|
/* check for DM */
|
||||||
/* check for UI */
|
/* check for UI */
|
||||||
/* check for DISC */
|
/* check for DISC */
|
||||||
/* check for UA */
|
/* check for UA */
|
||||||
/* check for FRMR */
|
/* check for FRMR */
|
||||||
/* check for XID */
|
/* check for XID */
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* what the ? Issue an error */
|
/* what the ? Issue an error */
|
||||||
/* Q921ErrorProc(trunk, Q921_UNKNOWNFRAME, mes, rs); */
|
/* Q921ErrorProc(trunk, Q921_UNKNOWNFRAME, mes, rs); */
|
||||||
/* todo: REJ or FRMR */
|
/* todo: REJ or FRMR */
|
||||||
}
|
}
|
||||||
|
|
||||||
MFIFOKillNext(Q921DevSpace[trunk].HDLCInQueue);
|
MFIFOKillNext(Q921DevSpace[trunk].HDLCInQueue);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,310 +1,310 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
FileName: Q932mes.c
|
FileName: Q932mes.c
|
||||||
|
|
||||||
Contents: Q.932 Message Encoders/Decoders
|
Contents: Q.932 Message Encoders/Decoders
|
||||||
|
|
||||||
License/Copyright:
|
License/Copyright:
|
||||||
|
|
||||||
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
||||||
email:janvb@caselaboratories.com
|
email:janvb@caselaboratories.com
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
modification, are permitted provided that the following conditions are
|
||||||
met:
|
met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
this list of conditions and the following disclaimer.
|
this list of conditions and the following disclaimer.
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
* Neither the name of the Case Labs, Ltd nor the names of its contributors
|
* 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
|
may be used to endorse or promote products derived from this software
|
||||||
without specific prior written permission.
|
without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
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
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "Q931.h"
|
#include "Q931.h"
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q932Umes_Facility
|
Function: Q932Umes_Facility
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
L3INT Q932Umes_Facility(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
L3INT Q932Umes_Facility(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
||||||
{
|
{
|
||||||
/* L3INT i = IOff; */
|
/* L3INT i = IOff; */
|
||||||
/* L3INT ir=0; */
|
/* L3INT ir=0; */
|
||||||
L3INT OOff=0;
|
L3INT OOff=0;
|
||||||
Q932mes_Facility *mes = (Q932mes_Facility*)IBuf;
|
Q932mes_Facility *mes = (Q932mes_Facility*)IBuf;
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
|
||||||
mes->Size = sizeof(Q932mes_Facility) - 1 + OOff;
|
mes->Size = sizeof(Q932mes_Facility) - 1 + OOff;
|
||||||
return Q931E_NO_ERROR;
|
return Q931E_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q931Pmes_Facility
|
Function: Q931Pmes_Facility
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
L3INT Q932Pmes_Facility(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
L3INT Q932Pmes_Facility(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
||||||
{
|
{
|
||||||
L3BOOL RetCode = L3FALSE;
|
L3BOOL RetCode = L3FALSE;
|
||||||
|
|
||||||
NoWarning(OBuf);
|
NoWarning(OBuf);
|
||||||
NoWarning(IBuf);
|
NoWarning(IBuf);
|
||||||
|
|
||||||
return RetCode;
|
return RetCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q932Umes_Hold
|
Function: Q932Umes_Hold
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
L3INT Q932Umes_Hold(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
L3INT Q932Umes_Hold(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
||||||
{
|
{
|
||||||
/* L3INT i = IOff; */
|
/* L3INT i = IOff; */
|
||||||
/* L3INT ir=0; */
|
/* L3INT ir=0; */
|
||||||
L3INT OOff=0;
|
L3INT OOff=0;
|
||||||
Q932mes_Hold *mes = (Q932mes_Hold*)IBuf;
|
Q932mes_Hold *mes = (Q932mes_Hold*)IBuf;
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
|
||||||
mes->Size = sizeof(Q932mes_Hold) - 1 + OOff;
|
mes->Size = sizeof(Q932mes_Hold) - 1 + OOff;
|
||||||
return Q931E_NO_ERROR;
|
return Q931E_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q931Pmes_Hold
|
Function: Q931Pmes_Hold
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
L3INT Q932Pmes_Hold(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
L3INT Q932Pmes_Hold(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
||||||
{
|
{
|
||||||
L3BOOL RetCode = L3FALSE;
|
L3BOOL RetCode = L3FALSE;
|
||||||
|
|
||||||
NoWarning(OBuf);
|
NoWarning(OBuf);
|
||||||
NoWarning(IBuf);
|
NoWarning(IBuf);
|
||||||
|
|
||||||
return RetCode;
|
return RetCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q932Umes_HoldAck
|
Function: Q932Umes_HoldAck
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
L3INT Q932Umes_HoldAck(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
L3INT Q932Umes_HoldAck(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
||||||
{
|
{
|
||||||
/* L3INT i = IOff; */
|
/* L3INT i = IOff; */
|
||||||
/* L3INT ir=0; */
|
/* L3INT ir=0; */
|
||||||
L3INT OOff=0;
|
L3INT OOff=0;
|
||||||
Q932mes_HoldAck *mes = (Q932mes_HoldAck*)IBuf;
|
Q932mes_HoldAck *mes = (Q932mes_HoldAck*)IBuf;
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
|
||||||
mes->Size = sizeof(Q932mes_HoldAck) - 1 + OOff;
|
mes->Size = sizeof(Q932mes_HoldAck) - 1 + OOff;
|
||||||
return Q931E_NO_ERROR;
|
return Q931E_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q931Pmes_HoldAck
|
Function: Q931Pmes_HoldAck
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
L3INT Q932Pmes_HoldAck(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
L3INT Q932Pmes_HoldAck(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
||||||
{
|
{
|
||||||
L3BOOL RetCode = L3FALSE;
|
L3BOOL RetCode = L3FALSE;
|
||||||
|
|
||||||
NoWarning(OBuf);
|
NoWarning(OBuf);
|
||||||
NoWarning(IBuf);
|
NoWarning(IBuf);
|
||||||
|
|
||||||
return RetCode;
|
return RetCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q932Umes_HoldReject
|
Function: Q932Umes_HoldReject
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
L3INT Q932Umes_HoldReject(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
L3INT Q932Umes_HoldReject(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
||||||
{
|
{
|
||||||
/* L3INT i = IOff; */
|
/* L3INT i = IOff; */
|
||||||
/* L3INT ir=0; */
|
/* L3INT ir=0; */
|
||||||
L3INT OOff=0;
|
L3INT OOff=0;
|
||||||
Q932mes_HoldReject *mes = (Q932mes_HoldReject*)IBuf;
|
Q932mes_HoldReject *mes = (Q932mes_HoldReject*)IBuf;
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
|
||||||
mes->Size = sizeof(Q932mes_HoldReject) - 1 + OOff;
|
mes->Size = sizeof(Q932mes_HoldReject) - 1 + OOff;
|
||||||
return Q931E_NO_ERROR;
|
return Q931E_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q931Pmes_HoldReject
|
Function: Q931Pmes_HoldReject
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
L3INT Q932Pmes_HoldReject(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
L3INT Q932Pmes_HoldReject(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
||||||
{
|
{
|
||||||
L3BOOL RetCode = L3FALSE;
|
L3BOOL RetCode = L3FALSE;
|
||||||
|
|
||||||
NoWarning(OBuf);
|
NoWarning(OBuf);
|
||||||
NoWarning(IBuf);
|
NoWarning(IBuf);
|
||||||
|
|
||||||
return RetCode;
|
return RetCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q932Umes_Register
|
Function: Q932Umes_Register
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
L3INT Q932Umes_Register(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
L3INT Q932Umes_Register(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
||||||
{
|
{
|
||||||
/* L3INT i = IOff; */
|
/* L3INT i = IOff; */
|
||||||
/* L3INT ir=0; */
|
/* L3INT ir=0; */
|
||||||
L3INT OOff=0;
|
L3INT OOff=0;
|
||||||
Q932mes_Register *mes = (Q932mes_Register*)IBuf;
|
Q932mes_Register *mes = (Q932mes_Register*)IBuf;
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
|
||||||
mes->Size = sizeof(Q932mes_Register) - 1 + OOff;
|
mes->Size = sizeof(Q932mes_Register) - 1 + OOff;
|
||||||
return Q931E_NO_ERROR;
|
return Q931E_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q931Pmes_Register
|
Function: Q931Pmes_Register
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
L3INT Q932Pmes_Register(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
L3INT Q932Pmes_Register(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
||||||
{
|
{
|
||||||
L3BOOL RetCode = L3FALSE;
|
L3BOOL RetCode = L3FALSE;
|
||||||
|
|
||||||
NoWarning(OBuf);
|
NoWarning(OBuf);
|
||||||
NoWarning(IBuf);
|
NoWarning(IBuf);
|
||||||
|
|
||||||
return RetCode;
|
return RetCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q932Umes_Retrieve
|
Function: Q932Umes_Retrieve
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
L3INT Q932Umes_Retrieve(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
L3INT Q932Umes_Retrieve(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
||||||
{
|
{
|
||||||
/* L3INT i = IOff; */
|
/* L3INT i = IOff; */
|
||||||
/* L3INT ir=0; */
|
/* L3INT ir=0; */
|
||||||
L3INT OOff=0;
|
L3INT OOff=0;
|
||||||
Q932mes_Retrieve *mes = (Q932mes_Retrieve*)IBuf;
|
Q932mes_Retrieve *mes = (Q932mes_Retrieve*)IBuf;
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
|
||||||
mes->Size = sizeof(Q932mes_Retrieve) - 1 + OOff;
|
mes->Size = sizeof(Q932mes_Retrieve) - 1 + OOff;
|
||||||
return Q931E_NO_ERROR;
|
return Q931E_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q931Pmes_Retrieve
|
Function: Q931Pmes_Retrieve
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
L3INT Q932Pmes_Retrieve(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
L3INT Q932Pmes_Retrieve(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
||||||
{
|
{
|
||||||
L3BOOL RetCode = L3FALSE;
|
L3BOOL RetCode = L3FALSE;
|
||||||
|
|
||||||
NoWarning(OBuf);
|
NoWarning(OBuf);
|
||||||
NoWarning(IBuf);
|
NoWarning(IBuf);
|
||||||
|
|
||||||
return RetCode;
|
return RetCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q932Umes_RetrieveAck
|
Function: Q932Umes_RetrieveAck
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
L3INT Q932Umes_RetrieveAck(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
L3INT Q932Umes_RetrieveAck(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
||||||
{
|
{
|
||||||
/* L3INT i = IOff; */
|
/* L3INT i = IOff; */
|
||||||
/* L3INT ir=0; */
|
/* L3INT ir=0; */
|
||||||
L3INT OOff=0;
|
L3INT OOff=0;
|
||||||
Q932mes_RetrieveAck *mes = (Q932mes_RetrieveAck*)IBuf;
|
Q932mes_RetrieveAck *mes = (Q932mes_RetrieveAck*)IBuf;
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
|
||||||
mes->Size = sizeof(Q932mes_RetrieveAck) - 1 + OOff;
|
mes->Size = sizeof(Q932mes_RetrieveAck) - 1 + OOff;
|
||||||
return Q931E_NO_ERROR;
|
return Q931E_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q931Pmes_RetrieveAck
|
Function: Q931Pmes_RetrieveAck
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
L3INT Q932Pmes_RetrieveAck(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
L3INT Q932Pmes_RetrieveAck(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
||||||
{
|
{
|
||||||
L3BOOL RetCode = L3FALSE;
|
L3BOOL RetCode = L3FALSE;
|
||||||
|
|
||||||
NoWarning(OBuf);
|
NoWarning(OBuf);
|
||||||
NoWarning(IBuf);
|
NoWarning(IBuf);
|
||||||
|
|
||||||
return RetCode;
|
return RetCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q932Umes_RetrieveReject
|
Function: Q932Umes_RetrieveReject
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
L3INT Q932Umes_RetrieveReject(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
L3INT Q932Umes_RetrieveReject(Q931_TrunkInfo *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size)
|
||||||
{
|
{
|
||||||
/* L3INT i = IOff; */
|
/* L3INT i = IOff; */
|
||||||
/* L3INT ir=0; */
|
/* L3INT ir=0; */
|
||||||
L3INT OOff=0;
|
L3INT OOff=0;
|
||||||
Q932mes_RetrieveReject *mes = (Q932mes_RetrieveReject*)IBuf;
|
Q932mes_RetrieveReject *mes = (Q932mes_RetrieveReject*)IBuf;
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
|
||||||
mes->Size = sizeof(Q932mes_RetrieveReject) - 1 + OOff;
|
mes->Size = sizeof(Q932mes_RetrieveReject) - 1 + OOff;
|
||||||
return Q931E_NO_ERROR;
|
return Q931E_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: Q931Pmes_RetrieveReject
|
Function: Q931Pmes_RetrieveReject
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
L3INT Q932Pmes_RetrieveReject(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
L3INT Q932Pmes_RetrieveReject(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
|
||||||
{
|
{
|
||||||
L3BOOL RetCode = L3FALSE;
|
L3BOOL RetCode = L3FALSE;
|
||||||
|
|
||||||
NoWarning(OBuf);
|
NoWarning(OBuf);
|
||||||
NoWarning(IBuf);
|
NoWarning(IBuf);
|
||||||
|
|
||||||
return RetCode;
|
return RetCode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,117 +1,117 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
FileName: q921.h
|
FileName: q921.h
|
||||||
|
|
||||||
Description: Contains headers of a Q.921 protocol on top of the Comet
|
Description: Contains headers of a Q.921 protocol on top of the Comet
|
||||||
Driver.
|
Driver.
|
||||||
|
|
||||||
Most of the work required to execute a Q.921 protocol is
|
Most of the work required to execute a Q.921 protocol is
|
||||||
taken care of by the Comet ship and it's driver. This layer
|
taken care of by the Comet ship and it's driver. This layer
|
||||||
will simply configure and make use of these features to
|
will simply configure and make use of these features to
|
||||||
complete a Q.921 implementation.
|
complete a Q.921 implementation.
|
||||||
|
|
||||||
Note: This header file is the only include file that should be
|
Note: This header file is the only include file that should be
|
||||||
acessed by users of the Q.921 stack.
|
acessed by users of the Q.921 stack.
|
||||||
|
|
||||||
Interface: The Q.921 stack contains 2 layers.
|
Interface: The Q.921 stack contains 2 layers.
|
||||||
|
|
||||||
- One interface layer.
|
- One interface layer.
|
||||||
- One driver layer.
|
- One driver layer.
|
||||||
|
|
||||||
The interface layer contains the interface functions required
|
The interface layer contains the interface functions required
|
||||||
for a layer 3 stack to be able to send and receive messages.
|
for a layer 3 stack to be able to send and receive messages.
|
||||||
|
|
||||||
The driver layer will simply feed bytes into the ship as
|
The driver layer will simply feed bytes into the ship as
|
||||||
required and queue messages received out from the ship.
|
required and queue messages received out from the ship.
|
||||||
|
|
||||||
Q921TimeTick The Q.921 like any other blackbox
|
Q921TimeTick The Q.921 like any other blackbox
|
||||||
modules contains no thread by it's own
|
modules contains no thread by it's own
|
||||||
and must therefore be called regularly
|
and must therefore be called regularly
|
||||||
by an external 'thread' to do maintenance
|
by an external 'thread' to do maintenance
|
||||||
etc.
|
etc.
|
||||||
|
|
||||||
Q921Rx32 Receive message from layer 3. Called by
|
Q921Rx32 Receive message from layer 3. Called by
|
||||||
the layer 3 stack to send a message.
|
the layer 3 stack to send a message.
|
||||||
|
|
||||||
Q921Tx23 Send a message to layer 3.
|
Q921Tx23 Send a message to layer 3.
|
||||||
|
|
||||||
OnQ921Error Function called every if an error is
|
OnQ921Error Function called every if an error is
|
||||||
deteceted.
|
deteceted.
|
||||||
|
|
||||||
OnQ921Log Function called if logging is active.
|
OnQ921Log Function called if logging is active.
|
||||||
|
|
||||||
|
|
||||||
<TODO> Maintenance/Configuration interface
|
<TODO> Maintenance/Configuration interface
|
||||||
|
|
||||||
Created: 27.dec.2000/JVB
|
Created: 27.dec.2000/JVB
|
||||||
|
|
||||||
License/Copyright:
|
License/Copyright:
|
||||||
|
|
||||||
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
||||||
email:janvb@caselaboratories.com
|
email:janvb@caselaboratories.com
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
modification, are permitted provided that the following conditions are
|
||||||
met:
|
met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
this list of conditions and the following disclaimer.
|
this list of conditions and the following disclaimer.
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
* Neither the name of the Case Labs, Ltd nor the names of its contributors
|
* 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
|
may be used to endorse or promote products derived from this software
|
||||||
without specific prior written permission.
|
without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
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
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef _Q921
|
#ifndef _Q921
|
||||||
#define _Q921
|
#define _Q921
|
||||||
|
|
||||||
#define Q921MAXTRUNK 4
|
#define Q921MAXTRUNK 4
|
||||||
#define Q921MAXHDLCSPACE 3000
|
#define Q921MAXHDLCSPACE 3000
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Some speed optimization can be achieved by changing all variables to the
|
Some speed optimization can be achieved by changing all variables to the
|
||||||
word size of your processor. A 32 bit processor have to do a lot of extra
|
word size of your processor. A 32 bit processor have to do a lot of extra
|
||||||
work to read a packed 8 bit integer. Changing all fields to 32 bit integer
|
work to read a packed 8 bit integer. Changing all fields to 32 bit integer
|
||||||
will ressult in usage of some extra space, but speed up the stack.
|
will ressult in usage of some extra space, but speed up the stack.
|
||||||
|
|
||||||
The stack have been designed to allow L3UCHAR etc. to be any size of 8 bit
|
The stack have been designed to allow L3UCHAR etc. to be any size of 8 bit
|
||||||
or larger.
|
or larger.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#define L2UCHAR unsigned char /* Min 8 bit */
|
#define L2UCHAR unsigned char /* Min 8 bit */
|
||||||
#define L2INT int /* Min 16 bit signed */
|
#define L2INT int /* Min 16 bit signed */
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
L2UCHAR HDLCInQueue[Q921MAXHDLCSPACE];
|
L2UCHAR HDLCInQueue[Q921MAXHDLCSPACE];
|
||||||
L2UCHAR vs;
|
L2UCHAR vs;
|
||||||
L2UCHAR vr;
|
L2UCHAR vr;
|
||||||
int state;
|
int state;
|
||||||
}Q921Data;
|
}Q921Data;
|
||||||
|
|
||||||
void Q921Init();
|
void Q921Init();
|
||||||
void Q921SetHeaderSpace(int hspace);
|
void Q921SetHeaderSpace(int hspace);
|
||||||
void Q921SetTx21CB(int (*callback)(int dev, L2UCHAR *, int));
|
void Q921SetTx21CB(int (*callback)(int dev, L2UCHAR *, int));
|
||||||
void Q921SetTx23CB(int (*callback)(int dev, L2UCHAR *, int));
|
void Q921SetTx23CB(int (*callback)(int dev, L2UCHAR *, int));
|
||||||
int Q921QueueHDLCFrame(int trunk, L2UCHAR *b, int size);
|
int Q921QueueHDLCFrame(int trunk, L2UCHAR *b, int size);
|
||||||
int Q921Rx12(long trunk);
|
int Q921Rx12(long trunk);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,191 +1,191 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
FileName: Q932.h
|
FileName: Q932.h
|
||||||
|
|
||||||
Contents: Header w/structs for Q932 Suplementary Services.
|
Contents: Header w/structs for Q932 Suplementary Services.
|
||||||
|
|
||||||
NB: Do NOT include this header directly, include Q931.h
|
NB: Do NOT include this header directly, include Q931.h
|
||||||
|
|
||||||
License/Copyright:
|
License/Copyright:
|
||||||
|
|
||||||
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
||||||
email:janvb@caselaboratories.com
|
email:janvb@caselaboratories.com
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
modification, are permitted provided that the following conditions are
|
||||||
met:
|
met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
this list of conditions and the following disclaimer.
|
this list of conditions and the following disclaimer.
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
* Neither the name of the Case Labs, Ltd nor the names of its contributors
|
* 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
|
may be used to endorse or promote products derived from this software
|
||||||
without specific prior written permission.
|
without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
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
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Q.932 Additional Message codes
|
Q.932 Additional Message codes
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#define Q932mes_HOLD 0x24 /* 0010 0100 */
|
#define Q932mes_HOLD 0x24 /* 0010 0100 */
|
||||||
#define Q932mes_HOLD_ACKNOWLEDGE 0x28 /* 0010 1000 */
|
#define Q932mes_HOLD_ACKNOWLEDGE 0x28 /* 0010 1000 */
|
||||||
#define Q932mes_HOLD_REJECT 0x30 /* 0011 0000 */
|
#define Q932mes_HOLD_REJECT 0x30 /* 0011 0000 */
|
||||||
#define Q932mes_RETRIEVE 0x31 /* 0011 0001 */
|
#define Q932mes_RETRIEVE 0x31 /* 0011 0001 */
|
||||||
#define Q932mes_RETRIEVE_ACKNOWLEDGE 0x33 /* 0011 0011 */
|
#define Q932mes_RETRIEVE_ACKNOWLEDGE 0x33 /* 0011 0011 */
|
||||||
#define Q932mes_RETRIEVE_REJECT 0x37 /* 0011 0111 */
|
#define Q932mes_RETRIEVE_REJECT 0x37 /* 0011 0111 */
|
||||||
#define Q932mes_FACILITY 0x62 /* 0110 0010 */
|
#define Q932mes_FACILITY 0x62 /* 0110 0010 */
|
||||||
#define Q932mes_REGISTER 0x64 /* 0110 0100 */
|
#define Q932mes_REGISTER 0x64 /* 0110 0100 */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Q.932 Additional EI Codes
|
Q.932 Additional EI Codes
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#define Q932ie_FACILITY 0x1c /* 0001 1100 */
|
#define Q932ie_FACILITY 0x1c /* 0001 1100 */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Struct: Q932ie_Facility
|
Struct: Q932ie_Facility
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
L3UINT Size; /* Size of message in bytes */
|
L3UINT Size; /* Size of message in bytes */
|
||||||
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
||||||
L3UCHAR MesType; /* Message type */
|
L3UCHAR MesType; /* Message type */
|
||||||
L3USHORT CRV; /* Call reference value */
|
L3USHORT CRV; /* Call reference value */
|
||||||
L3UCHAR buf[1]; /* Dynamic buffer */
|
L3UCHAR buf[1]; /* Dynamic buffer */
|
||||||
}Q932mes_Facility;
|
}Q932mes_Facility;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Struct: Q932ie_Hold
|
Struct: Q932ie_Hold
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
L3UINT Size; /* Size of message in bytes */
|
L3UINT Size; /* Size of message in bytes */
|
||||||
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
||||||
L3UCHAR MesType; /* Message type */
|
L3UCHAR MesType; /* Message type */
|
||||||
L3USHORT CRV; /* Call reference value */
|
L3USHORT CRV; /* Call reference value */
|
||||||
L3UCHAR buf[1]; /* Dynamic buffer */
|
L3UCHAR buf[1]; /* Dynamic buffer */
|
||||||
}Q932mes_Hold;
|
}Q932mes_Hold;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Struct: Q932ie_HoldAck
|
Struct: Q932ie_HoldAck
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
L3UINT Size; /* Size of message in bytes */
|
L3UINT Size; /* Size of message in bytes */
|
||||||
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
||||||
L3UCHAR MesType; /* Message type */
|
L3UCHAR MesType; /* Message type */
|
||||||
L3USHORT CRV; /* Call reference value */
|
L3USHORT CRV; /* Call reference value */
|
||||||
L3UCHAR buf[1]; /* Dynamic buffer */
|
L3UCHAR buf[1]; /* Dynamic buffer */
|
||||||
}Q932mes_HoldAck;
|
}Q932mes_HoldAck;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Struct: Q932ie_HoldReject
|
Struct: Q932ie_HoldReject
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
L3UINT Size; /* Size of message in bytes */
|
L3UINT Size; /* Size of message in bytes */
|
||||||
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
||||||
L3UCHAR MesType; /* Message type */
|
L3UCHAR MesType; /* Message type */
|
||||||
L3USHORT CRV; /* Call reference value */
|
L3USHORT CRV; /* Call reference value */
|
||||||
L3UCHAR buf[1]; /* Dynamic buffer */
|
L3UCHAR buf[1]; /* Dynamic buffer */
|
||||||
}Q932mes_HoldReject;
|
}Q932mes_HoldReject;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Struct: Q932ie_Register
|
Struct: Q932ie_Register
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
L3UINT Size; /* Size of message in bytes */
|
L3UINT Size; /* Size of message in bytes */
|
||||||
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
||||||
L3UCHAR MesType; /* Message type */
|
L3UCHAR MesType; /* Message type */
|
||||||
L3USHORT CRV; /* Call reference value */
|
L3USHORT CRV; /* Call reference value */
|
||||||
L3UCHAR buf[1]; /* Dynamic buffer */
|
L3UCHAR buf[1]; /* Dynamic buffer */
|
||||||
}Q932mes_Register;
|
}Q932mes_Register;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Struct: Q932ie_Retrieve
|
Struct: Q932ie_Retrieve
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
L3UINT Size; /* Size of message in bytes */
|
L3UINT Size; /* Size of message in bytes */
|
||||||
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
||||||
L3UCHAR MesType; /* Message type */
|
L3UCHAR MesType; /* Message type */
|
||||||
L3USHORT CRV; /* Call reference value */
|
L3USHORT CRV; /* Call reference value */
|
||||||
L3UCHAR buf[1]; /* Dynamic buffer */
|
L3UCHAR buf[1]; /* Dynamic buffer */
|
||||||
}Q932mes_Retrieve;
|
}Q932mes_Retrieve;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Struct: Q932ie_RetrieveAck
|
Struct: Q932ie_RetrieveAck
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
L3UINT Size; /* Size of message in bytes */
|
L3UINT Size; /* Size of message in bytes */
|
||||||
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
||||||
L3UCHAR MesType; /* Message type */
|
L3UCHAR MesType; /* Message type */
|
||||||
L3USHORT CRV; /* Call reference value */
|
L3USHORT CRV; /* Call reference value */
|
||||||
L3UCHAR buf[1]; /* Dynamic buffer */
|
L3UCHAR buf[1]; /* Dynamic buffer */
|
||||||
}Q932mes_RetrieveAck;
|
}Q932mes_RetrieveAck;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Struct: Q932ie_RetrieveReject
|
Struct: Q932ie_RetrieveReject
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
L3UINT Size; /* Size of message in bytes */
|
L3UINT Size; /* Size of message in bytes */
|
||||||
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
L3UCHAR ProtDisc; /* Protocol Discriminator */
|
||||||
L3UCHAR MesType; /* Message type */
|
L3UCHAR MesType; /* Message type */
|
||||||
L3USHORT CRV; /* Call reference value */
|
L3USHORT CRV; /* Call reference value */
|
||||||
L3UCHAR buf[1]; /* Dynamic buffer */
|
L3UCHAR buf[1]; /* Dynamic buffer */
|
||||||
}Q932mes_RetrieveReject;
|
}Q932mes_RetrieveReject;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Function Prototypes.
|
Function Prototypes.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
L3INT Q932ProcFacilityTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcFacilityTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcHoldTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcHoldTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcHoldAckTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcHoldAckTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcHoldRejectTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcHoldRejectTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcRegisterTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcRegisterTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcRetrieveTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcRetrieveTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcRetrieveAckTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcRetrieveAckTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcRetrieveRejectTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcRetrieveRejectTE(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
|
|
||||||
L3INT Q932ProcFacilityNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcFacilityNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcHoldNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcHoldNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcHoldAckNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcHoldAckNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcHoldRejectNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcHoldRejectNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcRegisterNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcRegisterNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcRetrieveNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcRetrieveNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcRetrieveAckNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcRetrieveAckNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
L3INT Q932ProcRetrieveRejectNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
L3INT Q932ProcRetrieveRejectNT(Q931_TrunkInfo *pTrunk, L3UCHAR * b, L3INT iFrom);
|
||||||
|
|
||||||
L3INT Q932Pmes_Facility(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
L3INT Q932Pmes_Facility(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
||||||
L3INT Q932Pmes_Hold(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
L3INT Q932Pmes_Hold(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
||||||
L3INT Q932Pmes_HoldAck(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
L3INT Q932Pmes_HoldAck(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
||||||
L3INT Q932Pmes_HoldReject(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
L3INT Q932Pmes_HoldReject(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
||||||
L3INT Q932Pmes_Register(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
L3INT Q932Pmes_Register(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
||||||
L3INT Q932Pmes_Retrieve(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
L3INT Q932Pmes_Retrieve(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
||||||
L3INT Q932Pmes_RetrieveAck(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
L3INT Q932Pmes_RetrieveAck(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
||||||
L3INT Q932Pmes_RetrieveReject(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
L3INT Q932Pmes_RetrieveReject(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
|
||||||
|
|
||||||
L3INT Q932Umes_Facility(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
L3INT Q932Umes_Facility(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
||||||
L3INT Q932Umes_Hold(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
L3INT Q932Umes_Hold(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
||||||
L3INT Q932Umes_HoldAck(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
L3INT Q932Umes_HoldAck(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
||||||
L3INT Q932Umes_HoldReject(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
L3INT Q932Umes_HoldReject(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
||||||
L3INT Q932Umes_Register(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
L3INT Q932Umes_Register(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
||||||
L3INT Q932Umes_Retrieve(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
L3INT Q932Umes_Retrieve(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
||||||
L3INT Q932Umes_RetrieveAck(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
L3INT Q932Umes_RetrieveAck(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
||||||
L3INT Q932Umes_RetrieveReject(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
L3INT Q932Umes_RetrieveReject(Q931_TrunkInfo *pTrunk, L3UCHAR *IBuf, L3UCHAR * OBuf, L3INT I, L3INT O);
|
||||||
|
|
|
@ -1,83 +1,83 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Filename: mfifo.h
|
Filename: mfifo.h
|
||||||
|
|
||||||
Contents: header for MFIFO
|
Contents: header for MFIFO
|
||||||
|
|
||||||
License/Copyright:
|
License/Copyright:
|
||||||
|
|
||||||
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
||||||
email:janvb@caselaboratories.com
|
email:janvb@caselaboratories.com
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
modification, are permitted provided that the following conditions are
|
||||||
met:
|
met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
this list of conditions and the following disclaimer.
|
this list of conditions and the following disclaimer.
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
* Neither the name of the Case Labs, Ltd nor the names of its contributors
|
* 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
|
may be used to endorse or promote products derived from this software
|
||||||
without specific prior written permission.
|
without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
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
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifndef _MFIFO
|
#ifndef _MFIFO
|
||||||
#define _MFIFO
|
#define _MFIFO
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Struct: MINDEX
|
Struct: MINDEX
|
||||||
|
|
||||||
Description: Message Index used to index a dynamic size Message FIFO.
|
Description: Message Index used to index a dynamic size Message FIFO.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct _mindex
|
typedef struct _mindex
|
||||||
{
|
{
|
||||||
int offset; /* offset to message in buf */
|
int offset; /* offset to message in buf */
|
||||||
int size; /* size of message in bytes */
|
int size; /* size of message in bytes */
|
||||||
}MINDEX;
|
}MINDEX;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Struct: MFIFO
|
Struct: MFIFO
|
||||||
|
|
||||||
Description: Message FIFO. Provides a dynamic sized message based FIFO
|
Description: Message FIFO. Provides a dynamic sized message based FIFO
|
||||||
queue.
|
queue.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct _mfifo
|
typedef struct _mfifo
|
||||||
{
|
{
|
||||||
int first; /* first out */
|
int first; /* first out */
|
||||||
int last; /* last in + 1 */
|
int last; /* last in + 1 */
|
||||||
int bsize; /* buffer size */
|
int bsize; /* buffer size */
|
||||||
unsigned char *buf; /* ptr to start of buffer */
|
unsigned char *buf; /* ptr to start of buffer */
|
||||||
int ixsize; /* index size */
|
int ixsize; /* index size */
|
||||||
MINDEX ix[1]; /* message index */
|
MINDEX ix[1]; /* message index */
|
||||||
}MFIFO;
|
}MFIFO;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Function prototypes.
|
Function prototypes.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int MFIFOCreate(unsigned char *buf, int size, int index);
|
int MFIFOCreate(unsigned char *buf, int size, int index);
|
||||||
void MFIFOClear(unsigned char * buf);
|
void MFIFOClear(unsigned char * buf);
|
||||||
int MFIFOGetLBOffset(unsigned char *buf);
|
int MFIFOGetLBOffset(unsigned char *buf);
|
||||||
int MFIFOGetFBOffset(unsigned char *buf);
|
int MFIFOGetFBOffset(unsigned char *buf);
|
||||||
void MFIFOWriteIX(unsigned char *buf, unsigned char *mes, int size, int ix, int off);
|
void MFIFOWriteIX(unsigned char *buf, unsigned char *mes, int size, int ix, int off);
|
||||||
int MFIFOWriteMes(unsigned char *buf, unsigned char *mes, int size);
|
int MFIFOWriteMes(unsigned char *buf, unsigned char *mes, int size);
|
||||||
unsigned char * MFIFOGetMesPtr(unsigned char *buf, int *size);
|
unsigned char * MFIFOGetMesPtr(unsigned char *buf, int *size);
|
||||||
void MFIFOKillNext(unsigned char *buf);
|
void MFIFOKillNext(unsigned char *buf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,296 +1,296 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Filename: mfifo.c
|
Filename: mfifo.c
|
||||||
|
|
||||||
Description: mfifo is a message orriented fifo system with support of
|
Description: mfifo is a message orriented fifo system with support of
|
||||||
both message and byte per byte retriaval of messages.
|
both message and byte per byte retriaval of messages.
|
||||||
|
|
||||||
The fifo has been designed with two usages in mind:
|
The fifo has been designed with two usages in mind:
|
||||||
|
|
||||||
- Queueing of frames for hdlc and feeding out byte per byte
|
- Queueing of frames for hdlc and feeding out byte per byte
|
||||||
with the possibility of re-sending of frames etc.
|
with the possibility of re-sending of frames etc.
|
||||||
|
|
||||||
- fifo for messages of dynamic size.
|
- fifo for messages of dynamic size.
|
||||||
|
|
||||||
The fifo is allocated on top of any buffer and creates an
|
The fifo is allocated on top of any buffer and creates an
|
||||||
index of message in the queue. The user can write/read
|
index of message in the queue. The user can write/read
|
||||||
messages or write messages and read the message one byte
|
messages or write messages and read the message one byte
|
||||||
at the time.
|
at the time.
|
||||||
|
|
||||||
Interface:
|
Interface:
|
||||||
MFIFOCreate Create/reset/initialize fifo.
|
MFIFOCreate Create/reset/initialize fifo.
|
||||||
MFIFOClear Clear FIFO.
|
MFIFOClear Clear FIFO.
|
||||||
MFIFOWriteMes Write message into fifo
|
MFIFOWriteMes Write message into fifo
|
||||||
* MFIFOReadMes Read message from fifo.
|
* MFIFOReadMes Read message from fifo.
|
||||||
MFIFOGetMesPtr Get ptr to next message.
|
MFIFOGetMesPtr Get ptr to next message.
|
||||||
MFIFOKillNext Kill next message.
|
MFIFOKillNext Kill next message.
|
||||||
|
|
||||||
* currently not implemented.
|
* currently not implemented.
|
||||||
|
|
||||||
Note: The message will always be saved continuously. If there is not
|
Note: The message will always be saved continuously. If there is not
|
||||||
sufficient space at the end of the buffer, the fifo will skip
|
sufficient space at the end of the buffer, the fifo will skip
|
||||||
the last bytes and save the message at the top of the buffer.
|
the last bytes and save the message at the top of the buffer.
|
||||||
|
|
||||||
This is required to allow direct ptr access to messages
|
This is required to allow direct ptr access to messages
|
||||||
stored in the queue.
|
stored in the queue.
|
||||||
|
|
||||||
License/Copyright:
|
License/Copyright:
|
||||||
|
|
||||||
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
|
||||||
email:janvb@caselaboratories.com
|
email:janvb@caselaboratories.com
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
modification, are permitted provided that the following conditions are
|
||||||
met:
|
met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
this list of conditions and the following disclaimer.
|
this list of conditions and the following disclaimer.
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
* Neither the name of the Case Labs, Ltd nor the names of its contributors
|
* 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
|
may be used to endorse or promote products derived from this software
|
||||||
without specific prior written permission.
|
without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
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
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "mfifo.h"
|
#include "mfifo.h"
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: MFIFOCreate
|
Function: MFIFOCreate
|
||||||
|
|
||||||
Description: Creates a fifo on top of an existing buffer.
|
Description: Creates a fifo on top of an existing buffer.
|
||||||
|
|
||||||
Parameters: buf ptr to buffer.
|
Parameters: buf ptr to buffer.
|
||||||
size size of buffer in bytes.
|
size size of buffer in bytes.
|
||||||
index size of index entries (max no messages).
|
index size of index entries (max no messages).
|
||||||
|
|
||||||
Return value: 0 if failure, 1 if ok.
|
Return value: 0 if failure, 1 if ok.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int MFIFOCreate(unsigned char *buf, int size, int index)
|
int MFIFOCreate(unsigned char *buf, int size, int index)
|
||||||
{
|
{
|
||||||
MFIFO * mf;
|
MFIFO * mf;
|
||||||
mf = (MFIFO*)buf;
|
mf = (MFIFO*)buf;
|
||||||
|
|
||||||
mf->first = mf->last = 0;
|
mf->first = mf->last = 0;
|
||||||
mf->ixsize = index;
|
mf->ixsize = index;
|
||||||
mf->buf = &buf[sizeof(MFIFO) + (sizeof(MINDEX) * (index-1))];
|
mf->buf = &buf[sizeof(MFIFO) + (sizeof(MINDEX) * (index-1))];
|
||||||
|
|
||||||
if(mf->buf > & buf[size])
|
if(mf->buf > & buf[size])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
mf->bsize = size - sizeof(MFIFO) - (sizeof(MINDEX) * (index-1));
|
mf->bsize = size - sizeof(MFIFO) - (sizeof(MINDEX) * (index-1));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: MFIFOClear
|
Function: MFIFOClear
|
||||||
|
|
||||||
Description: Clear the FIFO
|
Description: Clear the FIFO
|
||||||
|
|
||||||
Paremeters: buf ptr to fifo
|
Paremeters: buf ptr to fifo
|
||||||
|
|
||||||
Return Value: none
|
Return Value: none
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void MFIFOClear(unsigned char * buf)
|
void MFIFOClear(unsigned char * buf)
|
||||||
{
|
{
|
||||||
MFIFO * mf;
|
MFIFO * mf;
|
||||||
mf = (MFIFO*)buf;
|
mf = (MFIFO*)buf;
|
||||||
mf->first = mf->last = 0;
|
mf->first = mf->last = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: MFIFOGetLBOffset
|
Function: MFIFOGetLBOffset
|
||||||
|
|
||||||
Description: Helper function caclulating offset to the 'first out' byte.
|
Description: Helper function caclulating offset to the 'first out' byte.
|
||||||
|
|
||||||
Paremeters: buf ptr to fifo
|
Paremeters: buf ptr to fifo
|
||||||
|
|
||||||
Return Value: offset.
|
Return Value: offset.
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int MFIFOGetLBOffset(unsigned char *buf)
|
int MFIFOGetLBOffset(unsigned char *buf)
|
||||||
{
|
{
|
||||||
MFIFO * mf;
|
MFIFO * mf;
|
||||||
mf = (MFIFO*)buf;
|
mf = (MFIFO*)buf;
|
||||||
if(mf->last != mf->first)
|
if(mf->last != mf->first)
|
||||||
return mf->ix[mf->last].offset;
|
return mf->ix[mf->last].offset;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: MFIFOGetFBOffset
|
Function: MFIFOGetFBOffset
|
||||||
|
|
||||||
Description: Helper function calculating the offset to the 'first in'
|
Description: Helper function calculating the offset to the 'first in'
|
||||||
byte in the buffer. This is the position the next byte
|
byte in the buffer. This is the position the next byte
|
||||||
entering the fifo will occupy.
|
entering the fifo will occupy.
|
||||||
|
|
||||||
Paremeters: buf ptr to fifo
|
Paremeters: buf ptr to fifo
|
||||||
|
|
||||||
Return Value: offset
|
Return Value: offset
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int MFIFOGetFBOffset(unsigned char *buf)
|
int MFIFOGetFBOffset(unsigned char *buf)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
MFIFO * mf;
|
MFIFO * mf;
|
||||||
mf = (MFIFO*)buf;
|
mf = (MFIFO*)buf;
|
||||||
if(mf->last == mf->first)
|
if(mf->last == mf->first)
|
||||||
return 0;
|
return 0;
|
||||||
x=mf->first;
|
x=mf->first;
|
||||||
x--;
|
x--;
|
||||||
if(x<0)
|
if(x<0)
|
||||||
x=mf->ixsize;
|
x=mf->ixsize;
|
||||||
return mf->ix[x].offset + mf->ix[x].size;
|
return mf->ix[x].offset + mf->ix[x].size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: MFIFOWriteIX
|
Function: MFIFOWriteIX
|
||||||
|
|
||||||
Description: Helper function writing a calculated entry. The function
|
Description: Helper function writing a calculated entry. The function
|
||||||
will perform a memcpy to move the message and set the index
|
will perform a memcpy to move the message and set the index
|
||||||
values as well as increase the 'first in' index.
|
values as well as increase the 'first in' index.
|
||||||
|
|
||||||
Paremeters: buf ptr to fifo
|
Paremeters: buf ptr to fifo
|
||||||
mes ptr to message
|
mes ptr to message
|
||||||
size size of message in bytes.
|
size size of message in bytes.
|
||||||
ix index to index entry.
|
ix index to index entry.
|
||||||
off offset to position to receive the message
|
off offset to position to receive the message
|
||||||
|
|
||||||
Return Value: none
|
Return Value: none
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void MFIFOWriteIX(unsigned char *buf, unsigned char *mes, int size, int ix, int off)
|
void MFIFOWriteIX(unsigned char *buf, unsigned char *mes, int size, int ix, int off)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
MFIFO * mf;
|
MFIFO * mf;
|
||||||
mf = (MFIFO*)buf;
|
mf = (MFIFO*)buf;
|
||||||
memcpy(&mf->buf[off],mes,size);
|
memcpy(&mf->buf[off],mes,size);
|
||||||
mf->ix[ix].offset=off;
|
mf->ix[ix].offset=off;
|
||||||
mf->ix[ix].size=size;
|
mf->ix[ix].size=size;
|
||||||
x = mf->first+1;
|
x = mf->first+1;
|
||||||
if(x > mf->ixsize)
|
if(x > mf->ixsize)
|
||||||
x=0;
|
x=0;
|
||||||
mf->first=x;
|
mf->first=x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: MFIFOWriteMes
|
Function: MFIFOWriteMes
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
|
|
||||||
Paremeters:
|
Paremeters:
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int MFIFOWriteMes(unsigned char *buf, unsigned char *mes, int size)
|
int MFIFOWriteMes(unsigned char *buf, unsigned char *mes, int size)
|
||||||
{
|
{
|
||||||
int of,ol,x;
|
int of,ol,x;
|
||||||
MFIFO * mf;
|
MFIFO * mf;
|
||||||
mf = (MFIFO*)buf;
|
mf = (MFIFO*)buf;
|
||||||
|
|
||||||
x = mf->first+1;
|
x = mf->first+1;
|
||||||
if(x > mf->ixsize)
|
if(x > mf->ixsize)
|
||||||
x=0;
|
x=0;
|
||||||
if(x == mf->last)
|
if(x == mf->last)
|
||||||
return 0; /* full queue */
|
return 0; /* full queue */
|
||||||
|
|
||||||
of = MFIFOGetFBOffset(buf);
|
of = MFIFOGetFBOffset(buf);
|
||||||
ol = MFIFOGetLBOffset(buf);
|
ol = MFIFOGetLBOffset(buf);
|
||||||
if(mf->last == mf->first) /* empty queue */
|
if(mf->last == mf->first) /* empty queue */
|
||||||
{
|
{
|
||||||
mf->first = mf->last = 0; /* optimize */
|
mf->first = mf->last = 0; /* optimize */
|
||||||
MFIFOWriteIX(buf, mes, size, mf->first, 0);
|
MFIFOWriteIX(buf, mes, size, mf->first, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if(of > ol)
|
else if(of > ol)
|
||||||
{
|
{
|
||||||
if(mf->bsize - of >= size)
|
if(mf->bsize - of >= size)
|
||||||
{
|
{
|
||||||
MFIFOWriteIX(buf,mes,size,mf->first,of);
|
MFIFOWriteIX(buf,mes,size,mf->first,of);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if(ol > size)
|
else if(ol > size)
|
||||||
{
|
{
|
||||||
MFIFOWriteIX(buf,mes,size,mf->first,ol);
|
MFIFOWriteIX(buf,mes,size,mf->first,ol);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ol - of > size)
|
else if(ol - of > size)
|
||||||
{
|
{
|
||||||
MFIFOWriteIX(buf,mes,size,mf->first,of);
|
MFIFOWriteIX(buf,mes,size,mf->first,of);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: MFIFOGetMesPtr
|
Function: MFIFOGetMesPtr
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
|
|
||||||
Paremeters:
|
Paremeters:
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
unsigned char * MFIFOGetMesPtr(unsigned char *buf, int *size)
|
unsigned char * MFIFOGetMesPtr(unsigned char *buf, int *size)
|
||||||
{
|
{
|
||||||
MFIFO * mf;
|
MFIFO * mf;
|
||||||
mf = (MFIFO*)buf;
|
mf = (MFIFO*)buf;
|
||||||
if(mf->first==mf->last)
|
if(mf->first==mf->last)
|
||||||
return NULL;
|
return NULL;
|
||||||
*size = mf->ix[mf->last].size;
|
*size = mf->ix[mf->last].size;
|
||||||
return &mf->buf[mf->ix[mf->last].offset];
|
return &mf->buf[mf->ix[mf->last].offset];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Function: MFIFOKillNext
|
Function: MFIFOKillNext
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
|
|
||||||
Paremeters:
|
Paremeters:
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void MFIFOKillNext(unsigned char *buf)
|
void MFIFOKillNext(unsigned char *buf)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
MFIFO * mf;
|
MFIFO * mf;
|
||||||
mf = (MFIFO*)buf;
|
mf = (MFIFO*)buf;
|
||||||
if(mf->first!=mf->last)
|
if(mf->first!=mf->last)
|
||||||
{
|
{
|
||||||
x = mf->last+1;
|
x = mf->last+1;
|
||||||
if(x > mf->ixsize)
|
if(x > mf->ixsize)
|
||||||
x=0;
|
x=0;
|
||||||
mf->last=x;
|
mf->last=x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue