#include <yatesig.h>
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 | Category { Data, Supervisory, Unnumbered, Error } |
Public Member Functions | |
virtual | ~ISDNFrame () |
Type | type () const |
Type | error () const |
Category | category () |
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 DataBlock & | buffer () 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 |
Static Public Member Functions | |
static ISDNFrame * | parse (const DataBlock &data, ISDNLayer2 *receiver) |
static bool | commandBit (bool network) |
static bool | responseBit (bool network) |
static bool | isCommand (u_int8_t cr, bool senderNetwork) |
static const char * | typeName (Type type) |
Static Public Attributes | |
static 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) | |
Friends | |
class | ISDNQ921 |
Encapsulates an ISDN (Q.921) frame exchanged over a hardware HDLC interface
enum Category |
Frame category
enum Type |
Frame type according to Q.921 3.6
virtual ~ISDNFrame | ( | ) | [virtual] |
Destructor
Constructor Used by the parser
type | Frame type |
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
type | Frame type | |
command | Frame command/response's flag | |
senderNetwork | True if the sender is the network side of the data link | |
sapi | SAPI value | |
tei | TEI value | |
pf | Poll/final flag | |
nr | Optional transmitter receive sequence number |
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
ack | True to create an I frame. False to create an UI frame | |
senderNetwork | True if the sender is the network side of the data link | |
sapi | SAPI value | |
tei | TEI value | |
pf | Poll/final flag | |
data | Transmitted data |
const DataBlock& buffer | ( | ) | const [inline] |
Get the frame's buffer
Category category | ( | ) | [inline] |
Get the category of this frame
bool command | ( | ) | const [inline] |
Check if this frame is a command
static bool commandBit | ( | bool | network | ) | [inline, static] |
Get the command bit value for a given side of a data link
network | True for the network side, false for the user side of a data link |
u_int32_t dataLength | ( | ) | const [inline] |
Get the length of the data carried by this frame
Type error | ( | ) | const [inline] |
Get the error type
void getData | ( | DataBlock & | dest | ) | const [inline] |
Get the data transferred with this frame
dest | The destination buffer |
References DataBlock::assign().
u_int8_t headerLength | ( | ) | const [inline] |
Get the length of the frame's header
static bool isCommand | ( | u_int8_t | cr, | |
bool | senderNetwork | |||
) | [inline, static] |
Get the command/response type from C/R bit value and sender type
cr | The value of the C/R bit | |
senderNetwork | True if the sender is the network side of the data link |
const char* name | ( | ) | const [inline] |
Get the text associated with the frame's type
u_int8_t nr | ( | ) | const [inline] |
Get the transmitter receive sequence number
u_int8_t ns | ( | ) | const [inline] |
Get the transmitter send sequence number
static ISDNFrame* parse | ( | const DataBlock & | data, | |
ISDNLayer2 * | receiver | |||
) | [static] |
Parse a received data block
data | Data to parse | |
receiver | The receiver of the data |
bool poll | ( | ) | const [inline] |
Check if this frame is a poll (expect response) or a final one
static bool responseBit | ( | bool | network | ) | [inline, static] |
Get the response bit value for a given side of a data link
network | True for the network side, false for the user side of a data link |
u_int8_t sapi | ( | ) | const [inline] |
Get the SAPI of this frame
void sent | ( | bool | value | ) | [inline] |
Set transmitted flag
bool sent | ( | ) | const [inline] |
Check if the frame was sent
u_int8_t tei | ( | ) | const [inline] |
Get the TEI of this frame
void toString | ( | String & | dest, | |
bool | extendedDebug | |||
) | const |
Write this frame to a string for debug purposes
dest | The destination string | |
extendedDebug | True to dump message header and data |
Type type | ( | ) | const [inline] |
Get the type of this frame
static const char* typeName | ( | Type | type | ) | [inline, static] |
Get the text associated with the given frame type
type | Frame type to get the text for |
References TelEngine::lookup().
void update | ( | u_int8_t * | ns = 0 , |
|
u_int8_t * | nr = 0 | |||
) |
Update sequence numbers for I frames
ns | Optional update send sequence number | |
nr | Optional update receive sequence number |