Added support for reporting uptime for SS7 links and Q.921 interfaces.
git-svn-id: http://voip.null.ro/svn/yate@4231 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
48b2376c72
commit
555db7adb2
|
@ -160,6 +160,19 @@ void SS7Layer2::attach(SS7L2User* l2user)
|
|||
l2user->attach(this);
|
||||
}
|
||||
|
||||
void SS7Layer2::notify()
|
||||
{
|
||||
if (!operational())
|
||||
m_lastUp = 0;
|
||||
else if (!m_lastUp)
|
||||
m_lastUp = Time::secNow();
|
||||
m_l2userMutex.lock();
|
||||
RefPointer<SS7L2User> tmp = m_l2user;
|
||||
m_l2userMutex.unlock();
|
||||
if (tmp)
|
||||
tmp->notify(this);
|
||||
}
|
||||
|
||||
unsigned int SS7Layer2::status() const
|
||||
{
|
||||
return ProcessorOutage;
|
||||
|
|
|
@ -1752,6 +1752,7 @@ ISDNLayer2::ISDNLayer2(const NamedList& params, const char* name, u_int8_t tei)
|
|||
m_sapi(0),
|
||||
m_tei(0),
|
||||
m_ri(0),
|
||||
m_lastUp(0),
|
||||
m_checked(false),
|
||||
m_teiAssigned(false),
|
||||
m_autoRestart(true),
|
||||
|
@ -1902,6 +1903,10 @@ void ISDNLayer2::changeState(State newState, const char* reason)
|
|||
Lock lock(m_layerMutex);
|
||||
if (m_state == newState)
|
||||
return;
|
||||
if (Established != newState)
|
||||
m_lastUp = 0;
|
||||
else if (!m_lastUp)
|
||||
m_lastUp = Time::secNow();
|
||||
if (!m_teiAssigned && (newState != Released))
|
||||
return;
|
||||
DDebug(this,DebugInfo,"Changing state from '%s' to '%s'%s%s%s",
|
||||
|
|
|
@ -5154,6 +5154,13 @@ public:
|
|||
*/
|
||||
virtual bool operational() const = 0;
|
||||
|
||||
/**
|
||||
* Get the uptime of the link
|
||||
* @return Time since link got up in seconds
|
||||
*/
|
||||
unsigned int upTime() const
|
||||
{ return m_lastUp ? (Time::secNow() - m_lastUp) : 0; }
|
||||
|
||||
/**
|
||||
* Attach a Layer 2 user component to the data link. Detach from the old one if valid
|
||||
* @param l2user Pointer to Layer 2 user component to attach
|
||||
|
@ -5234,7 +5241,7 @@ protected:
|
|||
inline SS7Layer2()
|
||||
: m_autoEmergency(true), m_lastSeqRx(-1), m_congestion(0),
|
||||
m_l2userMutex(true,"SS7Layer2::l2user"), m_l2user(0), m_sls(-1),
|
||||
m_checkTime(0), m_checkFail(0), m_inhibited(Unchecked)
|
||||
m_checkTime(0), m_checkFail(0), m_inhibited(Unchecked), m_lastUp(0)
|
||||
{ }
|
||||
|
||||
/**
|
||||
|
@ -5266,14 +5273,7 @@ protected:
|
|||
/**
|
||||
* Notify out user part about a status change
|
||||
*/
|
||||
inline void notify()
|
||||
{
|
||||
m_l2userMutex.lock();
|
||||
RefPointer<SS7L2User> tmp = m_l2user;
|
||||
m_l2userMutex.unlock();
|
||||
if (tmp)
|
||||
tmp->notify(this);
|
||||
}
|
||||
void notify();
|
||||
|
||||
/**
|
||||
* Set and clear inhibition flags, method used by MTP3
|
||||
|
@ -5313,6 +5313,7 @@ private:
|
|||
u_int64_t m_checkTime;
|
||||
int m_checkFail;
|
||||
int m_inhibited;
|
||||
u_int32_t m_lastUp;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -8657,6 +8658,13 @@ public:
|
|||
inline bool autoRestart() const
|
||||
{ return m_autoRestart; }
|
||||
|
||||
/**
|
||||
* Get the uptime of the interface
|
||||
* @return Time since interface got up in seconds
|
||||
*/
|
||||
unsigned int upTime() const
|
||||
{ return m_lastUp ? (Time::secNow() - m_lastUp) : 0; }
|
||||
|
||||
/**
|
||||
* Implements Q.921 DL-ESTABLISH and DL-RELEASE request primitives
|
||||
* Descendants must implement this method to fullfill the request
|
||||
|
@ -8817,6 +8825,7 @@ private:
|
|||
u_int8_t m_sapi; // SAPI value
|
||||
u_int8_t m_tei; // TEI value
|
||||
u_int16_t m_ri; // Reference number
|
||||
u_int32_t m_lastUp; // Time when the interface got up
|
||||
bool m_checked; // Flag to indicate if the layer was checked
|
||||
bool m_teiAssigned; // The TEI status
|
||||
bool m_autoRestart; // True to restart when released
|
||||
|
|
|
@ -1780,7 +1780,7 @@ bool SigDriver::received(Message& msg, int id)
|
|||
return false;
|
||||
if (target.startSkip("links")) {
|
||||
msg.retValue() << "module=" << name();
|
||||
msg.retValue() << ",format=Type|Status;";
|
||||
msg.retValue() << ",format=Type|Status|Uptime;";
|
||||
|
||||
String ret;
|
||||
m_trunksMutex.lock();
|
||||
|
@ -2615,7 +2615,7 @@ void SigLinkSet::linkStatus(String& status)
|
|||
status.append(link->toString(),",") << "=";
|
||||
status << link->componentType() ;
|
||||
status << "|" << link->statusName();
|
||||
|
||||
status << "|" << link->upTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3116,6 +3116,7 @@ void SigIsdn::linkStatus(String& status)
|
|||
status.append(l2->toString(),",") << "=";
|
||||
status << l2->componentType();
|
||||
status << "|" << l2->stateName(l2->state());
|
||||
status << "|" << l2->upTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue