Added capability of configuring explicit routes per MTP3 linkset.
git-svn-id: http://yate.null.ro/svn/yate/trunk@3741 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
f76e9c61a3
commit
eda7784881
|
@ -466,6 +466,11 @@
|
|||
; Example: local=ITU,2-2-4
|
||||
;local=
|
||||
|
||||
; allowed: string: List of point codes explicitely allowed from this SS7 network
|
||||
; An empty or missing list will allow access to all known routes
|
||||
; Example: allowed=ITU,2-2-2,2-2-3,1001,2001,2002
|
||||
;allowed=
|
||||
|
||||
; router: string: Name of the SS7 Router to attach to
|
||||
; A boolean false value disables attaching a router (unlikely)
|
||||
; If no router is attached only a single User Part can be connected
|
||||
|
|
|
@ -469,6 +469,8 @@ SS7MTP3::SS7MTP3(const NamedList& params)
|
|||
¶ms,this,tmp.c_str());
|
||||
}
|
||||
#endif
|
||||
for (unsigned int i = 0; i < YSS7_PCTYPE_COUNT; i++)
|
||||
m_allowed[i] = 0;
|
||||
// Set point code type for each network indicator
|
||||
static const unsigned char ni[4] = { SS7MSU::International,
|
||||
SS7MSU::SpareInternational, SS7MSU::National, SS7MSU::ReservedNational };
|
||||
|
@ -519,12 +521,35 @@ SS7MTP3::SS7MTP3(const NamedList& params)
|
|||
m_checkT2 = 1000 * check;
|
||||
}
|
||||
buildRoutes(params);
|
||||
unsigned int n = params.length();
|
||||
for (unsigned int p = 0; p < n; p++) {
|
||||
NamedString* ns = params.getParam(p);
|
||||
if (!ns || (ns->name() != "allowed"))
|
||||
continue;
|
||||
ObjList* l = ns->split(',',false);
|
||||
ObjList* o = l->skipNull();
|
||||
if (o) {
|
||||
SS7PointCode::Type type = SS7PointCode::lookup(o->get()->toString());
|
||||
o = o->skipNext();
|
||||
if (o && (SS7PointCode::Other != type)) {
|
||||
unsigned int a = o->count();
|
||||
delete[] m_allowed[type-1];
|
||||
m_allowed[type-1] = new unsigned int[a+1];
|
||||
for (a = 0; o; o = o->skipNext())
|
||||
m_allowed[type-1][a++] = o->get()->toString().toInteger(-1);
|
||||
m_allowed[type-1][a] = 0;
|
||||
}
|
||||
}
|
||||
TelEngine::destruct(l);
|
||||
}
|
||||
setDumper(params.getValue("layer3dump"));
|
||||
}
|
||||
|
||||
SS7MTP3::~SS7MTP3()
|
||||
{
|
||||
setDumper();
|
||||
for (unsigned int i = 0; i < YSS7_PCTYPE_COUNT; i++)
|
||||
delete[] m_allowed[i];
|
||||
}
|
||||
|
||||
unsigned int SS7MTP3::countLinks()
|
||||
|
@ -728,6 +753,19 @@ void SS7MTP3::detach(SS7Layer2* link)
|
|||
}
|
||||
}
|
||||
|
||||
bool SS7MTP3::allowedTo(SS7PointCode::Type type, unsigned int packedPC) const
|
||||
{
|
||||
if (type >= SS7PointCode::DefinedTypes)
|
||||
return false;
|
||||
if (!m_allowed[type-1])
|
||||
return true;
|
||||
for (int i = 0; m_allowed[type-1][i]; i++) {
|
||||
if (packedPC == m_allowed[type-1][i])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SS7MTP3::control(Operation oper, NamedList* params)
|
||||
{
|
||||
bool ok = operational();
|
||||
|
|
|
@ -1039,13 +1039,24 @@ SS7Route::State SS7Router::getRouteView(SS7PointCode::Type type, unsigned int pa
|
|||
{
|
||||
if (type == SS7PointCode::Other || (unsigned int)type > YSS7_PCTYPE_COUNT || !packedPC)
|
||||
return SS7Route::Unknown;
|
||||
if (network && !network->allowedTo(type,packedPC)) {
|
||||
DDebug(this,DebugInfo,"View of %u from %u on %s is Prohibited",
|
||||
packedPC,remotePC,network->toString().c_str());
|
||||
return SS7Route::Prohibited;
|
||||
}
|
||||
SS7Route::State best = SS7Route::Unknown;
|
||||
for (ObjList* o = m_layer3.skipNull(); o; o = o->skipNext()) {
|
||||
SS7Layer3* l3 = *static_cast<L3ViewPtr*>(o->get());
|
||||
if (!l3 || (l3 == network))
|
||||
continue;
|
||||
if (!l3->getRoutePriority(type,remotePC))
|
||||
if (!l3->getRoutePriority(type,remotePC)) {
|
||||
if (!l3->allowedTo(type,packedPC)) {
|
||||
DDebug(this,DebugInfo,"View of %u from %u on %s is Prohibited",
|
||||
packedPC,remotePC,l3->toString().c_str());
|
||||
return SS7Route::Prohibited;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SS7Route::State state;
|
||||
if (l3->operational()) {
|
||||
state = l3->getRouteState(type,packedPC);
|
||||
|
|
|
@ -5675,6 +5675,15 @@ public:
|
|||
inline SS7Route::State getRouteState(SS7PointCode::Type type, const SS7PointCode& dest)
|
||||
{ return getRouteState(type,dest.pack(type)); }
|
||||
|
||||
/**
|
||||
* Check if access to a specific Point Code is allowed from this network
|
||||
* @param type Destination point code type
|
||||
* @param packedPC The destination point code
|
||||
* @return True if access to the specified Point Code is allowed
|
||||
*/
|
||||
virtual bool allowedTo(SS7PointCode::Type type, unsigned int packedPC) const
|
||||
{ return true; }
|
||||
|
||||
/**
|
||||
* Print the destinations or routing table to output
|
||||
*/
|
||||
|
@ -6988,6 +6997,14 @@ public:
|
|||
*/
|
||||
virtual bool control(NamedList& params);
|
||||
|
||||
/**
|
||||
* Check if access to a specific Point Code is allowed from this network
|
||||
* @param type Destination point code type
|
||||
* @param packedPC The destination point code
|
||||
* @return True if access to the specified Point Code is allowed
|
||||
*/
|
||||
virtual bool allowedTo(SS7PointCode::Type type, unsigned int packedPC) const;
|
||||
|
||||
/**
|
||||
* Get the total number of links attached
|
||||
* @return Number of attached data links
|
||||
|
@ -7085,6 +7102,8 @@ private:
|
|||
// maintenance check intervals (Q.707)
|
||||
u_int64_t m_checkT1;
|
||||
u_int64_t m_checkT2;
|
||||
// list of allowed point codes seen from this network
|
||||
unsigned int* m_allowed[YSS7_PCTYPE_COUNT];
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue