Yate
ISDNLayer2 Class Referenceabstract

Abstract ISDN layer 2 (Q.921) message transport. More...

#include <yatesig.h>

Inheritance diagram for ISDNLayer2:
SignallingComponent RefObject DebugEnabler GenObject ISDNIUA ISDNQ921 ISDNQ921Management ISDNQ921Passive

Public Types

enum  State { Released , WaitEstablish , Established , WaitRelease }
 

Public Member Functions

virtual ~ISDNLayer2 ()
 
ISDNLayer3layer3 () const
 
State state () const
 
bool network () const
 
bool detectType () const
 
u_int8_t localSapi () const
 
u_int8_t localTei () const
 
u_int32_t maxUserData () const
 
bool teiAssigned () const
 
bool autoRestart () const
 
unsigned int upTime () const
 
virtual bool multipleFrame (u_int8_t tei, bool establish, bool force)
 
virtual bool sendData (const DataBlock &data, u_int8_t tei, bool ack)
 
virtual void cleanup ()=0
 
virtual void attach (ISDNLayer3 *layer3)
 
- Public Member Functions inherited from SignallingComponent
virtual ~SignallingComponent ()
 
virtual const StringtoString () const
 
virtual bool initialize (const NamedList *config)
 
virtual bool control (NamedList &params)
 
virtual NamedListcontrolCreate (const char *oper=0)
 
virtual bool controlExecute (NamedList *params)
 
virtual void engine (SignallingEngine *eng)
 
SignallingEngineengine () const
 
int debugLevel (int level)
 
const StringcomponentType () const
 
- Public Member Functions inherited from RefObject
 RefObject ()
 
virtual ~RefObject ()
 
virtual void * getObject (const String &name) const
 
virtual bool alive () const
 
bool ref ()
 
bool deref ()
 
int refcount () const
 
virtual void destruct ()
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual const StringtraceId () const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 
- Public Member Functions inherited from DebugEnabler
 DebugEnabler (int level=TelEngine::debugLevel(), bool enabled=true)
 
int debugLevel () const
 
int debugLevel (int level)
 
bool debugEnabled () const
 
void debugEnabled (bool enable)
 
const char * debugName () const
 
bool debugAt (int level) const
 
bool debugChained () const
 
void debugChain (const DebugEnabler *chain=0)
 
void debugCopy (const DebugEnabler *original=0)
 

Static Public Member Functions

static const char * stateName (State s)
 
- Static Public Member Functions inherited from SignallingComponent
static bool resolveConfig (const String &cmpName, NamedList &params, const NamedList *config)
 
- Static Public Member Functions inherited from RefObject
static bool alive (const RefObject *obj)
 
static bool efficientIncDec ()
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 

Protected Member Functions

 ISDNLayer2 (const NamedList &params, const char *name=0, u_int8_t tei=0)
 
Mutexl2Mutex ()
 
void multipleFrameEstablished (u_int8_t tei, bool confirm, bool timeout)
 
void multipleFrameReleased (u_int8_t tei, bool confirm, bool timeout)
 
void dataLinkState (u_int8_t tei, bool cmd, bool value)
 
void idleTimeout ()
 
void receiveData (const DataBlock &data, u_int8_t tei)
 
void teiAssigned (bool status)
 
void changeState (State newState, const char *reason=0)
 
bool changeType ()
 
void autoRestart (bool restart)
 
void setRi (u_int16_t ri)
 
ISDNFrameparsePacket (const DataBlock &packet)
 
- Protected Member Functions inherited from SignallingComponent
 SignallingComponent (const char *name=0, const NamedList *params=0, const char *type="unknown")
 
virtual void destroyed ()
 
void insert (SignallingComponent *component)
 
virtual void detach ()
 
virtual void timerTick (const Time &when)
 
void setName (const char *name)
 
void setCompType (const char *type)
 
unsigned long tickSleep (unsigned long usec=1000000) const
 
- Protected Member Functions inherited from RefObject
virtual void zeroRefs ()
 
bool resurrect ()
 
- Protected Member Functions inherited from DebugEnabler
void debugName (const char *name)
 

Friends

class ISDNQ921Management
 

Detailed Description

Abstract ISDN layer 2 (Q.921) message transport.

An interface to a Layer 2 (Q.921) ISDN message transport

Member Enumeration Documentation

◆ State

enum State

Layer states if it has a TEI assigned

Constructor & Destructor Documentation

◆ ~ISDNLayer2()

virtual ~ISDNLayer2 ( )
virtual

Destructor

◆ ISDNLayer2()

ISDNLayer2 ( const NamedList & params,
const char * name = 0,
u_int8_t tei = 0 )
protected

Constructor Initialize this interface and the component

Parameters
paramsLayer's parameters
nameOptional name of the component
teiValue of TEI for this layer

Referenced by ISDNQ921Management::dataLinkState(), ISDNQ921Management::multipleFrameEstablished(), ISDNQ921Management::multipleFrameReleased(), and ISDNQ921Management::receiveData().

Member Function Documentation

◆ attach()

virtual void attach ( ISDNLayer3 * layer3)
virtual

Attach an ISDN Q.931 Layer 3 if the given parameter is different from the one we have Cleanup the object before ataching the new Layer 3 This method is thread safe

Parameters
layer3Pointer to the Q.931 Layer 3 to attach

References layer3().

Referenced by ISDNQ921::destroyed(), and ISDNQ921Passive::destroyed().

◆ autoRestart() [1/2]

bool autoRestart ( ) const
inline

Check if this interface will automatically re-establish when released

Returns
The auto restart flag

◆ autoRestart() [2/2]

void autoRestart ( bool restart)
inlineprotected

Set the automatically re-establish when released flag

Parameters
restartThe new value of the auto restart flag

◆ changeState()

void changeState ( State newState,
const char * reason = 0 )
protected

Set the state Descendants are responsable for multiple frame status management

Parameters
newStateThe new state
reasonReason of state change, NULL if unspecified

◆ changeType()

bool changeType ( )
protected

Change the interface type

Returns
True if interface type changed

◆ cleanup()

virtual void cleanup ( )
pure virtual

Emergency release. Descendants must implement this method to cleanup/reset data

Implemented in ISDNIUA, ISDNQ921, ISDNQ921Management, and ISDNQ921Passive.

◆ dataLinkState()

void dataLinkState ( u_int8_t tei,
bool cmd,
bool value )
protected

Notify layer 3 of data link set/release command or response Used for stateless layer 2

Parameters
teiThe TEI of this layer
cmdTrue if received a command, false if received a response
valueThe value of the notification If 'cmd' is true (command), the value is true if a request to establish data link was received or false if received a request to release data link If 'cmd' is false (response), the value is the response

◆ detectType()

bool detectType ( ) const
inline

Check if this interface should change its type

Returns
True if type change is allowed

◆ idleTimeout()

void idleTimeout ( )
protected

Notify layer 3 of data link idle timeout Used for stateless layer 2

◆ l2Mutex()

Mutex & l2Mutex ( )
inlineprotected

Retrieve the layer's mutex

Returns
Reference to the Layer 2 mutex

◆ layer3()

ISDNLayer3 * layer3 ( ) const
inline

Get the ISDN Layer 3 attached to this layer

Referenced by attach().

◆ localSapi()

u_int8_t localSapi ( ) const
inline

Get the SAPI (Service Access Point Identifier) of this interface

Returns
The SAPI (Service Access Point Identifier) of this interface

◆ localTei()

u_int8_t localTei ( ) const
inline

Get the TEI (Terminal Endpoint Identifier) of this interface

Returns
The TEI (Terminal Endpoint Identifier) of this interface

◆ maxUserData()

u_int32_t maxUserData ( ) const
inline

Get the maximum length of user data transported through this layer

Returns
The maximum length of user data transported through this layer

◆ multipleFrame()

virtual bool multipleFrame ( u_int8_t tei,
bool establish,
bool force )
inlinevirtual

Implements Q.921 DL-ESTABLISH and DL-RELEASE request primitives Descendants must implement this method to fullfill the request

Parameters
teiThis layer TEI (Terminal Endpoint Identifier)
establishTrue to establish. False to release
forceTrue to establish even if we already are in this mode. This parameter is ignored if establish is false
Returns
True if the request was accepted

Reimplemented in ISDNIUA, ISDNQ921, and ISDNQ921Management.

◆ multipleFrameEstablished()

void multipleFrameEstablished ( u_int8_t tei,
bool confirm,
bool timeout )
protected

Implements Q.921 DL-ESTABLISH indication/confirmation primitive of 'multiple frame acknowledged' mode established

Parameters
teiThe TEI requested
confirmTrue if this is a confirmation of a previous request. False if it is an indication of state change on remote request
timeoutTrue if the reason is a timeout.

◆ multipleFrameReleased()

void multipleFrameReleased ( u_int8_t tei,
bool confirm,
bool timeout )
protected

Implements Q.921 DL-RELEASE indication/confirmation primitive of 'multiple frame acknowledged' mode released

Parameters
teiThe TEI released
confirmTrue if this is a confirmation of a previous request. False if it is an indication of state change on remote request
timeoutTrue if the reason is a timeout.

◆ network()

bool network ( ) const
inline

Check if this interface is the network or CPE (user) side of the link

Returns
True if this interface is the network side of the link

◆ parsePacket()

ISDNFrame * parsePacket ( const DataBlock & packet)
protected

Parse a received packet

Parameters
packetThe packet received
Returns
Pointer to a newly created frame, NULL if an error occured

◆ receiveData()

void receiveData ( const DataBlock & data,
u_int8_t tei )
protected

Implements Q.921 DL-DATA and DL-UNIT DATA indication primitives Receive data from remote peer

Parameters
dataReceived data
teiThe TEI for which the data was received

◆ sendData()

virtual bool sendData ( const DataBlock & data,
u_int8_t tei,
bool ack )
inlinevirtual

Implements Q.921 DL-DATA and DL-UNIT DATA request primitives Descendants must implement this method to fullfill the request

Parameters
dataData to send
teiThis layer TEI
ackTrue to send an acknowledged frame, false to send an unacknowledged one
Returns
True if the request was accepted

Reimplemented in ISDNIUA, ISDNQ921, and ISDNQ921Management.

◆ setRi()

void setRi ( u_int16_t ri)
inlineprotected

Set the Reference Identifier used in management procedures

Parameters
riThe new reference number

◆ state()

State state ( ) const
inline

Get the layer's state

Returns
The layer's state as enumeration

◆ stateName()

static const char * stateName ( State s)
inlinestatic

Get the text associated with a given state

Parameters
sThe state to get the text for
Returns
The text associated with the given state

◆ teiAssigned() [1/2]

bool teiAssigned ( ) const
inline

Check if this interface has a TEI assigned

Returns
True if this interface has a TEI assigned

◆ teiAssigned() [2/2]

void teiAssigned ( bool status)
protected

Set TEI assigned status. Print a debug message. If status is false calls cleanup() Descendants are responsable for TEI assigned status management

Parameters
statusThe new TEI assigned status

◆ upTime()

unsigned int upTime ( ) const
inline

Get the uptime of the interface

Returns
Time since interface got up in seconds

References Time::secNow().


The documentation for this class was generated from the following file: