Yate
ISDNFrame Class Reference

An ISDN frame. More...

#include <yatesig.h>

Inheritance diagram for ISDNFrame:
RefObject GenObject

Public Types

enum  Type {
  DISC = 1 , DM = 2 , FRMR = 3 , I = 4 ,
  REJ = 5 , RNR = 6 , RR = 7 , SABME = 8 ,
  UA = 9 , UI = 10 , XID = 11 , Invalid = 100 ,
  ErrUnknownCR = 101 , ErrHdrLength = 102 , ErrDataLength = 103 , ErrRxSeqNo = 104 ,
  ErrTxSeqNo = 105 , ErrInvalidEA = 106 , ErrInvalidAddress = 107 , ErrUnsupported = 108 ,
  ErrInvalidCR = 109
}
 
enum  TeiManagement {
  TeiReq = 1 , TeiAssigned = 2 , TeiDenied = 3 , TeiCheckReq = 4 ,
  TeiCheckRsp = 5 , TeiRemove = 6 , TeiVerify = 7
}
 
enum  Category { Data , Supervisory , Unnumbered , Error }
 

Public Member Functions

virtual ~ISDNFrame ()
 
Type type () const
 
Type error () const
 
Category category () const
 
bool command () const
 
u_int8_t sapi () const
 
u_int8_t tei () const
 
bool poll () const
 
u_int8_t ns () const
 
u_int8_t nr () const
 
u_int8_t headerLength () const
 
u_int32_t dataLength () const
 
const DataBlockbuffer () const
 
bool sent () const
 
void sent (bool value)
 
const char * name () const
 
void update (u_int8_t *ns=0, u_int8_t *nr=0)
 
void getData (DataBlock &dest) const
 
void toString (String &dest, bool extendedDebug) const
 
bool checkTeiManagement () 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 StringtoString () const
 
virtual const StringtraceId () const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 

Static Public Member Functions

static u_int16_t getRi (const DataBlock &data)
 
static u_int8_t getType (const DataBlock &data)
 
static u_int8_t getAi (const DataBlock &data)
 
static ISDNFrameparse (const DataBlock &data, ISDNLayer2 *receiver)
 
static bool buildTeiManagement (DataBlock &data, u_int8_t type, u_int16_t ri, u_int8_t ai)
 
static bool commandBit (bool network)
 
static bool responseBit (bool network)
 
static bool isCommand (u_int8_t cr, bool sentByNetwork)
 
static const char * typeName (Type type)
 
- 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 ()
 

Static Public Attributes

static const TokenDict s_types []
 

Protected Member Functions

 ISDNFrame (Type type=Invalid)
 
 ISDNFrame (Type type, bool command, bool senderNetwork, u_int8_t sapi, u_int8_t tei, bool pf, u_int8_t nr=0)
 
 ISDNFrame (bool ack, bool senderNetwork, u_int8_t sapi, u_int8_t tei, bool pf, const DataBlock &data)
 
- Protected Member Functions inherited from RefObject
virtual void zeroRefs ()
 
bool resurrect ()
 
virtual void destroyed ()
 

Friends

class ISDNQ921
 
class ISDNQ921Management
 

Detailed Description

An ISDN frame.

Encapsulates an ISDN (Q.921) frame exchanged over a hardware HDLC interface

Member Enumeration Documentation

◆ Category

enum Category

Frame category

◆ TeiManagement

Codes used for TEI management procedures (Q.921 Table 8)

◆ Type

enum Type

Frame type according to Q.921 3.6

Constructor & Destructor Documentation

◆ ~ISDNFrame()

virtual ~ISDNFrame ( )
virtual

Destructor

◆ ISDNFrame() [1/3]

ISDNFrame ( Type type = Invalid)
protected

Constructor Used by the parser

Parameters
typeFrame type

References type().

Referenced by parse().

◆ ISDNFrame() [2/3]

ISDNFrame ( Type type,
bool command,
bool senderNetwork,
u_int8_t sapi,
u_int8_t tei,
bool pf,
u_int8_t nr = 0 )
protected

Constructor Create U/S frames: SABME/DM/DISC/UA/FRMR/XID/RR/RNR/REJ Set data members. Encode frame in buffer according to Q.921 Used by ISDNLayer2 to create outgoing frames

Parameters
typeFrame type
commandFrame command/response's flag
senderNetworkTrue if the sender is the network side of the data link
sapiSAPI value
teiTEI value
pfPoll/final flag
nrOptional transmitter receive sequence number

References command(), nr(), sapi(), tei(), and type().

◆ ISDNFrame() [3/3]

ISDNFrame ( bool ack,
bool senderNetwork,
u_int8_t sapi,
u_int8_t tei,
bool pf,
const DataBlock & data )
protected

Constructor Create I/UI frames Set data members. Encode frame in buffer according to Q.921 Used by ISDNLayer2 to create outgoing frames

Parameters
ackTrue to create an I frame. False to create an UI frame
senderNetworkTrue if the sender is the network side of the data link
sapiSAPI value
teiTEI value
pfPoll/final flag
dataTransmitted data

References sapi(), and tei().

Member Function Documentation

◆ buffer()

const DataBlock & buffer ( ) const
inline

Get the frame's buffer

Returns
The frame's buffer

◆ buildTeiManagement()

static bool buildTeiManagement ( DataBlock & data,
u_int8_t type,
u_int16_t ri,
u_int8_t ai )
static

Build a TEI management message buffer

Parameters
dataDestination buffer to fill
typeThe message type
riThe reference number
aiThe action indicator
Returns
True on succes

References type().

◆ category()

Category category ( ) const
inline

Get the category of this frame

Returns
The category of this frame as enumeration

◆ checkTeiManagement()

bool checkTeiManagement ( ) const

Check if the received frame is a TEI management frame

Returns
True if the frame is a TEI management one, false if it's not

◆ command()

bool command ( ) const
inline

Check if this frame is a command

Returns
True if this frame is a command. False if it is a response

Referenced by ISDNFrame().

◆ commandBit()

static bool commandBit ( bool network)
inlinestatic

Get the command bit value for a given side of a data link

Parameters
networkTrue for the network side, false for the user side of a data link
Returns
The appropriate command bit value

◆ dataLength()

u_int32_t dataLength ( ) const
inline

Get the length of the data carried by this frame

Returns
The length of the data carried by this frame

◆ error()

Type error ( ) const
inline

Get the error type

Returns
The error type of this frame as enumeration

◆ getAi()

static u_int8_t getAi ( const DataBlock & data)
inlinestatic

Get action indicator

Parameters
dataData block which contains it
Returns
Action indicator value

References DataBlock::at().

◆ getData()

void getData ( DataBlock & dest) const
inline

Get the data transferred with this frame

Parameters
destThe destination buffer

References DataBlock::assign().

◆ getRi()

static u_int16_t getRi ( const DataBlock & data)
static

Get reference number from frame

Parameters
dataThe data block which contains it
Returns
Reference number

◆ getType()

static u_int8_t getType ( const DataBlock & data)
inlinestatic

Get frame message type

Parameters
dataThe data block which contains it
Returns
Message type

References DataBlock::at().

◆ headerLength()

u_int8_t headerLength ( ) const
inline

Get the length of the frame's header

Returns
The length of the frame's header

◆ isCommand()

static bool isCommand ( u_int8_t cr,
bool sentByNetwork )
inlinestatic

Get the command/response type from C/R bit value and sender type

Parameters
crThe value of the C/R bit
sentByNetworkTrue if the sender is the network side of the data link
Returns
True if it is a command

◆ name()

const char * name ( ) const
inline

Get the text associated with the frame's type

Returns
The text associated with the frame's type

References type(), and typeName().

◆ nr()

u_int8_t nr ( ) const
inline

Get the transmitter receive sequence number

Returns
The transmitter receive sequence number

Referenced by ISDNFrame(), and update().

◆ ns()

u_int8_t ns ( ) const
inline

Get the transmitter send sequence number

Returns
The transmitter send sequence number

Referenced by update().

◆ parse()

static ISDNFrame * parse ( const DataBlock & data,
ISDNLayer2 * receiver )
static

Parse a received data block

Parameters
dataData to parse
receiverThe receiver of the data
Returns
ISDNFrame pointer or 0 (no control field)

References ISDNFrame().

◆ poll()

bool poll ( ) const
inline

Check if this frame is a poll (expect response) or a final one

Returns
True if this a poll frame. False if it is a final one

◆ responseBit()

static bool responseBit ( bool network)
inlinestatic

Get the response bit value for a given side of a data link

Parameters
networkTrue for the network side, false for the user side of a data link
Returns
The appropriate response bit value

◆ sapi()

u_int8_t sapi ( ) const
inline

Get the SAPI of this frame

Returns
The SAPI of this frame

Referenced by ISDNFrame(), and ISDNFrame().

◆ sent() [1/2]

bool sent ( ) const
inline

Check if the frame was sent

Returns
True if the frame was sent

◆ sent() [2/2]

void sent ( bool value)
inline

Set transmitted flag

◆ tei()

u_int8_t tei ( ) const
inline

Get the TEI of this frame

Returns
The TEI of this frame

Referenced by ISDNFrame(), and ISDNFrame().

◆ toString()

void toString ( String & dest,
bool extendedDebug ) const

Write this frame to a string for debug purposes

Parameters
destThe destination string
extendedDebugTrue to dump message header and data

◆ type()

Type type ( ) const
inline

Get the type of this frame

Returns
The type of this frame as enumeration

Referenced by buildTeiManagement(), ISDNFrame(), ISDNFrame(), name(), and typeName().

◆ typeName()

static const char * typeName ( Type type)
inlinestatic

Get the text associated with the given frame type

Parameters
typeFrame type to get the text for
Returns
The text associated with the given frame type

References s_types, and type().

Referenced by name().

◆ update()

void update ( u_int8_t * ns = 0,
u_int8_t * nr = 0 )

Update sequence numbers for I frames

Parameters
nsOptional update send sequence number
nrOptional update receive sequence number

References nr(), and ns().

Member Data Documentation

◆ s_types

const TokenDict s_types[]
static

Keep the association between frame types and texts

Referenced by typeName().


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