Added TCAP ANSI support.

git-svn-id: http://yate.null.ro/svn/yate/trunk@4594 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
oana 2011-09-12 12:34:40 +00:00
parent 50658629b1
commit 9ded877a15
5 changed files with 4068 additions and 10 deletions

View File

@ -826,3 +826,48 @@
; have the same ssn
;ssn=0
; Example of a SS7 Transaction Capabilities Application Part
; This component is created when encountering a section of this kind
;[ss7tcap]
; type: keyword: identifies the component as a SS7 Transfer Capabilities Application Part
; type = ss7-tcap-ansi for ANSI TCAP
; type = ss7-tcap-itu for ITU TCAP - not implemented yet
;type=
; local_SSN: local SubSystem Number. Mandatory
;local_SSN=
; default_remote_SSN: remote SubSystem Number to provide to SCCP if the application does not provide one
;default_remote_SSN=
; default_remote_pointcode: remote Point Code to provide to SCCP if the application does not provide one
;default_remote_pointcode=
; pointcodetype: remote Point Code type. See above documentation for available types
;pointcodetype=
; sccp: Name of the SCCP component to create and be used by this TCAP
; A section with the name given here must exist in order to configure the SCCP level
;sccp=
; transact_timeout: Time in seconds to timeout a TCAP transaction after no more activity was registered on it
; Defaults to 300 seconds
;transact_timeout=300
;print-messages: Boolean to enable/disable printing of decoding/encoding of TCAP messages
; This option applies on reload
;print-messages=false
;extended-debug: Boolean to enable/disable printing of the step-by-step decoding/encoding of TCAP messages
; This option applies on reload. print-messages must be true.
;extended-debug=false
[tcapuser_test]
; mimicks a TCAP User, which emits and receives TCAP messages in Message form
; type is ss7-tcap-user to identify it as the specific user
;type=ss7-tcap-user
; tcap: The TCAP to which this user is to attach itself to it
;tcap=

View File

@ -7,11 +7,12 @@ CXX := @CXX@ -Wall
AR := ar
DEFS :=
LIBTHR := @THREAD_LIB@
INCLUDES := -I@top_srcdir@ -I../.. -I@srcdir@
INCLUDES := -I@top_srcdir@ -I../.. -I@srcdir@ -I../yasn
CFLAGS := @CFLAGS@ @MODULE_CPPFLAGS@ @INLINE_FLAGS@
LDFLAGS:= @LDFLAGS@
SONAME_OPT := @SONAME_OPT@
YATELIBS := -L../.. -lyate @LIBS@
YASNLIB := -L../yasn -lyasn
INCFILES := @top_srcdir@/yateclass.h @srcdir@/yatesig.h
PROGS= yate-ss7test
@ -24,6 +25,7 @@ OBJS = engine.o address.o sigcall.o sigtran.o \
LIBD_VER:= libyatesig.so.@PACKAGE_VERSION@
LIBD_DEV:= libyatesig.so
LIBD:= ../../$(LIBD_VER) ../../$(LIBD_DEV)
YASN:= ../yasn/libyasn.a
DOCS = classes.png
LOCALFLAGS =
@ -65,8 +67,8 @@ clean:
Makefile: @srcdir@/Makefile.in ../../config.status
cd ../.. && ./config.status
../../$(LIBD_VER): $(OBJS)
$(LINK) -o $@ $(SONAME_OPT)$(LIBD_VER) $^ $(YATELIBS)
../../$(LIBD_VER): $(OBJS) $(YASN)
$(LINK) -o $@ $(SONAME_OPT)$(LIBD_VER) $^ $(YASNLIB) $(YATELIBS)
../../$(LIBD_DEV): ../../$(LIBD_VER)
cd ../.. && ln -sf $(LIBD_VER) $(LIBD_DEV)
@ -77,6 +79,9 @@ yate-%: @srcdir@/main-%.cpp $(MKDEPS) $(LIBS) ../../libyate.so $(INCFILES)
$(LIBS): $(OBJS)
$(AR) rcs $@ $^
$(YASN):
$(MAKE) -C ../yasn
yate-ss7test: LOCALLIBS += -L. -lyatesig
%.png: @srcdir@/%.dia

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -46,6 +46,9 @@ class SigTrunkThread; // Get events and check timeout for tru
class IsupDecodeHandler; // Handler for "isup.decode" message
class IsupEncodeHandler; // Handler for "isup.encode" message
class SigNotifier; // Class for handling received notifications
class SigSS7Tcap; // SS7 TCAP - Transaction Capabilities Application Part
class SigTCAPUser; // Default TCAP user
class TCAPMsgHandler; // TCAP Message handler
// The signalling channel
class SigChannel : public Channel
@ -538,6 +541,56 @@ private:
unsigned char m_idleValue; // Idle value for source multiplexer to fill when no data
};
class SigSS7Tcap : public SigTopmost
{
public:
inline SigSS7Tcap(const char* name)
: SigTopmost(name), m_tcap(0)
{ }
// Initialize (create or reload) the TCAP component
// Return false on failure
virtual bool initialize(NamedList& params);
// Return the status of this component
virtual void status(String& retVal);
protected:
virtual void destroyed();
private:
SS7TCAP* m_tcap;
};
class SigTCAPUser : public SigTopmost, public TCAPUser
{
YCLASS(SigTCAPUser,TCAPUser)
public:
inline SigTCAPUser(const char* name)
: SigTopmost(name),
TCAPUser(name), m_handler(0)
{ }
virtual ~SigTCAPUser();
// { }
// Initialize the TCAP user
// Return false on failure
virtual bool initialize(NamedList& params);
virtual bool tcapRequest(NamedList& params);
virtual bool tcapIndication(NamedList& params);
// Return the status of this component
virtual void status(String& retVal);
protected:
TCAPMsgHandler* m_handler;
String m_tcapName;
virtual void destroyed();
};
class TCAPMsgHandler : public MessageHandler
{
public:
TCAPMsgHandler(SigTCAPUser* user);
virtual bool received(Message& msg);
virtual void destruct();
private:
SigTCAPUser* m_user;
};
// Factory for locally configured components
class SigFactory : public SignallingFactory
{
@ -567,6 +620,10 @@ public:
SigSS7M2PA = 0x21 | SigOnDemand,
SigSS7M2UA = 0x22 | SigOnDemand,
SigSS7M3UA = 0x23 | SigTopMost,
SigSS7TCAP = 0x24 | SigTopMost,
SigSS7TCAPANSI = 0x25 | SigTopMost,
SigSS7TCAPITU = 0x26 | SigTopMost,
SigTCAPUser = 0x27 | SigTopMost,
SigISDNIUAClient = 0x31 | SigDefaults,
SigISDNIUAGateway = 0x32 | SigTopMost,
SigSS7M2UAClient = 0x33 | SigDefaults,
@ -817,6 +874,9 @@ const TokenDict SigFactory::s_compNames[] = {
{ "ss7-sccp-itu-mgm", SigSS7ItuSccpManagement },
{ "ss7-sccp-ansi-mgm",SigSS7AnsiSccpManagement },
{ "ss7-gtt", SigSccpGtt },
{ "ss7-tcap-ansi", SigSS7TCAPANSI },
{ "ss7-tcap-itu", SigSS7TCAPITU },
{ "ss7-tcap-user", SigTCAPUser },
{ "isdn-pri-net", SigISDNPN },
{ "isdn-bri-net", SigISDNBN },
{ "isdn-pri-cpe", SigISDNPC },
@ -855,6 +915,10 @@ const TokenDict SigFactory::s_compClass[] = {
MAKE_CLASS(SS7ItuSccpManagement),
MAKE_CLASS(SS7AnsiSccpManagement),
MAKE_CLASS(SCCPUserDummy),
MAKE_CLASS(SS7TCAP),
MAKE_CLASS(SS7TCAPANSI),
MAKE_CLASS(SS7TCAPITU),
MAKE_CLASS(TCAPUser),
MAKE_CLASS(ISDNPN),
MAKE_CLASS(ISDNBN),
MAKE_CLASS(ISDNPC),
@ -946,6 +1010,12 @@ SignallingComponent* SigFactory::create(const String& type, const NamedList& nam
return new SS7ItuSccpManagement(*config);
case SigSS7AnsiSccpManagement:
return new SS7AnsiSccpManagement(*config);
case SigSS7TCAP:
if (ty) {
if (*ty == "ss7-tcap-ansi")
return new SS7TCAPANSI(*config);
}
return 0;
}
return 0;
}
@ -2787,6 +2857,13 @@ bool SigDriver::initTopmost(NamedList& sect, int type)
case SigFactory::SigSccpGtt:
topmost = new SigSccpGtt(sect);
break;
case SigFactory::SigSS7TCAPANSI:
case SigFactory::SigSS7TCAPITU:
topmost = new SigSS7Tcap(sect);
break;
case SigFactory::SigTCAPUser:
topmost = new SigTCAPUser(sect);
break;
default:
return false;
}
@ -3882,6 +3959,118 @@ void SigIsdnMonitor::release()
XDebug(&plugin,DebugAll,"SigIsdnMonitor('%s'). Released [%p]",name().c_str(),this);
}
/**
* SigSS7Tcap
*/
void SigSS7Tcap::destroyed()
{
DDebug(&plugin,DebugAll,"SigSS7TCAP::destroyed() [%p]",this);
TelEngine::destruct(m_tcap);
SigTopmost::destroyed();
}
bool SigSS7Tcap::initialize(NamedList& params)
{
if (!m_tcap) {
String type = params.getValue("type","");
m_tcap = YSIGCREATE(SS7TCAP,&params);
if (m_tcap)
plugin.engine()->insert(m_tcap);
}
return m_tcap && m_tcap->initialize(&params);
}
void SigSS7Tcap::status(String& retVal)
{
retVal << "type=" << (m_tcap ? m_tcap->componentType() : "");
NamedList p("");
m_tcap->status(p);
retVal << ",totalIncoming=" << p.getValue("totalIncoming","0");
retVal << ",totalOutgoing=" << p.getValue("totalOutgoing","0");
retVal << ",totalDiscarded=" << p.getValue("totalDiscarded","0");
retVal << ",totalNormal=" << p.getValue("totalNormal","0");
retVal << ",totalAbnormal=" << p.getValue("totalAbnormal","0");
}
/**
* SigTCAPUser
*/
SigTCAPUser::~SigTCAPUser()
{
DDebug(&plugin,DebugAll,"SigTCAPUser::~SigTCAPUser() [%p]",this);
if (!TelEngine::null(m_handler))
TelEngine::destruct(m_handler);
}
bool SigTCAPUser::initialize(NamedList& params)
{
DDebug(&plugin,DebugAll,"SigTCAPUser::initialize() [%p]",this);
m_tcapName = params.getValue("tcap","");
if (!m_handler) {
m_handler = new TCAPMsgHandler(this);
Engine::install(m_handler);
}
return true;
}
bool SigTCAPUser::tcapRequest(NamedList& params)
{
if (!tcap()) {
SignallingComponent* tcap = 0;
if (!(tcap = plugin.engine()->find(m_tcapName,"SS7TCAP",tcap))) {
//TODO createTCAP ?
}
else
attach(YOBJECT(SS7TCAP,tcap));
}
if (tcap()) {
SS7TCAPError err = tcap()->userRequest(params);
return err.error() != SS7TCAPError::NoError;
}
return false;
}
bool SigTCAPUser::tcapIndication(NamedList& params)
{
Message msg("tcap.indication");
msg.copyParams(params);
return Engine::dispatch(&msg);
}
void SigTCAPUser::status(String& retVal)
{
}
void SigTCAPUser::destroyed()
{
DDebug(&plugin,DebugAll,"SigTCAPUser::destroyed() [%p]",this);
Engine::uninstall(m_handler);
attach(0);
SigTopmost::destroyed();
}
/**
* TCAPMsgHandler
*/
TCAPMsgHandler::TCAPMsgHandler(SigTCAPUser* user)
: MessageHandler("tcap.request"),
m_user(user)
{
DDebug(&plugin,DebugAll,"TCAPMsgHandler created [%p]",this);
}
bool TCAPMsgHandler::received(Message& msg)
{
return (m_user && m_user->tcapRequest(msg));
}
void TCAPMsgHandler::destruct()
{
DDebug(&plugin,DebugAll,"TCAPMsgHandler::destroyed() [%p]",this);
m_user = 0;
MessageHandler::destruct();
}
/**
* SigConsumerMux
*/