# class ISDNLayer2 | Abstract ISDN layer 2 (Q.921) message transport. More...
Contains pure virtuals
Full name | `TelEngine::ISDNLayer2`
Definition | `#include <libs/ysig/yatesig.h>`
Inherits | TelEngine::SignallingComponent [virtual public ]
Inherited by | ISDNIUA, ISDNQ921, ISDNQ921Management, ISDNQ921Passive
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- enum State { Released, WaitEstablish, Established, WaitRelease, }

#### Public Methods

- virtual ~ISDNLayer2 ()
- inline ISDNLayer3* layer3 () const
- inline State state () const
- inline bool network () const
- inline bool detectType () const
- inline u_int8_t localSapi () const
- inline u_int8_t localTei () const
- inline u_int32_t maxUserData () const
- inline bool teiAssigned () const
- inline 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 ()
- virtual void attach (ISDNLayer3* layer3)

#### Public Static Methods

- static inline const char* stateName (State s)

#### Protected Methods

- ISDNLayer2 (const NamedList& params, const char* name = 0, u_int8_t tei = 0)
- inline Mutex& l2Mutex ()
- 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 ()
- inline void autoRestart (bool restart)
- inline void setRi (u_int16_t ri)
- ISDNFrame* parsePacket (const DataBlock& packet)

## Detailed Description

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

enum State { Released, WaitEstablish, Established, WaitRelease, } | ### State

Layer states if it has a TEI assigned

~ISDNLayer2 () | ### ~ISDNLayer2

[virtual]

Destructor

inline ISDNLayer3* layer3 () | ### layer3

[const]

Get the ISDN Layer 3 attached to this layer

inline State state () | ### state

[const]

Get the layer's state

Returns: The layer's state as enumeration

inline bool network () | ### network

[const]

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

inline bool detectType () | ### detectType

[const]

Check if this interface should change its type

Returns: True if type change is allowed

inline u_int8_t localSapi () | ### localSapi

[const]

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

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

inline u_int8_t localTei () | ### localTei

[const]

Get the TEI (Terminal Endpoint Identifier) of this interface

Returns: The TEI (Terminal Endpoint Identifier) of this interface

inline u_int32_t maxUserData () | ### maxUserData

[const]

Get the maximum length of user data transported through this layer

Returns: The maximum length of user data transported through this layer

inline bool teiAssigned () | ### teiAssigned

[const]

Check if this interface has a TEI assigned

Returns: True if this interface has a TEI assigned

inline bool autoRestart () | ### autoRestart

[const]

Check if this interface will automatically re-establish when released

Returns: The auto restart flag

unsigned int upTime () | ### upTime

[const]

Get the uptime of the interface

Returns: Time since interface got up in seconds

bool multipleFrame (u_int8_t tei, bool establish, bool force) | ### multipleFrame

[virtual]

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

Parameters:

tei | This layer TEI (Terminal Endpoint Identifier)
establish | True to establish. False to release
force | True 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

bool sendData (const DataBlock& data, u_int8_t tei, bool ack) | ### sendData

[virtual]

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

Parameters:

data | Data to send
tei | This layer TEI
ack | True to send an acknowledged frame, false to send an unacknowledged one

Returns: True if the request was accepted

void cleanup () | ### cleanup

[pure virtual]

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

void attach (ISDNLayer3* layer3) | ### attach

[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:

layer3 | Pointer to the Q.931 Layer 3 to attach

inline const char* stateName (State s) | ### stateName

[static]

Get the text associated with a given state

Parameters:

s | The state to get the text for

Returns: The text associated with the given state

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

[protected]

Constructor Initialize this interface and the component

Parameters:

params | Layer's parameters
name | Optional name of the component
tei | Value of TEI for this layer

inline Mutex& l2Mutex () | ### l2Mutex

[protected]

Retrieve the layer's mutex

Returns: Reference to the Layer 2 mutex

void multipleFrameEstablished (u_int8_t tei, bool confirm, bool timeout) | ### multipleFrameEstablished

[protected]

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

Parameters:

tei | The TEI requested
confirm | True if this is a confirmation of a previous request. False if it is an indication of state change on remote request
timeout | True if the reason is a timeout.

void multipleFrameReleased (u_int8_t tei, bool confirm, bool timeout) | ### multipleFrameReleased

[protected]

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

Parameters:

tei | The TEI released
confirm | True if this is a confirmation of a previous request. False if it is an indication of state change on remote request
timeout | True if the reason is a timeout.

void dataLinkState (u_int8_t tei, bool cmd, bool value) | ### dataLinkState

[protected]

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

Parameters:

tei | The TEI of this layer
cmd | True if received a command, false if received a response
value | The 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

void idleTimeout () | ### idleTimeout

[protected]

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

void receiveData (const DataBlock& data, u_int8_t tei) | ### receiveData

[protected]

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

Parameters:

data | Received data
tei | The TEI for which the data was received

void teiAssigned (bool status) | ### teiAssigned

[protected]

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

Parameters:

status | The new TEI assigned status

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

[protected]

Set the state Descendants are responsable for multiple frame status management

Parameters:

newState | The new state
reason | Reason of state change, NULL if unspecified

bool changeType () | ### changeType

[protected]

Change the interface type

Returns: True if interface type changed

inline void autoRestart (bool restart) | ### autoRestart

[protected]

Set the automatically re-establish when released flag

Parameters:

restart | The new value of the auto restart flag

inline void setRi (u_int16_t ri) | ### setRi

[protected]

Set the Reference Identifier used in management procedures

Parameters:

ri | The new reference number

ISDNFrame* parsePacket (const DataBlock& packet) | ### parsePacket

[protected]

Parse a received packet

Parameters:

packet | The packet received

Returns: Pointer to a newly created frame, NULL if an error occured

Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.