Yate
|
Abstract ISDN layer 2 (Q.921) message transport. More...
#include <yatesig.h>
Public Types | |
enum | State { Released, WaitEstablish, Established, WaitRelease } |
Public Member Functions | |
virtual | ~ISDNLayer2 () |
ISDNLayer3 * | layer3 () 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 |
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) |
Static Public Member Functions | |
static const char * | stateName (State s) |
Protected Member Functions | |
ISDNLayer2 (const NamedList ¶ms, const char *name=0, u_int8_t tei=0) | |
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 () |
void | autoRestart (bool restart) |
void | setRi (u_int16_t ri) |
ISDNFrame * | parsePacket (const DataBlock &packet) |
Friends | |
class | ISDNQ921Management |
Abstract ISDN layer 2 (Q.921) message transport.
An interface to a Layer 2 (Q.921) ISDN message transport
enum State |
Layer states if it has a TEI assigned
virtual ~ISDNLayer2 | ( | ) | [virtual] |
Destructor
ISDNLayer2 | ( | const NamedList & | params, |
const char * | name = 0 , |
||
u_int8_t | tei = 0 |
||
) | [protected] |
Constructor Initialize this interface and the component
params | Layer's parameters |
name | Optional name of the component |
tei | Value of TEI for this layer |
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
layer3 | Pointer to the Q.931 Layer 3 to attach |
Referenced by ISDNQ921Passive::destroyed(), and ISDNQ921::destroyed().
bool autoRestart | ( | ) | const [inline] |
Check if this interface will automatically re-establish when released
void autoRestart | ( | bool | restart | ) | [inline, protected] |
Set the automatically re-establish when released flag
restart | The new value of the auto restart flag |
void changeState | ( | State | newState, |
const char * | reason = 0 |
||
) | [protected] |
Set the state Descendants are responsable for multiple frame status management
newState | The new state |
reason | Reason of state change, NULL if unspecified |
bool changeType | ( | ) | [protected] |
Change the interface type
virtual void cleanup | ( | ) | [pure virtual] |
Emergency release. Descendants must implement this method to cleanup/reset data
Implemented in ISDNQ921, ISDNQ921Management, and ISDNQ921Passive.
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
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 |
bool detectType | ( | ) | const [inline] |
Check if this interface should change its type
void idleTimeout | ( | ) | [protected] |
Notify layer 3 of data link idle timeout Used for stateless layer 2
Mutex& l2Mutex | ( | ) | [inline, protected] |
Retrieve the layer's mutex
ISDNLayer3* layer3 | ( | ) | const [inline] |
Get the ISDN Layer 3 attached to this layer
u_int8_t localSapi | ( | ) | const [inline] |
Get the SAPI (Service Access Point Identifier) of this interface
u_int8_t localTei | ( | ) | const [inline] |
Get the TEI (Terminal Endpoint Identifier) of this interface
u_int32_t maxUserData | ( | ) | const [inline] |
Get the maximum length of user data transported through this layer
virtual bool multipleFrame | ( | u_int8_t | tei, |
bool | establish, | ||
bool | force | ||
) | [inline, virtual] |
Implements Q.921 DL-ESTABLISH and DL-RELEASE request primitives Descendants must implement this method to fullfill the request
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 |
Reimplemented in ISDNQ921, and ISDNQ921Management.
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
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 | ||
) | [protected] |
Implements Q.921 DL-RELEASE indication/confirmation primitive of 'multiple frame acknowledged' mode released
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. |
bool network | ( | ) | const [inline] |
Check if this interface is the network or CPE (user) side of the link
Referenced by ISDNQ931::network().
Parse a received packet
packet | The packet received |
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
data | Received data |
tei | The TEI for which the data was received |
virtual bool sendData | ( | const DataBlock & | data, |
u_int8_t | tei, | ||
bool | ack | ||
) | [inline, virtual] |
Implements Q.921 DL-DATA and DL-UNIT DATA request primitives Descendants must implement this method to fullfill the request
data | Data to send |
tei | This layer TEI |
ack | True to send an acknowledged frame, false to send an unacknowledged one |
Reimplemented in ISDNQ921, and ISDNQ921Management.
void setRi | ( | u_int16_t | ri | ) | [inline, protected] |
Set the Reference Identifier used in management procedures
ri | The new reference number |
State state | ( | ) | const [inline] |
Get the layer's state
static const char* stateName | ( | State | s | ) | [inline, static] |
Get the text associated with a given state
s | The state to get the text for |
References TelEngine::lookup().
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
status | The new TEI assigned status |
bool teiAssigned | ( | ) | const [inline] |
Check if this interface has a TEI assigned