libisdn
Q931.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "Q921.h"
#include "Q931.h"
#include "Q931priv.h"
#include "Q931call.h"
#include <assert.h>

Go to the source code of this file.

Defines

#define Q931_MAX_ERROR   32
#define Q931_TRUNK_FLAG_SET_FUNC(_name, _flag)
#define Q931_TRUNK_FLAG_GET_FUNC(_name, _flag)

Functions

void Q931SetL4HeaderSpace (L3INT space)
void Q931SetL2HeaderSpace (L3INT space)
L3INT Q931ProcDummy (Q931_TrunkInfo_t *trunk, struct Q931_Call *call, Q931mes_Generic *msg, q931_msg_from_t from)
L3INT Q931UmesDummy (Q931_TrunkInfo_t *trunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size, struct Q931MesgErrors *errs)
L3INT Q931UieDummy (Q931_TrunkInfo_t *trunk, Q931mes_Generic *msg, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff)
L3INT Q931PmesDummy (Q931_TrunkInfo_t *trunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
L3INT Q931PieDummy (Q931_TrunkInfo_t *trunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet)
Q931_API void Q931Initialize (void)
Q931_API void Q931TimerTick (Q931_TrunkInfo_t *trunk)
Q931_API L3INT Q931Rx23 (Q931_TrunkInfo_t *trunk, L3INT ind, L3UCHAR tei, L3UCHAR *buf, L3INT Size)
L3INT Q931Tx34 (Q931_TrunkInfo_t *trunk, struct Q931_Call *call, Q931mes_Generic *msg, int size)
Q931_API L3INT Q931Rx43 (Q931_TrunkInfo_t *trunk, Q931mes_Generic *msg, int size)
L3INT Q931Tx32 (Q931_TrunkInfo_t *trunk, L3UCHAR bcast, Q931mes_Generic *msg, int size)
void Q931SetError (Q931_TrunkInfo_t *trunk, L3INT ErrID, L3INT ErrPar1, L3INT ErrPar2)
Q931_API L3INT Q931ReleaseCRV (Q931_TrunkInfo_t *trunk, L3INT crv)
L3ULONG Q931GetTime ()
Q931_API void Q931SetGetTimeCB (L3ULONG(*callback)(void))
Q931_API const char * q931_error_to_name (q931_error_t error)
L3INT Q931Log (const Q931_TrunkInfo_t *trunk, Q931LogLevel_t level, const char *fmt,...)
L3INT Q931LogRaw (const Q931_TrunkInfo_t *trunk, Q931LogLevel_t level, const char *str)
Q931_API void Q931SetLogCB (Q931_TrunkInfo_t *trunk, Q931LogCB_t func, void *priv)
Q931_API void Q931SetLogLevel (Q931_TrunkInfo_t *trunk, Q931LogLevel_t level)
Q931_API Q931LogLevel_t Q931GetLogLevel (Q931_TrunkInfo_t *trunk)
Q931_API const char * Q931GetLogLevelName (Q931_TrunkInfo_t *trunk)
L3INT Q931TimeoutDummy (Q931_TrunkInfo_t *trunk, struct Q931_Call *call)
void Q931TrunkSetFlag (Q931_TrunkInfo_t *trunk, L3INT flag)
void Q931TrunkClearFlag (Q931_TrunkInfo_t *trunk, L3INT flag)
void Q931TrunkClearAllFlags (Q931_TrunkInfo_t *trunk)
L3BOOL Q931TrunkIsSetFlag (const Q931_TrunkInfo_t *trunk, const L3INT flag)
Q931_API void Q931TrunkSetRelaxedMode (Q931_TrunkInfo_t *trunk, L3BOOL enable)
L3INT Q931Proc (Q931_TrunkInfo_t *trunk, struct Q931_Call *call, Q931mes_Generic *msg, q931_msg_from_t from)
L3INT Q931ProcInvalid (Q931_TrunkInfo_t *trunk, struct Q931_Call *call, Q931mes_Generic *msg, q931_msg_from_t from)
L3INT Q931Umes (Q931_TrunkInfo_t *trunk, L3UCHAR id, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size, struct Q931MesgErrors *errs)
L3INT Q931Pmes (Q931_TrunkInfo_t *trunk, L3UCHAR id, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
L3INT Q931Uie (Q931_TrunkInfo_t *trunk, L3UCHAR id, Q931mes_Generic *pMes, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff)
L3INT Q931Pie (Q931_TrunkInfo_t *trunk, L3UCHAR id, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet)
L3INT Q931Die (Q931_TrunkInfo_t *trunk, Q931ie_Generic *ie, struct strstream *ostream)
L3BOOL Q931UieIsNull (Q931_TrunkInfo_t *trunk, L3UCHAR id)
L3BOOL Q931PieIsNull (Q931_TrunkInfo_t *trunk, L3UCHAR id)
L3BOOL Q931DieIsNull (Q931_TrunkInfo_t *trunk, L3UCHAR id)
L3INT Q931Timeout (Q931_TrunkInfo_t *trunk, struct Q931_Call *call, L3UCHAR timer)
L3INT Q931ProcUnknownMessage (Q931_TrunkInfo_t *trunk, struct Q931_Call *call, Q931mes_Generic *msg, q931_msg_from_t from)
L3INT Q931ProcUnexpectedMessage (Q931_TrunkInfo_t *trunk, struct Q931_Call *call, Q931mes_Generic *msg, q931_msg_from_t from)

Variables

L3INT Q931L4HeaderSpace = {0}
L3INT Q931L2HeaderSpace = {4}
L3ULONG(* Q931GetTimeProc )(void) = NULL

Define Documentation

#define Q931_MAX_ERROR   32

Definition at line 724 of file Q931.c.

Referenced by q931_error_to_name().

#define Q931_TRUNK_FLAG_GET_FUNC (   _name,
  _flag 
)
Value:
Q931_API L3BOOL _name(Q931_TrunkInfo_t *trunk) {        \
                assert(trunk);                                  \
                return Q931TrunkIsSetFlag(trunk, _flag);        \
        }

Macro used for mass-defining flag get functions

Parameters:
[in]_nameName of flag
[in]_flagValue of flag

Definition at line 962 of file Q931.c.

#define Q931_TRUNK_FLAG_SET_FUNC (   _name,
  _flag 
)
Value:
Q931_API void _name(Q931_TrunkInfo_t *trunk, L3BOOL enable) {   \
                assert(trunk);                                  \
                if (enable) {                                   \
                        Q931TrunkSetFlag(trunk, _flag);         \
                } else {                                        \
                        Q931TrunkClearFlag(trunk, _flag);       \
                }                                               \
        }

Macro used for mass-defining flag set functions

Parameters:
[in]_nameName of flag
[in]_flagValue of flag

Definition at line 946 of file Q931.c.


Function Documentation

Q931_API const char* q931_error_to_name ( q931_error_t  error)

Return description of error code

Parameters:
[in]errorError code
Returns:
Description of error code or empty string on error

Definition at line 731 of file Q931.c.

References Q931_MAX_ERROR.

L3INT Q931Die ( Q931_TrunkInfo_t trunk,
Q931ie_Generic ie,
struct strstream ostream 
)

Invoke IE specific debug function

Parameters:
[in]trunkQ.931 trunk
[in]iePointer to Information Element
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 1189 of file Q931.c.

References Q931_TrunkInfo::Dialect, Q931ie_Generic::IEId, Q931DialectGetDieProc(), and Q931E_INTERNAL.

Referenced by Q931Dmes_Generic().

Check whether information element has a debug function available

Parameters:
[in]trunkQ.931 trunk
[in]idInformation element id to check
Returns:
Q931_FALSE if this IE can be handled or Q931_TRUE if it can not

Definition at line 1233 of file Q931.c.

References Q931_TrunkInfo::Dialect, and Q931DialectGetDieProc().

Referenced by Q931Dmes_Generic().

Get log level

Parameters:
[in]trunkQ.931 trunk
Returns:
current log level set on trunk

Definition at line 836 of file Q931.c.

References Q931_TrunkInfo::loglevel, and Q931_LOG_NONE.

Q931_API const char* Q931GetLogLevelName ( Q931_TrunkInfo_t trunk)

Get name of log level set on trunk

Parameters:
[in]trunkQ.931 trunk
Todo:
Make this a generic function e.g.: const char *Q931GetLogLevelName(q931_loglevel_t level)

Definition at line 865 of file Q931.c.

References Q931_TrunkInfo::loglevel, and Q931_LOG_NONE.

L3ULONG Q931GetTime ( void  )

Get current time in milliseconds

Returns:
time in milliseconds

Definition at line 654 of file Q931.c.

References L3ULONG, and Q931GetTimeProc.

Referenced by Q931CallRestartTimer(), Q931CallStartTimer(), and Q931TimerTick().

Q931_API void Q931Initialize ( void  )

Initialize Q.931 stack

Note:
Call once before using any other function!

Definition at line 178 of file Q931.c.

References ATT5ESSCreateTE(), Q931_Dialect_5ESS, Q931_Dialect_Q931, Q931_NT, Q931_TE, Q931CreateNT(), Q931CreateTE(), Q931DialectRegister(), and Q931DialectRegistryInit().

L3INT Q931Log ( const Q931_TrunkInfo_t trunk,
Q931LogLevel_t  level,
const char *  fmt,
  ... 
)

Log formatted string

Parameters:
[in]trunkQ.931 trunk
[in]levelLog level of message
[in]fmtFormat string
[in]...Optional arguments
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 758 of file Q931.c.

References L3INT, Q931_TrunkInfo::loglevel, Q931_TrunkInfo::PrivateDataLog, Q931_LOGBUFSIZE, and Q931_TrunkInfo::Q931LogCBProc.

Referenced by Q931CallDump(), Q931CallNew(), Q931CallRestartTimer(), Q931CallSendEvent(), Q931CallSetState(), Q931CallStartTimer(), Q931CallStopAllTimers(), Q931CallStopTimer(), Q931Die_CalledSub(), Q931DumpAllCalls(), Q931MesgErrorsPrint(), Q931MesgHeader(), Q931Pie_BearerCap(), Q931Pmes_Generic(), Q931Proc(), Q931ProcAlertingNT(), Q931ProcCallProceedingNT(), Q931ProcConnectAckNT(), Q931ProcConnectNT(), Q931ProcDisconnectNT(), Q931ProcDisconnectTE(), Q931ProcProgressNT(), Q931ProcResumeAckNT(), Q931ProcResumeRejectNT(), Q931ProcSetupAckNT(), Q931ProcSetupNT(), Q931ProcSetupTE(), Q931ProcSuspendAckNT(), Q931ProcSuspendNT(), Q931ProcSuspendRejectNT(), Q931ProcTimeoutT301NT(), Q931ProcTimeoutT301TE(), Q931ProcTimeoutT302NT(), Q931ProcTimeoutT302TE(), Q931ProcTimeoutT303NT(), Q931ProcTimeoutT303TE(), Q931ProcTimeoutT304NT(), Q931ProcTimeoutT304TE(), Q931ProcTimeoutT305NT(), Q931ProcTimeoutT305TE(), Q931ProcTimeoutT306NT(), Q931ProcTimeoutT307NT(), Q931ProcTimeoutT308NT(), Q931ProcTimeoutT308TE(), Q931ProcTimeoutT309NT(), Q931ProcTimeoutT309TE(), Q931ProcTimeoutT310NT(), Q931ProcTimeoutT310TE(), Q931ProcTimeoutT311TE(), Q931ProcTimeoutT312NT(), Q931ProcTimeoutT313NT(), Q931ProcTimeoutT313TE(), Q931ProcTimeoutT314NT(), Q931ProcTimeoutT314TE(), Q931ProcTimeoutT316NT(), Q931ProcTimeoutT316TE(), Q931ProcTimeoutT317NT(), Q931ProcTimeoutT317TE(), Q931ProcTimeoutT318TE(), Q931ProcTimeoutT319TE(), Q931ProcTimeoutT320NT(), Q931ProcTimeoutT321NT(), Q931ProcTimeoutT321TE(), Q931ProcTimeoutT322NT(), Q931ProcTimeoutT322TE(), Q931ProcUnexpectedMessage(), Q931ProcUnknownMessage(), Q931Rx23(), Q931Rx43(), Q931TimeoutDummy(), Q931TimerTick(), Q931Tx32(), Q931Tx34(), Q931Uie_ChanID(), Q931Uie_Generic(), and Q931Umes_Generic().

L3INT Q931LogRaw ( const Q931_TrunkInfo_t trunk,
Q931LogLevel_t  level,
const char *  str 
)
L3INT Q931Pie ( Q931_TrunkInfo_t trunk,
L3UCHAR  id,
L3UCHAR IBuf,
L3UCHAR OBuf,
L3INT Octet 
)

Invoke IE specific encoder function

Parameters:
[in]trunkQ.931 trunk
[in]idID of information element (type)
[in]IBufInput buffer
[out]OBufOutput buffer
[in,out]OctetInput buffer offset
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 1171 of file Q931.c.

References Q931_TrunkInfo::Dialect, Q931DialectGetPieProc(), and Q931E_INTERNAL.

Referenced by Q931Pmes_Generic().

L3INT Q931PieDummy ( Q931_TrunkInfo_t trunk,
L3UCHAR IBuf,
L3UCHAR OBuf,
L3INT Octet 
)

Dummy function for IE encoding.

Parameters:
[in]trunkQ.931 trunk
[in]IBufMessage input buffer
[out]OBufMessage output buffer (encoded IE)
[out]OctetOutput buffer offset
Returns:
always returns Q931E_UNKNOWN_IE (unhandled IE)

Definition at line 167 of file Q931.c.

References Q931E_UNKNOWN_IE.

Check whether information element has a encoder function available

Parameters:
[in]trunkQ.931 trunk
[in]idInformation element id to check
Returns:
Q931_FALSE if this IE can be handled or Q931_TRUE if it can not

Definition at line 1220 of file Q931.c.

References Q931_TrunkInfo::Dialect, and Q931DialectGetPieProc().

Referenced by Q931Pmes_Generic().

L3INT Q931Pmes ( Q931_TrunkInfo_t trunk,
L3UCHAR  id,
Q931mes_Generic IBuf,
L3INT  ISize,
L3UCHAR OBuf,
L3INT OSize 
)

Invoke message specific encoder function

Parameters:
[in]trunkQ.931 trunk
[in]idID of message (type)
[in]IBufInput buffer
[in]ISizeSize of input message
[out]OBufOutput buffer
[out]OSizeOutput message size
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 1125 of file Q931.c.

References Q931_TrunkInfo::Dialect, Q931DialectGetPmesProc(), and Q931E_INTERNAL.

Referenced by Q931Tx32().

L3INT Q931PmesDummy ( Q931_TrunkInfo_t trunk,
Q931mes_Generic IBuf,
L3INT  ISize,
L3UCHAR OBuf,
L3INT OSize 
)

Dummy function for message encoding.

Parameters:
[in]trunkQ.931 trunk
[in]IBufMessage input buffer
[in]ISizeInput message size
[out]OBufMessage output buffer
[out]OSizeOutput message size
Returns:
always returns Q931E_UNKNOWN_MESSAGE (unhandled message)

Definition at line 152 of file Q931.c.

References Q931E_UNKNOWN_MESSAGE.

L3INT Q931Proc ( Q931_TrunkInfo_t trunk,
struct Q931_Call call,
Q931mes_Generic msg,
q931_msg_from_t  from 
)

Invoke message specific handler function

Parameters:
[in]trunkQ.931 trunk
[in]callQ.931 call handle
[in]msgDecoded message to handle (Q931mes_Generic *)
[in]fromSource of message (Q931_MSG_FROM_L2 or Q931_MSG_FROM_L4)
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 1020 of file Q931.c.

References Q931_TrunkInfo::Dialect, L3INT, Q931mes_Generic::MesType, Q931_LOG_ERROR, Q931_TFLAG_IGNORE_UNKNOWN_MSG, Q931CallGetCRV(), Q931CallGetState(), Q931CallGetStateName(), Q931DialectGetMesProc(), Q931DialectGetUnknownMesProc(), Q931DialectIsEventLegal(), Q931E_INTERNAL, Q931E_NO_ERROR, Q931E_UNEXPECTED_MESSAGE, Q931Log(), and Q931TrunkIsSetFlag().

Referenced by Q931AckRestart(), Q931AckService(), Q931AckSetup(), Q931Rx23(), Q931Rx43(), and Q931Start().

L3INT Q931ProcDummy ( Q931_TrunkInfo_t trunk,
struct Q931_Call call,
Q931mes_Generic msg,
q931_msg_from_t  from 
)

Dummy function for message processing.

Parameters:
[in]trunkQ.931 trunk
[in]callQ.931 call handle
[in]msgMessage
[in]fromMessage coming from Layer 2 or Layer 4?
Returns:
always returns Q931E_INTERNAL (Unhandled message)

Definition at line 102 of file Q931.c.

References Q931E_INTERNAL.

L3INT Q931ProcInvalid ( Q931_TrunkInfo_t trunk,
struct Q931_Call call,
Q931mes_Generic msg,
q931_msg_from_t  from 
)

Invoke invalid message handling function

Parameters:
[in]trunkQ.931 trunk
[in]callQ.931 call handle
[in]msgDecoded message to handle (Q931mes_Generic *)
[in]fromSource of message (Q931_MSG_FROM_L2 or Q931_MSG_FROM_L4)
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 1069 of file Q931.c.

References Q931_TrunkInfo::Dialect, Q931DialectGetInvalidMesProc(), and Q931E_INTERNAL.

L3INT Q931ProcUnexpectedMessage ( Q931_TrunkInfo_t trunk,
struct Q931_Call call,
Q931mes_Generic msg,
q931_msg_from_t  from 
)

Handle unexpected message

Parameters:
[in]trunkQ.931 trunk
[in]callQ.931 call handle
[in]msgInput buffer (Q931mes_Generic *)
[in]fromSource of message (Q931_MSG_FROM_L2 or Q931_MSG_FROM_L4)
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 1284 of file Q931.c.

References Q931mes_Generic::MesType, Q931_LOG_NOTICE, Q931E_NO_ERROR, and Q931Log().

Referenced by ATT5ESSCreateTE(), Q931CreateNT(), and Q931CreateTE().

L3INT Q931ProcUnknownMessage ( Q931_TrunkInfo_t trunk,
struct Q931_Call call,
Q931mes_Generic msg,
q931_msg_from_t  from 
)

Handle unknown message

Parameters:
[in]trunkQ.931 trunk
[in]callQ.931 call handle
[in]msgInput buffer (Q931mes_Generic *)
[in]fromSource of message (Q931_MSG_FROM_L2 or Q931_MSG_FROM_L4)
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 1268 of file Q931.c.

References Q931mes_Generic::MesType, Q931_LOG_NOTICE, Q931E_NO_ERROR, and Q931Log().

Referenced by ATT5ESSCreateTE(), Q931CreateNT(), and Q931CreateTE().

Release a CRV (= call)

Parameters:
[in]trunkQ.931 trunk
[in]crvCRV to release
Returns:
Q931E_NO_ERROR on success, Q931E_INVALID_CRV if call does not exist

Definition at line 635 of file Q931.c.

References Q931_Call::InUse, Q931E_INVALID_CRV, Q931E_NO_ERROR, and Q931GetCallByCRV().

Q931_API L3INT Q931Rx23 ( Q931_TrunkInfo_t trunk,
L3INT  ind,
L3UCHAR  tei,
L3UCHAR buf,
L3INT  Size 
)

Receive message from Q.921 (Layer 2) stack

Parameters:
[in]trunkQ.931 trunk
[in]indType of Q.921 message: Q921_DL_UNIT_DATA, Q921_DL_DATA
[in]teiTEI this message is coming in on
[in]bufMessage buffer
[in]SizeSize of message
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 267 of file Q931.c.

References Q931mes_Generic::buf, Q931mes_Generic::CRV, Q931mes_Generic::CRVFlag, Q931_TrunkInfo::Dialect, Q931_CallEvent::id, Q931_TrunkInfo::L3Buf, L3INT, L3UCHAR, Q931mes_Generic::MesType, MSGF_FROM_L2, Q931mes_Generic::ProtDisc, Q850_CAUSE_IE_NONEXIST, Q850_CAUSE_INVALID_IE_CONTENTS, Q850_CAUSE_MANDATORY_IE_MISSING, Q850_CAUSE_MESSAGE_TYPE_NONEXIST, Q850_CAUSE_WRONG_MESSAGE, Q921_DL_DATA, Q921_DL_UNIT_DATA, Q931_EVENT_RELEASE_CRV, Q931_EVENT_TYPE_CRV, Q931_LOG_DEBUG, Q931_MSG_FROM_L2, Q931_U0, Q931CallGetCRV(), Q931CallGetState(), Q931CallGetStateName(), Q931CallIsGlobal(), Q931CallIsOutgoing(), Q931CallNewIncoming(), Q931CallRelease(), Q931CallSendEvent(), Q931CallSendQueuedEvents(), Q931DialectGetName(), Q931Disconnect(), Q931E_ILLEGAL_IE, Q931E_INTERNAL, Q931E_INVALID_CRV, Q931E_MANDATORY_IE_MISSING, Q931E_NO_ERROR, Q931E_UNEXPECTED_MESSAGE, Q931E_UNKNOWN_IE, Q931E_UNRECOGNIZED_MESSAGE, Q931GetCallByCRV(), Q931GetGlobalCall(), Q931InitMesGeneric(), Q931L2HeaderSpace, Q931Log(), Q931mes_RELEASE, Q931mes_RELEASE_COMPLETE, Q931mes_SETUP, Q931mes_STATUS_ENQUIRY, Q931MesgErrorsInit(), Q931MesgErrorsPrint(), Q931Proc(), Q931StatusEnquiryResponse(), Q931TrunkGetStatusEnquiry(), Q931Tx32(), Q931Uie_CRV(), Q931Umes(), Q931mes_Generic::Size, and Q931mes_Generic::Tei.

void Q931SetError ( Q931_TrunkInfo_t trunk,
L3INT  ErrID,
L3INT  ErrPar1,
L3INT  ErrPar2 
)

Used by the stack to indicate an error

Parameters:
[in]trunkQ.931 trunk
[in]ErrIDID of error (Q931E_*)
[in]ErrPar1Parameter1
[in]ErrPar2Parameter2

Definition at line 621 of file Q931.c.

References Q931_TrunkInfo::PrivateData34, and Q931_TrunkInfo::Q931ErrorCBProc.

Referenced by Q931Pie_LLComp(), Q931Uie_BearerCap(), Q931Uie_GenericDigits(), Q931Uie_HLComp(), and Q931Uie_LLComp().

Q931_API void Q931SetGetTimeCB ( L3ULONG(*)(void)  callback)

Set timer callback

Parameters:
[in]callbackcallback function used to get the current time in milliseconds
Note:
Required, timers won't work without a valid callback

Definition at line 675 of file Q931.c.

References Q931GetTimeProc.

void Q931SetL2HeaderSpace ( L3INT  space)

Definition at line 86 of file Q931.c.

References Q931L2HeaderSpace.

void Q931SetL4HeaderSpace ( L3INT  space)

Definition at line 71 of file Q931.c.

References Q931L4HeaderSpace.

Q931_API void Q931SetLogCB ( Q931_TrunkInfo_t trunk,
Q931LogCB_t  func,
void *  priv 
)

Set Logging callback function and private data

Parameters:
[in]trunkQ.931 trunk
[in]funcLog callback function
[in]privOptional private data passed to logging function

Definition at line 804 of file Q931.c.

References Q931_TrunkInfo::PrivateDataLog, and Q931_TrunkInfo::Q931LogCBProc.

Set log level

Parameters:
[in]trunkQ.931 trunk
[in]levelLog level

Definition at line 816 of file Q931.c.

References Q931_TrunkInfo::loglevel, Q931_LOG_DEBUG, and Q931_LOG_NONE.

L3INT Q931Timeout ( Q931_TrunkInfo_t trunk,
struct Q931_Call call,
L3UCHAR  timer 
)

Invoke timeout handler function

Parameters:
[in]trunkQ.931 trunk
[in]callQ.931 call
[in]timerTimer to handle
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 1247 of file Q931.c.

References Q931_TrunkInfo::Dialect, Q931DialectGetTimerProc(), and Q931E_INTERNAL.

Referenced by Q931TimerTick().

L3INT Q931TimeoutDummy ( Q931_TrunkInfo_t trunk,
struct Q931_Call call 
)

Dummy handler for timeouts

Parameters:
[in]trunkQ.931 trunk
[in]callQ.931 call
Returns:
Always returns Q931E_NO_ERROR

Definition at line 884 of file Q931.c.

References Q931_Call::CRV, Q931_LOG_DEBUG, Q931E_NO_ERROR, Q931Log(), and Q931_Call::TimerID.

Referenced by Q931CreateNT(), and Q931CreateTE().

Helper function to clear all flags of a trunk

Parameters:
[in]trunkQ.931 trunk

Definition at line 923 of file Q931.c.

References Q931_TrunkInfo::flags.

void Q931TrunkClearFlag ( Q931_TrunkInfo_t trunk,
L3INT  flag 
)

Helper function to unset a trunk flag

Parameters:
[in]trunkQ.931 trunk
[in]flagFlag (mask) to clear

Definition at line 913 of file Q931.c.

References Q931_TrunkInfo::flags.

Referenced by Q931TrunkSetRelaxedMode().

L3BOOL Q931TrunkIsSetFlag ( const Q931_TrunkInfo_t trunk,
const L3INT  flag 
)

Helper function to check if a trunk flag is set

Parameters:
[in]trunkQ.931 trunk
[in]flagFlag (mask) to check
Returns:
0 = flag is not set, 1 = it is

Definition at line 935 of file Q931.c.

References Q931_TrunkInfo::flags.

Referenced by Q931Proc(), Q931ProcConnectTE(), Q931ProcRestartNT(), Q931ProcRestartTE(), Q931ProcSetupNT(), Q931ProcSetupTE(), Q931Rx43(), Q931Umes(), and Q931Umes_Generic().

void Q931TrunkSetFlag ( Q931_TrunkInfo_t trunk,
L3INT  flag 
)

Helper function to set a trunk flag

Parameters:
[in]trunkQ.931 trunk
[in]flagFlag (mask) to set

Definition at line 902 of file Q931.c.

References Q931_TrunkInfo::flags.

Referenced by Q931TrunkSetRelaxedMode().

Q931_API void Q931TrunkSetRelaxedMode ( Q931_TrunkInfo_t trunk,
L3BOOL  enable 
)

Relax IE and Message checks: incoming unknown messages and unknown/invalid IEs will be ignored

Parameters:
[in]trunkQ.931 Trunk handle
[in]enableEnable or disable Relaxed mode (Q931_TRUE / Q931_FALSE)
Note:
Use with care!

Definition at line 997 of file Q931.c.

References Q931_TFLAG_IGNORE_ILLEGAL_IE, Q931_TFLAG_IGNORE_UNKNOWN_IE, Q931_TFLAG_IGNORE_UNKNOWN_MSG, Q931TrunkClearFlag(), and Q931TrunkSetFlag().

L3INT Q931Tx32 ( Q931_TrunkInfo_t trunk,
L3UCHAR  bcast,
Q931mes_Generic msg,
int  size 
)

Encode and send message to Layer 2

Parameters:
[in]trunkQ.931 trunk
[in]bcastBroadcast message to all TEIs
[in]msgMessage buffer
[in]sizeSize of message
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 570 of file Q931.c.

References Q931mes_Generic::CRV, Q931mes_Generic::CRVFlag, Q931_TrunkInfo::L2Buf, L3INT, L3UCHAR, Q931mes_Generic::MesType, Q931_TrunkInfo::PrivateData32, Q921_DL_DATA, Q921_DL_UNIT_DATA, Q931_LOG_DEBUG, Q931CallIsOutgoing(), Q931E_INVALID_CRV, Q931E_MISSING_CB, Q931E_NO_ERROR, Q931GetCallByCRV(), Q931L2HeaderSpace, Q931Log(), Q931Pmes(), Q931_TrunkInfo::Q931Tx32CBProc, and Q931_Call::Tei.

Referenced by Q931AckConnect(), Q931CallSendStatus(), Q931ProcAlertingNT(), Q931ProcAlertingTE(), Q931ProcCallProceedingNT(), Q931ProcCallProceedingTE(), Q931ProcCongestionControlNT(), Q931ProcCongestionControlTE(), Q931ProcConnectAckNT(), Q931ProcConnectAckTE(), Q931ProcConnectNT(), Q931ProcConnectTE(), Q931ProcDisconnectNT(), Q931ProcDisconnectTE(), Q931ProcInformationNT(), Q931ProcInformationTE(), Q931ProcNotifyNT(), Q931ProcNotifyTE(), Q931ProcProgressTE(), Q931ProcReleaseCompleteNT(), Q931ProcReleaseNT(), Q931ProcReleaseTE(), Q931ProcRestartAckNT(), Q931ProcRestartAckTE(), Q931ProcRestartNT(), Q931ProcRestartTE(), Q931ProcResumeAckNT(), Q931ProcResumeAckTE(), Q931ProcResumeRejectNT(), Q931ProcResumeRejectTE(), Q931ProcResumeTE(), Q931ProcSegmentNT(), Q931ProcSegmentTE(), Q931ProcSetupAckNT(), Q931ProcSetupAckTE(), Q931ProcSetupNT(), Q931ProcSetupTE(), Q931ProcStatusEnquiryNT(), Q931ProcStatusEnquiryTE(), Q931ProcStatusNT(), Q931ProcStatusTE(), Q931ProcSuspendAckNT(), Q931ProcSuspendAckTE(), Q931ProcSuspendRejectNT(), Q931ProcSuspendRejectTE(), Q931ProcSuspendTE(), Q931ProcTimeoutT304TE(), Q931ProcTimeoutT305TE(), Q931ProcTimeoutT308TE(), Q931ProcTimeoutT310TE(), Q931ProcTimeoutT313TE(), Q931ProcTimeoutT318TE(), Q931ProcUserInformationNT(), Q931ProcUserInformationTE(), Q931Release(), Q931ReleaseComplete(), Q931Rx23(), Q931Send(), Q931StatusEnquiryResponse(), Q932ProcFacilityNT(), Q932ProcFacilityTE(), Q932ProcHoldAckNT(), Q932ProcHoldAckTE(), Q932ProcHoldNT(), Q932ProcHoldRejectNT(), Q932ProcHoldRejectTE(), Q932ProcHoldTE(), Q932ProcRegisterNT(), Q932ProcRegisterTE(), Q932ProcRetrieveAckNT(), Q932ProcRetrieveAckTE(), Q932ProcRetrieveNT(), Q932ProcRetrieveRejectNT(), Q932ProcRetrieveRejectTE(), and Q932ProcRetrieveTE().

L3INT Q931Tx34 ( Q931_TrunkInfo_t trunk,
struct Q931_Call call,
Q931mes_Generic msg,
int  size 
)

Send message to Layer 4

Parameters:
[in]trunkQ.931 trunk
[in]callQ.931 call
[in]msgMessage to send (Q931mes_Generic *)
[in]sizeSize of message
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 460 of file Q931.c.

References Q931_TrunkInfo::PrivateData34, Q931_LOG_DEBUG, Q931E_MISSING_CB, Q931Log(), and Q931_TrunkInfo::Q931Tx34CBProc.

Referenced by Q931ProcAlertingNT(), Q931ProcAlertingTE(), Q931ProcCallProceedingNT(), Q931ProcCallProceedingTE(), Q931ProcCongestionControlNT(), Q931ProcCongestionControlTE(), Q931ProcConnectAckTE(), Q931ProcConnectNT(), Q931ProcConnectTE(), Q931ProcDisconnectNT(), Q931ProcDisconnectTE(), Q931ProcInformationNT(), Q931ProcInformationTE(), Q931ProcNotifyNT(), Q931ProcNotifyTE(), Q931ProcProgressNT(), Q931ProcProgressTE(), Q931ProcReleaseCompleteNT(), Q931ProcReleaseCompleteTE(), Q931ProcReleaseNT(), Q931ProcReleaseTE(), Q931ProcRestartAckNT(), Q931ProcRestartAckTE(), Q931ProcRestartNT(), Q931ProcRestartTE(), Q931ProcResumeAckTE(), Q931ProcResumeNT(), Q931ProcResumeRejectTE(), Q931ProcSegmentNT(), Q931ProcSegmentTE(), Q931ProcSetupNT(), Q931ProcSetupTE(), Q931ProcStatusNT(), Q931ProcStatusTE(), Q931ProcSuspendAckTE(), Q931ProcSuspendNT(), Q931ProcSuspendRejectTE(), Q931ProcSuspendTE(), Q931ProcUserInformationNT(), Q931ProcUserInformationTE(), Q932ProcFacilityNT(), Q932ProcFacilityTE(), Q932ProcHoldAckNT(), Q932ProcHoldAckTE(), Q932ProcHoldNT(), Q932ProcHoldRejectNT(), Q932ProcHoldRejectTE(), Q932ProcHoldTE(), Q932ProcRegisterNT(), Q932ProcRegisterTE(), Q932ProcRetrieveAckNT(), Q932ProcRetrieveAckTE(), Q932ProcRetrieveNT(), Q932ProcRetrieveRejectNT(), Q932ProcRetrieveRejectTE(), and Q932ProcRetrieveTE().

L3INT Q931Uie ( Q931_TrunkInfo_t trunk,
L3UCHAR  id,
Q931mes_Generic pMes,
L3UCHAR IBuf,
L3UCHAR OBuf,
L3INT IOff,
L3INT OOff 
)

Invoke IE specific decoder function

Parameters:
[in]trunkQ.931 trunk
[in]idID of information element (type)
[in]pMesMessage
[in]IBufInput buffer
[out]OBufOutput buffer
[in,out]IOffInput buffer offset
[in,out]OOffOutput buffer offset
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 1149 of file Q931.c.

References Q931_TrunkInfo::Dialect, Q931DialectGetUieProc(), and Q931E_INTERNAL.

Referenced by Q931Umes_Generic().

L3INT Q931UieDummy ( Q931_TrunkInfo_t trunk,
Q931mes_Generic msg,
L3UCHAR IBuf,
L3UCHAR OBuf,
L3INT IOff,
L3INT OOff 
)

Dummy function for IE decoding.

Parameters:
[in]trunkQ.931 trunk
[in]msgMessage
[in]IBufInput buffer
[out]OBufOutput buffer
[in,out]IOffInput buffer offset
[in,out]OOffOutput buffer offset
Returns:
always returns Q931E_UNKNOWN_IE (unhandled IE)

Definition at line 136 of file Q931.c.

References Q931E_UNKNOWN_IE.

Check whether information element has a decoder function available

Parameters:
[in]trunkQ.931 trunk
[in]idInformation element id to check
Returns:
Q931_FALSE if this IE can be handled or Q931_TRUE if it can not

Definition at line 1207 of file Q931.c.

References Q931_TrunkInfo::Dialect, and Q931DialectGetUieProc().

Referenced by Q931Umes_Generic().

L3INT Q931Umes ( Q931_TrunkInfo_t trunk,
L3UCHAR  id,
L3UCHAR IBuf,
Q931mes_Generic OBuf,
L3INT  IOff,
L3INT  Size,
struct Q931MesgErrors errs 
)

Invoke message specific decoder function

Parameters:
[in]trunkQ.931 trunk
[in]idID of message (type)
[in]IBufInput buffer (raw encoded message)
[out]OBufOutput buffer
[in]IOffInput buffer offset
[in]SizeSize of input message
[out]errsMessage errors reported by parser
Returns:
Q931E_NO_ERROR on success, Q931E_* otherwise

Definition at line 1093 of file Q931.c.

References Q931_TrunkInfo::Dialect, Q931_TFLAG_IGNORE_UNKNOWN_MSG, Q931DialectGetUmesProc(), Q931E_INTERNAL, Q931E_NO_ERROR, and Q931TrunkIsSetFlag().

Referenced by Q931Rx23().

L3INT Q931UmesDummy ( Q931_TrunkInfo_t trunk,
L3UCHAR IBuf,
Q931mes_Generic OBuf,
L3INT  IOff,
L3INT  Size,
struct Q931MesgErrors errs 
)

Dummy function for message decoding.

Parameters:
[in]trunkQ.931 trunk
[in]IBufMessage input buffer
[out]OBufMessage output buffer
[in]IOffInput buffer offset
[in]SizeSize of input
[out]errsMessage parser errors
Returns:
always returns Q931E_UNKNOWN_MESSAGE (unhandled message)

Definition at line 119 of file Q931.c.

References Q931E_UNKNOWN_MESSAGE.


Variable Documentation

L3ULONG(* Q931GetTimeProc)(void) = NULL

Definition at line 59 of file Q931.c.

Referenced by Q931GetTime(), and Q931SetGetTimeCB().

Definition at line 57 of file Q931.c.

Referenced by Q931Rx23(), Q931SetL2HeaderSpace(), and Q931Tx32().

Definition at line 55 of file Q931.c.

Referenced by Q931SetL4HeaderSpace().