*** empty log message ***

git-svn-id: http://yate.null.ro/svn/yate/trunk@835 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2006-06-04 14:45:28 +00:00
parent ef287a29ca
commit 98bc9fd0a9
3 changed files with 94 additions and 2 deletions

View File

@ -95,6 +95,45 @@ String& TelEngine::operator<<(String& str, const SS7CodePoint& cp)
}
SS7Label::SS7Label()
: m_type(SS7CodePoint::Other), m_sls(0)
{
}
SS7Label::SS7Label(SS7CodePoint::Type type, const SS7MSU& msu)
: m_type(SS7CodePoint::Other), m_sls(0)
{
assign(type,msu);
}
bool SS7Label::assign(SS7CodePoint::Type type, const SS7MSU& msu)
{
unsigned int llen = length(type);
if (llen && llen < msu.length()) {
const unsigned char* s = (const unsigned char*) msu.data();
switch (type) {
case SS7CodePoint::ITU:
m_type = type;
// it's easier to pack/unpack than to pick all those bits separately
m_dpc.unpack(type,s[1] | ((s[2] & 0x3f) << 8));
m_spc.unpack(type,((s[2] & 0xc0) >> 6) | (s[3] << 2) | ((s[4] & 0x0f) << 10));
m_sls = (s[4] >> 4) & 0x0f;
return true;
return 4;
case SS7CodePoint::ANSI:
m_type = type;
m_dpc.assign(s[3],s[2],s[1]);
m_spc.assign(s[6],s[5],s[4]);
m_sls = s[7] & 0x1f;
return true;
// TODO: handle China and Japan
default:
break;
}
}
return false;
}
bool SS7Label::compatible(SS7CodePoint::Type type) const
{
switch (type) {

View File

@ -26,6 +26,11 @@
using namespace TelEngine;
SS7MTP3::SS7MTP3(SS7CodePoint::Type type)
: SS7Layer3(type)
{
}
void SS7MTP3::attach(SS7Layer2* link)
{
Debug(toString(),DebugStub,"Please implement SS7MTP3::attach()");
@ -35,6 +40,20 @@ void SS7MTP3::attach(SS7Layer2* link)
bool SS7MTP3::receivedMSU(const SS7MSU& msu, SS7Layer2* link)
{
Debug(toString(),DebugStub,"Please implement SS7MTP3::receivedMSU()");
unsigned int llen = SS7Label::length(type());
if (!llen)
return false;
// check MSU length against SIO + label length
if (msu.length() <= llen) {
XDebug(engine(),DebugMild,"Received short MSU of length %u [%p]",
msu.length(),this);
return false;
}
SS7Label label(type(),msu);
String tmp;
tmp << label;
DDebug(name(),DebugInfo,"MSU address: %s",tmp.c_str());
return false;
}

View File

@ -809,6 +809,26 @@ String& operator<<(String& str, const SS7CodePoint& cp);
class YSS7_API SS7Label
{
public:
/**
* Constructor of an empty, invalid label
*/
SS7Label();
/**
* Constructor from type and received MSU
* @param type Type of codepoint to use to decode the MSU
* @param msu A received MSU to be parsed
*/
SS7Label(SS7CodePoint::Type type, const SS7MSU& msu);
/**
* Assignment from type and received MSU
* @param type Type of codepoint to use to decode the MSU
* @param msu A received MSU to be parsed
* @return True if the assignment succeeded
*/
bool assign(SS7CodePoint::Type type, const SS7MSU& msu);
/**
* Check if the label is compatible with another packing type
* @return True if the DLC, SLC and SLS fit in the new packing format
@ -1163,12 +1183,20 @@ public:
inline SS7L3User* user() const
{ return m_l3user; }
/**
* Retrive the codepoint type of this Layer 3 component
* @return The type of codepoint this component is able to use
*/
inline SS7CodePoint::Type type() const
{ return m_cpType; }
protected:
/**
* Constructor
* @param type Codepoint type
*/
inline SS7Layer3()
: m_l3user(0)
inline SS7Layer3(SS7CodePoint::Type type = SS7CodePoint::Other)
: m_l3user(0), m_cpType(type)
{ }
/**
@ -1181,6 +1209,7 @@ protected:
private:
SS7L3User* m_l3user;
SS7CodePoint::Type m_cpType;
};
/**
@ -1412,6 +1441,11 @@ private:
class YSS7_API SS7MTP3 : public SS7Layer3, public SS7L2User
{
public:
/**
* Constructor
*/
SS7MTP3(SS7CodePoint::Type type = SS7CodePoint::Other);
/**
* Attach a SS7 Layer 2 (data link) to the network transport
* @param link Pointer to data link to attach