Yate
yatesig.h
1
21
22#ifndef __YATESIG_H
23#define __YATESIG_H
24
25#include <yateclass.h>
26
27#ifdef _WINDOWS
28
29#ifdef LIBYSIG_EXPORTS
30#define YSIG_API __declspec(dllexport)
31#else
32#ifndef LIBYSIG_STATIC
33#define YSIG_API __declspec(dllimport)
34#endif
35#endif
36
37#endif /* _WINDOWS */
38
39#ifndef YSIG_API
40#define YSIG_API
41#endif
42
46namespace TelEngine {
47
48// Signalling classes
49class SignallingDumper; // A generic data dumper
50class SignallingDumpable; // A component that can dump data
51class SignallingNotifier; // A signalling notifier
52class SignallingTimer; // A signalling timer
53class SignallingCounter; // A signalling counter
54class SignallingFactory; // A signalling component factory
55class SignallingComponent; // Abstract signalling component that can be managed by the engine
56class SignallingEngine; // Main signalling component holder
57class SignallingThreadPrivate; // Engine private thread
58class SignallingMessage; // Abstract signalling message
59class SignallingCallControl; // Abstract phone call signalling
60class SignallingCall; // Abstract single phone call
61class SignallingEvent; // A single signalling related event
62class SignallingCircuitEvent; // A single signalling circuit related event
63class SignallingCircuit; // Abstract data circuit used by signalling
64class SignallingCircuitRange; // A circuit range (set of circuits)
65class SignallingCircuitGroup; // Group of data circuits used by signalling
66class SignallingCircuitSpan; // A span in a circuit group
67class SignallingInterface; // Abstract digital signalling interface (hardware access)
68class SignallingReceiver; // Abstract Layer 2 packet data receiver
69struct SignallingFlags; // Description of parameter flags
70class SignallingUtils; // Library wide services and data provider
71class SignallingMessageTimer; // A pending signalling message
72class SignallingMessageTimerList; // A pending signalling message list
73// Analog lines
74class AnalogLine; // An analog line
75class AnalogLineEvent; // A single analog line related event
76class AnalogLineGroup; // A group of analog lines
77// SS7
78class SS7PointCode; // SS7 Code Point
79class SS7Label; // SS7 Routing Label
80class SS7MSU; // A block of data that holds a Message Signal Unit
81class SIGTRAN; // Abstract SIGTRAN component
82class SIGTransport; // Abstract transport for SIGTRAN
83class SIGAdaptation; // Abstract Adaptation style SIGTRAN
84class SIGAdaptClient; // Client side of adaptation (ASP)
85class SIGAdaptServer; // Server side of adaptation (SG)
86class SIGAdaptUser; // Abstract Adaptation User SIGTRAN
87class ASPUser; // Abstract SS7 ASP user interface
88class SCCP; // Abstract SS7 SCCP interface
89class GTT; // Abstract SCCP Global Title Translation interface
90class SCCPManagement; // Abstract SCCP Management interface
91class SCCPUser; // Abstract SS7 SCCP user interface
92class TCAPUser; // Abstract SS7 TCAP user interface
93class SS7L2User; // Abstract user of SS7 layer 2 (data link) message transfer part
94class SS7Layer2; // Abstract SS7 layer 2 (data link) message transfer part
95class SS7L3User; // Abstract user of SS7 layer 3 (network) message transfer part
96class SS7Layer3; // Abstract SS7 layer 3 (network) message transfer part
97class SS7Layer4; // Abstract SS7 layer 4 (application) protocol
98class SS7Route; // A SS7 MSU route
99class SS7Router; // Main router for SS7 message transfer and applications
100class SS7M2PA; // SIGTRAN MTP2 User Peer-to-Peer Adaptation Layer
101class SS7M2UA; // SIGTRAN MTP2 User Adaptation Layer
102class SS7M3UA; // SIGTRAN MTP3 User Adaptation Layer
103class SS7MTP2; // SS7 Layer 2 implementation on top of a hardware interface
104class SS7MTP3; // SS7 Layer 3 implementation on top of Layer 2
105class SS7MsgSNM; // SNM signalling message
106class SS7MsgMTN; // MTN signalling message
107class SS7MsgISUP; // ISUP signalling message
108class SS7MsgSCCP; // SCCP signalling message
109class SS7Management; // SS7 SNM implementation
110class SS7ISUPCall; // A SS7 ISUP call
111class SS7ISUP; // SS7 ISUP implementation
112class SS7BICC; // SS7 BICC implementation
113class SS7TUP; // SS7 TUP implementation
114class SS7SCCP; // SS7 SCCP implementation
115class SccpSubsystem; // Helper class to keep a SCCP subsystem
116class SccpLocalSubsystem; // Helper class to keep s sccp local subsystem informations
117class SccpRemote; // Helper class to keep a remote sccp
118class SS7AnsiSccpManagement; // SS7 SCCP management implementation for ANSI
119class SS7ItuSccpManagement; // SS7 SCCP management implementation for ITU
120class SS7SUA; // SIGTRAN SCCP User Adaptation Layer
121class SS7ASP; // SS7 ASP implementation
122class SS7TCAPMessage; // SS7 TCAP message wrapper
123class SS7TCAPError; // SS7 TCAP errors
124class SS7TCAP; // SS7 TCAP implementation
125class SS7TCAPTransaction; // SS7 TCAP transaction base class
126class SS7TCAPComponent; // SS7 TCAP component
127class SS7TCAPANSI; // SS7 ANSI TCAP implementation
128class SS7TCAPTransactionANSI; // SS7 TCAP ANSI Transaction
129class SS7TCAPITU; // SS7 ITU TCAP implementation
130class SS7TCAPTransactionITU; // SS7 TCAP ITU Transaction
131// ISDN
132class ISDNLayer2; // Abstract ISDN layer 2 (Q.921) message transport
133class ISDNLayer3; // Abstract ISDN layer 3 (Q.931) message transport
134class ISDNFrame; // An ISDN Q.921 frame
135class ISDNQ921; // ISDN Q.921 implementation on top of a hardware interface
136class ISDNQ921Passive; // Stateless ISDN Q.921 implementation on top of a hardware interface
137class ISDNQ921Management; // ISDN Layer 2 BRI TEI management or PRI with D-channel(s) backup
138class ISDNIUA; // SIGTRAN ISDN Q.921 User Adaptation Layer
139class ISDNQ931IE; // A Q.931 ISDN Layer 3 message Information Element
140class ISDNQ931Message; // A Q.931 ISDN Layer 3 message
141class ISDNQ931IEData; // A Q.931 message IE data processor
142class ISDNQ931State; // Q.931 ISDN call and call controller state
143class ISDNQ931Call; // A Q.931 ISDN call
144class ISDNQ931CallMonitor; // A Q.931 ISDN call monitor
145class ISDNQ931ParserData; // Q.931 message parser data
146class ISDNQ931; // ISDN Q.931 implementation on top of Q.921
147class ISDNQ931Monitor; // ISDN Q.931 implementation on top of Q.921 of call controller monitor
148
149// Macro to create a factory that builds a component by class name
150#define YSIGFACTORY(clas) \
151class clas ## Factory : public SignallingFactory \
152{ \
153protected: \
154virtual SignallingComponent* create(const String& type, NamedList& name) \
155 { return (type == #clas) ? new clas : 0; } \
156}; \
157static clas ## Factory s_ ## clas ## Factory
158
159// Macro to create a factory that calls a component's static create method
160#define YSIGFACTORY2(clas) \
161class clas ## Factory : public SignallingFactory \
162{ \
163protected: \
164virtual SignallingComponent* create(const String& type, NamedList& name) \
165 { return clas::create(type,name); } \
166}; \
167static clas ## Factory s_ ## clas ## Factory
168
169// Macro to call the factory creation method and return the created component
170#define YSIGCREATE(type,name) (static_cast<type*>(SignallingFactory::buildInternal(#type,name)))
171
176class YSIG_API SignallingDumper
177{
178public:
182 enum Type {
183 Raw,
184 Hexa,
185 Hdlc,
186 Q921,
187 Q931,
188 Mtp2,
189 Mtp3,
190 Sccp,
191 };
192
198 SignallingDumper(Type type = Hexa, bool network = false);
199
204
209 inline Type type() const
210 { return m_type; }
211
216 inline bool network() const
217 { return m_network; }
218
223 bool active() const;
224
228 void terminate();
229
235 void setStream(Stream* stream = 0, bool writeHeader = true);
236
245 bool dump(void* buf, unsigned int len, bool sent = false, int link = 0);
246
254 inline bool dump(const DataBlock& data, bool sent = false, int link = 0)
255 { return dump(data.data(),data.length(),sent,link); }
256
267 static SignallingDumper* create(DebugEnabler* dbg, const char* filename, Type type,
268 bool network = false, bool create = true, bool append = false);
269
278 static SignallingDumper* create(Stream* stream, Type type, bool network = false, bool writeHeader = true);
279
280private:
281 void head();
282 Type m_type;
283 bool m_network;
284 Stream* m_output;
285};
286
291class YSIG_API SignallingDumpable
292{
293public:
298 { setDumper(); }
299
300protected:
306 inline SignallingDumpable(SignallingDumper::Type type, bool network = false)
307 : m_type(type), m_dumpNet(network), m_dumper(0)
308 { }
309
318 inline bool dump(void* buf, unsigned int len, bool sent = false, int link = 0)
319 { return (m_dumper && m_dumper->dump(buf,len,sent,link)); }
320
328 inline bool dump(const DataBlock& data, bool sent = false, int link = 0)
329 { return dump(data.data(),data.length(),sent,link); }
330
335 inline void setDumpNetwork(bool network)
336 { m_dumpNet = network; }
337
342 void setDumper(SignallingDumper* dumper = 0);
343
351 bool setDumper(const String& name, bool create = true, bool append = false);
352
359 bool control(NamedList& params, SignallingComponent* owner = 0);
360
361private:
363 bool m_dumpNet;
364 SignallingDumper* m_dumper;
365};
366
371
372class YSIG_API SignallingNotifier
373{
374public:
378 virtual inline ~SignallingNotifier()
379 { cleanup(); }
380
384 virtual void notify(NamedList& notifs);
388 virtual void cleanup();
389};
390
395class YSIG_API SignallingTimer
396{
397public:
403 inline SignallingTimer(u_int64_t interval, u_int64_t time = 0)
404 : m_interval(interval), m_timeout(0)
405 { if (time) start(time); }
406
411 inline void interval(u_int64_t value)
412 { m_interval = value; }
413
424 inline void interval(const NamedList& params, const char* param,
425 unsigned int minVal, unsigned int defVal, bool allowDisable, bool sec = false) {
426 m_interval = getInterval(params,param,minVal,defVal,0,allowDisable);
427 if (sec)
428 m_interval *= 1000;
429 }
430
435 inline u_int64_t interval() const
436 { return m_interval; }
437
442 inline u_int64_t fireTime() const
443 { return m_timeout; }
444
449 inline void start(u_int64_t time = Time::msecNow())
450 { if (m_interval) m_timeout = time + m_interval; }
451
456 inline void fire(u_int64_t time = Time::msecNow())
457 { m_timeout = time; }
458
462 inline void stop()
463 { m_timeout = 0; }
464
469 inline bool started() const
470 { return m_timeout > 0; }
471
477 inline bool timeout(u_int64_t time = Time::msecNow()) const
478 { return started() && (m_timeout < time); }
479
490 static unsigned int getInterval(const NamedList& params, const char* param,
491 unsigned int minVal, unsigned int defVal, unsigned int maxVal = 0,
492 bool allowDisable = false);
493
494private:
495 u_int64_t m_interval; // Timer interval
496 u_int64_t m_timeout; // Timeout value
497};
498
503class YSIG_API SignallingCounter
504{
505public:
510 inline SignallingCounter(u_int32_t maxVal)
511 : m_max(maxVal), m_count(0)
512 { }
513
518 inline void maxVal(u_int32_t value)
519 { m_max = value; }
520
525 inline u_int32_t maxVal() const
526 { return m_max; }
527
532 inline u_int32_t count() const
533 { return m_count; }
534
539 inline void reset(bool down = true)
540 { m_count = down ? 0 : m_max; }
541
546 inline bool inc()
547 {
548 if (full())
549 return false;
550 m_count++;
551 return true;
552 }
553
558 inline bool dec()
559 {
560 if (empty())
561 return false;
562 m_count--;
563 return true;
564 }
565
570 inline bool empty() const
571 { return m_count == 0; }
572
577 inline bool full() const
578 { return m_count == maxVal(); }
579
580private:
581 u_int32_t m_max; // Maximum counter value
582 u_int32_t m_count; // Current counter value
583};
584
589class YSIG_API SignallingFactory : public GenObject
590{
591public:
596 SignallingFactory(bool fallback = false);
597
602
609 static SignallingComponent* build(const String& type, NamedList* name = 0);
610
617 static void* buildInternal(const String& type, NamedList* name);
618
619protected:
626 virtual SignallingComponent* create(const String& type, NamedList& name) = 0;
627};
628
634class YSIG_API SignallingComponent : public RefObject, public DebugEnabler
635{
637 friend class SignallingEngine;
638public:
643
648 virtual const String& toString() const;
649
655 virtual bool initialize(const NamedList* config);
656
664 static bool resolveConfig(const String& cmpName, NamedList& params, const NamedList* config);
665
671 virtual bool control(NamedList& params);
672
678 virtual NamedList* controlCreate(const char* oper = 0);
679
685 virtual bool controlExecute(NamedList* params);
686
692 virtual void engine(SignallingEngine* eng);
693
698 inline SignallingEngine* engine() const
699 { return m_engine; }
700
706 inline int debugLevel(int level)
707 { return (level >= 0) ? DebugEnabler::debugLevel(level) : DebugEnabler::debugLevel(); }
708
713 inline const String& componentType() const
714 { return m_compType; }
715
716protected:
723 SignallingComponent(const char* name = 0, const NamedList* params = 0, const char* type = "unknown");
724
729 virtual void destroyed();
730
736 void insert(SignallingComponent* component);
737
744 virtual void detach();
745
750 virtual void timerTick(const Time& when);
751
756 void setName(const char* name);
757
762 inline void setCompType(const char* type)
763 { m_compType = type; }
764
771 unsigned long tickSleep(unsigned long usec = 1000000) const;
772
773private:
774 SignallingEngine* m_engine;
775 String m_name;
776 String m_compType;
777};
778
784class YSIG_API SignallingEngine : public DebugEnabler, public Mutex
785{
786 friend class SignallingComponent;
787 friend class SignallingThreadPrivate;
788public:
793 SignallingEngine(const char* name = "signalling");
794
799
805 static SignallingEngine* self(bool create = false);
806
811 void insert(SignallingComponent* component);
812
817 void remove(SignallingComponent* component);
818
824 bool remove(const String& name);
825
831 SignallingComponent* find(const String& name);
832
840 SignallingComponent* find(const String& name, const String& type, const SignallingComponent* start = 0);
841
850 SignallingComponent* build(const String& type, NamedList& params, bool init = false, bool ref = true);
851
857 bool control(NamedList& params);
858
864 bool find(const SignallingComponent* component);
865
871 void notify(SignallingComponent* component, NamedList notifs);
872
880 bool start(const char* name = "Sig Engine", Thread::Priority prio = Thread::Normal, unsigned long usec = 0);
881
885 void stop();
886
891 inline void setNotifier(SignallingNotifier* notifier)
892 { m_notifier = notifier; }
893
898 inline void removeNotifier(SignallingNotifier* notifier)
899 {
900 if (m_notifier == notifier)
901 m_notifier = 0;
902 }
903
908 Thread* thread() const;
909
916 unsigned long tickSleep(unsigned long usec = 1000000);
917
922 inline unsigned long tickDefault() const
923 { return m_usecSleep; }
924
929 inline static long maxLockWait()
930 { return s_maxLockWait; }
931
936 static void maxLockWait(long maxWait);
937
943 template <class Obj> static inline void destruct(Obj*& obj)
944 {
945 if (!obj)
946 return;
947 if (obj->engine())
948 obj->engine()->remove(obj);
949 TelEngine::destruct(obj);
950 }
951
952protected:
958 virtual unsigned long timerTick(const Time& when);
959
964
965private:
966 SignallingThreadPrivate* m_thread;
967 SignallingNotifier* m_notifier;
968 unsigned long m_usecSleep;
969 unsigned long m_tickSleep;
970 static long s_maxLockWait;
971};
972
977class YSIG_API SignallingMessage : public RefObject
978{
980public:
985 inline SignallingMessage(const char* name = 0)
986 : m_params(name)
987 { }
988
993 inline const char* name() const
994 { return m_params.c_str(); }
995
1001 { return m_params; }
1002
1007 inline const NamedList& params() const
1008 { return m_params; }
1009
1010protected:
1015};
1016
1021class YSIG_API SignallingCallControl : public Mutex
1022{
1023 friend class SignallingCall;
1024 friend class SS7ISUPCall;
1025 friend class ISDNQ931Call;
1026 friend class ISDNQ931CallMonitor;
1027public:
1028
1033 MediaNever,
1034 MediaAnswered,
1035 MediaRinging,
1036 MediaAlways
1037 };
1038
1045 SignallingCallControl(const NamedList& params, const char* msgPrefix = 0);
1046
1051
1056 inline const String& location() const
1057 { return m_location; }
1058
1062 inline void setExiting()
1063 { m_exiting = true; }
1064
1069 inline bool exiting() const
1070 { return m_exiting; }
1071
1076 inline bool verify()
1077 {
1078 Lock lock(this);
1079 if (!m_verifyEvent)
1080 return false;
1081 m_verifyEvent = false;
1082 return true;
1083 }
1084
1090 { return m_mediaRequired; }
1091
1097 inline const String& msgPrefix() const
1098 { return m_msgPrefix; }
1099
1105 { return m_circuits; }
1106
1111 inline const ObjList& calls() const
1112 { return m_calls; }
1113
1118 virtual const char* statusName() const = 0;
1119
1129
1146 bool reserveCircuit(SignallingCircuit*& cic, const char* range = 0, int checkLock = -1,
1147 const String* list = 0, bool mandatory = true, bool reverseRestrict = false);
1148
1156 bool releaseCircuit(SignallingCircuit*& cic, bool sync = false);
1157
1165 bool releaseCircuit(unsigned int code, bool sync = false);
1166
1171 virtual void cleanup(const char* reason = "net-out-of-order")
1172 { }
1173
1179 virtual SignallingEvent* getEvent(const Time& when);
1180
1187 virtual SignallingCall* call(SignallingMessage* msg, String& reason)
1188 { reason = "not-implemented"; return 0; }
1189
1194 virtual void buildVerifyEvent(NamedList& params)
1195 { }
1196
1197protected:
1202 inline int strategy() const
1203 { return m_strategy; }
1204
1212 virtual bool processEvent(SignallingEvent* event)
1213 { return false; }
1214
1222 SignallingCall* call = 0)
1223 { TelEngine::destruct(event); return 0; }
1224
1229
1235 void removeCall(SignallingCall* call, bool del = false);
1236
1243 void setVerify(bool restartTimer = false, bool fireNow = false, const Time* time = 0);
1244
1249
1255
1260
1266
1271
1276
1281
1282private:
1283 SignallingCircuitGroup* m_circuits; // Circuit group
1284 int m_strategy; // Strategy to allocate circuits for outgoing calls
1285 bool m_exiting; // Call control is terminating. Generate a Disable event when no more calls
1286};
1287
1292class YSIG_API SignallingCall : public RefObject, public Mutex
1293{
1294public:
1302
1307
1312 inline bool outgoing() const
1313 { return m_outgoing; }
1314
1319 { return m_controller; }
1320
1325 inline void userdata(void* data)
1326 { m_private = data; }
1327
1332 inline void* userdata() const
1333 { return m_private; }
1334
1339 inline bool signalOnly() const
1340 { return m_signalOnly; }
1341
1346 inline bool overlapDialing() const
1347 { return m_overlap; }
1348
1354 virtual bool sendEvent(SignallingEvent* event)
1355 { return false; }
1356
1363 virtual SignallingEvent* getEvent(const Time& when) = 0;
1364
1371 virtual void eventTerminated(SignallingEvent* event);
1372
1373protected:
1380
1387 SignallingMessage* dequeue(bool remove = true);
1388
1393 {
1394 Lock lock(m_inMsgMutex);
1395 m_inMsg.clear();
1396 }
1397
1402
1407
1408private:
1409 SignallingCallControl* m_controller; // Call controller this call belongs to
1410 bool m_outgoing; // Call direction
1411 bool m_signalOnly; // Just signalling flag
1412 ObjList m_inMsg; // Incoming messages queue
1413 Mutex m_inMsgMutex; // Lock incoming messages queue
1414 void* m_private; // Private user data
1415};
1416
1421class YSIG_API SignallingEvent
1422{
1423public:
1427 enum Type {
1428 Unknown = 0,
1429 Generic,
1430 // Call related
1431 NewCall,
1432 Accept,
1433 Connect,
1434 Complete,
1435 Progress,
1436 Ringing,
1437 Answer,
1438 Transfer,
1439 Suspend,
1440 Resume,
1441 Release,
1442 Info,
1443 Charge,
1444 // Non-call related
1445 Message,
1446 Facility,
1447 Circuit,
1448 // Controller related
1449 Enable,
1450 Disable,
1451 Reset,
1452 Verify,
1453 };
1454
1462
1470
1477
1482
1487 inline const char* name() const
1488 { return typeName(type()); }
1489
1494 inline Type type() const
1495 { return m_type; }
1496
1500 inline SignallingCall* call() const
1501 { return m_call; }
1502
1507 { return m_message; }
1508
1513 { return m_controller; }
1514
1519 { return m_cicEvent; }
1520
1526 static inline const char* typeName(Type t)
1527 { return lookup(t,s_types,0); }
1528
1534
1535private:
1536 Type m_type;
1537 SignallingMessage* m_message;
1538 SignallingCall* m_call;
1539 SignallingCallControl* m_controller;
1540 SignallingCircuitEvent* m_cicEvent;
1541 static const TokenDict s_types[];
1542};
1543
1548class YSIG_API SignallingCircuitEvent : public NamedList
1549{
1550public:
1554 enum Type {
1555 Unknown = 0,
1556 Dtmf = 1, // Transfer tones: param: tone
1557 GenericTone = 2, // Play or detect tones: param: tone
1558 // Analog line events
1559 Timeout = 10, //
1560 Polarity = 11, // Line's polarity changed
1561 StartLine = 15, // Initialize FXO line
1562 LineStarted = 16, // FXO line initialized: send number
1563 DialComplete = 17, // FXO line completed dialing the number
1564 OnHook = 20, // The hook is down
1565 OffHook = 21, // The hook is up
1566 RingBegin = 22, // Start ringing
1567 RingEnd = 23, // Stop ringing
1568 RingerOn = 30, // An FXS started the FXO's ringer
1569 RingerOff = 31, // An FXS stopped the FXO's ringer
1570 Wink = 32, // On hook momentarily
1571 Flash = 33, // Off hook momentarily
1572 PulseStart = 40, // Pulse dialing start
1573 PulseDigit = 41, // Transfer pulse digits: param: pulse
1574 // Remote circuit events
1575 Connect = 50, // Request connect
1576 Disconnect = 51, // Request disconnect
1577 Connected = 52, // Connected notification
1578 Disconnected = 53, // Disconnected notification
1579 // Errors
1580 Alarm = 100, // Param: alarms (comma separated list of strings)
1581 NoAlarm = 101, // No more alarms
1582 };
1583
1591
1596
1601 inline Type type() const
1602 { return m_type; }
1603
1609 { return m_circuit; }
1610
1616
1617private:
1618 SignallingCircuit* m_circuit;
1619 Type m_type;
1620};
1621
1626class YSIG_API SignallingCircuit : public RefObject
1627{
1629 friend class SignallingCircuitGroup;
1630 friend class SignallingCircuitEvent;
1631public:
1635 enum Type {
1636 Unknown = 0,
1637 Local, // not really a circuit
1638 TDM,
1639 RTP,
1640 IAX,
1641 };
1642
1646 enum Status {
1647 Missing = 0,
1648 Disabled,
1649 Idle,
1650 Reserved,
1651 Starting,
1652 Stopping,
1653 Special,
1654 Connected,
1655 };
1656
1661 LockLocalHWFail = 0x0001, // Local side of the circuit is locked due to HW failure
1662 LockLocalMaint = 0x0002, // Local side of the circuit is locked for maintenance
1663 LockingHWFail = 0x0004, // Circuit (un)lock due to HW failure in progress
1664 LockingMaint = 0x0008, // Circuit (un)lock due to maintenance in progress
1665 LockLocalHWFailChg = 0x0010, // Local HW failure flag changed
1666 LockLocalMaintChg = 0x0020, // Local maintenance flag changed
1667 Resetting = 0x0040, // Circuit is beeing reset
1668 LockRemoteHWFail = 0x0100, // Remote side of the circuit is locked due to HW failure
1669 LockRemoteMaint = 0x0200, // Remote side of the circuit is locked for maintenance
1670 LockRemoteHWFailChg = 0x1000, // Remote HW failure flag changed
1671 LockRemoteMaintChg = 0x2000, // Remote maintenance flag changed
1672 // Masks used to test lock conditions
1673 LockLocal = LockLocalHWFail | LockLocalMaint,
1674 LockRemote = LockRemoteHWFail | LockRemoteMaint,
1675 LockLocked = LockLocal | LockRemote,
1676 LockBusy = LockingHWFail | LockingMaint | Resetting,
1677 LockLockedBusy = LockLocked | LockBusy,
1678 LockLocalChg = LockLocalHWFailChg | LockLocalMaintChg,
1679 LockRemoteChg = LockRemoteHWFailChg | LockRemoteMaintChg,
1680 LockChanged = LockLocalChg | LockRemoteChg,
1681 };
1682
1687
1694 virtual bool status(Status newStat, bool sync = false)
1695 { m_status = newStat; return true; }
1696
1701 inline Type type() const
1702 { return m_type; }
1703
1708 inline Status status() const
1709 { return m_status; }
1710
1716 inline int locked(int flags = -1) const
1717 { return (m_lock & flags); }
1718
1723 inline void setLock(int flags)
1724 { m_lock |= flags; }
1725
1730 inline void resetLock(int flags)
1731 { m_lock &= ~flags; }
1732
1739 virtual bool updateFormat(const char* format, int direction)
1740 { return false; }
1741
1748 virtual bool setParam(const String& param, const String& value)
1749 { return false; }
1750
1756 virtual bool setParams(const NamedList& params);
1757
1764 virtual bool getParam(const String& param, String& value) const
1765 { return false; }
1766
1773 virtual bool getBoolParam(const String& param, bool defValue = false) const
1774 { return defValue; }
1775
1782 virtual int getIntParam(const String& param, int defValue = 0) const
1783 { return defValue; }
1784
1791 virtual bool getParams(NamedList& params, const String& category = String::empty())
1792 { return false; }
1793
1798 inline SignallingCircuitGroup* group()
1799 { return m_group; }
1800
1806 { return m_span; }
1807
1812 inline const SignallingCircuitGroup* group() const
1813 { return m_group; }
1814
1819 inline const SignallingCircuitSpan* span() const
1820 { return m_span; }
1821
1826 inline unsigned int code() const
1827 { return m_code; }
1828
1833 inline bool available() const
1834 { return m_status == Idle; }
1835
1840 inline bool connected() const
1841 { return m_status == Connected; }
1842
1847 inline bool reserve()
1848 { return available() && status(Reserved,true); }
1849
1855 inline bool connect(const char* format = 0)
1856 { updateFormat(format,0); return status(Connected,true); }
1857
1862 inline bool disconnect()
1863 { return status() == Connected && status(Reserved,true); }
1864
1869 inline bool disable()
1870 { return status(Disabled,true); }
1871
1880 bool hwLock(bool set, bool remote, bool changed = false, bool setChanged = false);
1881
1890 bool maintLock(bool set, bool remote, bool changed = false, bool setChanged = false);
1891
1897 void addEvent(SignallingCircuitEvent* event);
1898
1905 SignallingCircuitEvent* getEvent(const Time& when);
1906
1914
1920 static const char* lookupType(int type);
1921
1927 static const char* lookupStatus(int status);
1928
1932 static const TokenDict s_lockNames[];
1933
1934protected:
1938 SignallingCircuit(Type type, unsigned int code, SignallingCircuitGroup* group = 0,
1940
1945 SignallingCircuitGroup* group = 0, SignallingCircuitSpan* span = 0);
1946
1951 virtual void clearEvents();
1952
1957 void eventTerminated(SignallingCircuitEvent* event);
1958
1963
1964private:
1965 SignallingCircuitGroup* m_group; // The group owning this circuit
1966 SignallingCircuitSpan* m_span; // The span this circuit belongs to
1967 unsigned int m_code; // Circuit id
1968 Type m_type; // Circuit type (see enumeration)
1969 Status m_status; // Circuit local status
1970 int m_lock; // Circuit lock flags
1971 ObjList m_events; // In-band events
1972 SignallingCircuitEvent* m_lastEvent; // The last generated event
1973 bool m_noEvents; // No events pending, exit quickly
1974};
1975
1983class YSIG_API SignallingCircuitRange : public String
1984{
1986 friend class SignallingCircuitGroup;
1987public:
1994 SignallingCircuitRange(const String& rangeStr, const char* name = 0,
1995 int strategy = -1);
1996
2001 { clear(); }
2002
2007 inline unsigned int count() const
2008 { return m_count; }
2009
2014 inline const unsigned int* range() const
2015 { return (const unsigned int*)m_range.data(); }
2016
2023 unsigned int* copyRange(unsigned int& count) const;
2024
2029 inline void clear()
2030 { m_range.clear(); m_count = 0; }
2031
2037 inline unsigned int operator[](unsigned int index)
2038 { return range()[index]; }
2039
2045 inline bool set(const String& rangeStr)
2046 {
2047 clear();
2048 return add(rangeStr);
2049 }
2050
2056 bool add(const String& rangeStr);
2057
2063 void add(unsigned int* codes, unsigned int len);
2064
2069 inline void add(unsigned int code)
2070 { add(&code,1); }
2071
2077 void add(unsigned int first, unsigned int last);
2078
2083 void remove(unsigned int code);
2084
2090 bool find(unsigned int code);
2091
2095 virtual void destruct()
2096 {
2097 clear();
2099 }
2100
2101protected:
2102 void updateLast(); // Update last circuit code
2103
2104 DataBlock m_range; // Array containing the circuit codes
2105 unsigned int m_count; // The number of elements in the array
2106 unsigned int m_last; // Last (the greater) not used circuit code within this range
2107 int m_strategy; // Keep the strategy used to allocate circuits from this range
2108 unsigned int m_used; // Last used circuit code
2109};
2110
2115class YSIG_API SignallingCircuitGroup : public SignallingComponent, public Mutex
2116{
2118 friend class SignallingCircuit;
2119 friend class SignallingCallControl;
2120 friend class SS7ISUP;
2121 friend class ISDNQ931;
2122public:
2127 Other = 0,
2128 // basic strategies
2129 Increment = 0x0001, // round-robin, up
2130 Decrement = 0x0002, // round-robin, down
2131 Lowest = 0x0003, // pick first available
2132 Highest = 0x0004, // pick last available
2133 Random = 0x0005, // pick random circuit
2134 // even/odd strict select (glare avoidance)
2135 OnlyEven = 0x1000,
2136 OnlyOdd = 0x2000,
2137 // glare avoidance with fallback (to be able to use all circuits)
2138 Fallback = 0x4000,
2139 };
2140
2147 SignallingCircuitGroup(unsigned int base = 0, int strategy = Increment,
2148 const char* name = "circgroup");
2149
2154
2159 inline unsigned int count() const
2160 { return m_circuits.count(); }
2161
2166 inline unsigned int base() const
2167 { return m_base; }
2168
2173 inline unsigned int last() const
2174 { return m_range.m_last; }
2175
2180 inline int strategy() const
2181 { return m_range.m_strategy; }
2182
2187 inline void setStrategy(int strategy)
2188 { Lock lock(this); m_range.m_strategy = strategy; }
2189
2194 { return m_circuits; }
2195
2200 void getCicList(String& dest);
2201
2207 bool insert(SignallingCircuit* circuit);
2208
2213 void remove(SignallingCircuit* circuit);
2214
2222 SignallingCircuitSpan* buildSpan(const String& name, unsigned int start = 0, NamedList* params = 0);
2223
2230
2238 void insertRange(SignallingCircuitSpan* span, const char* name,
2239 int strategy = -1);
2240
2249 void insertRange(const String& range, const char* name,
2250 int strategy = -1);
2251
2258 void removeSpan(SignallingCircuitSpan* span, bool delCics = true, bool delSpan = false);
2259
2265
2272 SignallingCircuit* find(unsigned int cic, bool local = false);
2273
2280
2287
2295 bool status(unsigned int cic, SignallingCircuit::Status newStat, bool sync = false);
2296
2304 SignallingCircuit* reserve(int checkLock = -1, int strategy = -1,
2305 SignallingCircuitRange* range = 0);
2306
2318 SignallingCircuit* reserve(const String& list, bool mandatory,
2319 int checkLock = -1, int strategy = -1, SignallingCircuitRange* range = 0);
2320
2327 inline bool release(SignallingCircuit* cic, bool sync = false)
2328 { return cic && cic->status(SignallingCircuit::Idle,sync); }
2329
2336 static int str2strategy(const char* name, int def = Increment)
2337 { return lookup(name,s_strategy,def); }
2338
2342 static const TokenDict s_strategy[];
2343
2344protected:
2348 virtual void destroyed()
2349 {
2350 clearAll();
2352 }
2353
2354private:
2355 unsigned int advance(unsigned int n, int strategy, SignallingCircuitRange& range);
2356 void clearAll();
2357
2358 ObjList m_circuits; // The circuits belonging to this group
2359 ObjList m_spans; // The spans belonging to this group
2360 ObjList m_ranges; // Additional circuit ranges
2361 SignallingCircuitRange m_range; // Range containing all circuits belonging to this group
2362 unsigned int m_base;
2363};
2364
2370{
2372public:
2377
2383 { return m_group; }
2384
2389 inline const String& id() const
2390 { return m_id; }
2391
2396 inline unsigned int increment() const
2397 { return m_increment; }
2398
2399protected:
2406
2411
2415 unsigned int m_increment;
2416
2417private:
2418 String m_id; // Span's id
2419};
2420
2425class YSIG_API SignallingInterface : virtual public SignallingComponent
2426{
2428 friend class SignallingReceiver;
2429public:
2434 Specific = 0,
2435 EnableTx = 0x01,
2436 EnableRx = 0x02,
2437 Enable = 0x03,
2438 DisableTx = 0x04,
2439 DisableRx = 0x08,
2440 Disable = 0x0c,
2441 FlushTx = 0x10,
2442 FlushRx = 0x20,
2443 Flush = 0x30,
2444 QueryTx = 0x40,
2445 QueryRx = 0x80,
2446 Query = 0xc0
2447 };
2448
2453 LinkUp = 0,
2454 LinkDown,
2455 HardwareError,
2456 TxClockError,
2457 RxClockError,
2458 AlignError,
2459 CksumError,
2460 TxOversize,
2461 RxOversize,
2462 TxOverflow,
2463 RxOverflow,
2464 TxUnderrun,
2465 RxUnderrun,
2466 };
2467
2472 Unknown = 0,
2473 SS7Fisu,
2474 SS7Lssu,
2475 SS7Msu,
2476 Q921
2477 };
2478
2483 : m_recvMutex(true,"SignallingInterface::recv"), m_receiver(0)
2484 { }
2485
2490
2495 virtual void attach(SignallingReceiver* receiver);
2496
2501 inline SignallingReceiver* receiver() const
2502 { return m_receiver; }
2503
2513 virtual bool control(Operation oper, NamedList* params = 0);
2514
2518 static const TokenDict s_notifName[];
2519
2520protected:
2529 virtual bool transmitPacket(const DataBlock& packet, bool repeat, PacketType type) = 0;
2530
2536 bool receivedPacket(const DataBlock& packet);
2537
2544
2545private:
2546 Mutex m_recvMutex; // Lock receiver pointer operations
2547 SignallingReceiver* m_receiver;
2548};
2549
2554class YSIG_API SignallingReceiver : virtual public SignallingComponent
2555{
2557 friend class SignallingInterface;
2558public:
2563 SignallingReceiver(const char* name = 0);
2564
2569
2575 virtual SignallingInterface* attach(SignallingInterface* iface);
2576
2581 inline SignallingInterface* iface() const
2582 { return m_interface; }
2583
2592
2593protected:
2602 bool transmitPacket(const DataBlock& packet, bool repeat,
2603 SignallingInterface::PacketType type = SignallingInterface::Unknown);
2604
2609 virtual bool receivedPacket(const DataBlock& packet) = 0;
2610
2617
2618private:
2619 Mutex m_ifaceMutex; // Lock interface pointer operations
2620 SignallingInterface* m_interface;
2621};
2622
2623
2629{
2633 unsigned int mask;
2634
2638 unsigned int value;
2639
2643 const char* name;
2644};
2645
2650class YSIG_API SignallingUtils
2651{
2652public:
2657 static const TokenDict* codings();
2658
2663 static const TokenDict* locations();
2664
2676 static inline const TokenDict* dict(unsigned int index, unsigned char coding = 0)
2677 {
2678 if (index > 4)
2679 return 0;
2680 return (!coding ? s_dictCCITT[index] : 0);
2681 }
2682
2689 static bool hasFlag(const String& flags, const char* flag);
2690
2697 static bool appendFlag(String& flags, const char* flag);
2698
2705 static bool removeFlag(String& flags, const char* flag);
2706
2714 static bool hasFlag(const NamedList& list, const char* param, const char* flag);
2715
2723 static bool appendFlag(NamedList& list, const char* param, const char* flag);
2724
2732 static void addKeyword(NamedList& list, const char* param,
2733 const TokenDict* tokens, unsigned int val);
2734
2744 static void dumpData(const SignallingComponent* comp, NamedList& list, const char* param,
2745 const unsigned char* buf, unsigned int len, char sep = ' ');
2746
2759 static unsigned int dumpDataExt(const SignallingComponent* comp, NamedList& list, const char* param,
2760 const unsigned char* buf, unsigned int len, char sep = ' ');
2761
2773 static bool decodeFlags(const SignallingComponent* comp, NamedList& list, const char* param,
2774 const SignallingFlags* flags, const unsigned char* buf, unsigned int len);
2775
2786 static bool decodeCause(const SignallingComponent* comp, NamedList& list, const unsigned char* buf,
2787 unsigned int len, const char* prefix, bool isup);
2788
2799 static bool decodeCaps(const SignallingComponent* comp, NamedList& list, const unsigned char* buf,
2800 unsigned int len, const char* prefix, bool isup);
2801
2811 static void encodeFlags(const SignallingComponent* comp, int& dest, const String& flags,
2812 const TokenDict* dict);
2813
2822 static unsigned int encodeFlags(const SignallingComponent* comp, const String& flags,
2823 const SignallingFlags* dict, const char* paramName = 0);
2824
2836 static bool encodeCause(const SignallingComponent* comp, DataBlock& buf, const NamedList& params,
2837 const char* prefix, bool isup, bool fail = false);
2838
2848 static bool encodeCaps(const SignallingComponent* comp, DataBlock& buf, const NamedList& params,
2849 const char* prefix, bool isup);
2850
2863 static unsigned int* parseUIntArray(const String& source, unsigned int minVal, unsigned int maxVal,
2864 unsigned int& count, bool discardDup);
2865
2866private:
2867 static const TokenDict* s_dictCCITT[5];
2868};
2869
2874class YSIG_API SignallingMessageTimer : public GenObject, public SignallingTimer
2875{
2876public:
2882 inline SignallingMessageTimer(u_int64_t interval, u_int64_t global = 0)
2884 m_globalTimer(global), m_msg(0)
2885 { }
2886
2891 { TelEngine::destruct(m_msg); }
2892
2898 { return m_msg; }
2899
2904 inline void message(SignallingMessage* msg)
2905 { m_msg = msg; }
2906
2907
2913 { return m_globalTimer; }
2914
2919 inline const SignallingTimer& global() const
2920 { return m_globalTimer; }
2921
2926 inline u_int64_t fireTime() const {
2927 if (!m_globalTimer.started() || m_globalTimer.fireTime() > SignallingTimer::fireTime())
2929 return m_globalTimer.fireTime();
2930 }
2931
2932protected:
2933 SignallingTimer m_globalTimer;
2934 SignallingMessage* m_msg;
2935};
2936
2943{
2944public:
2950
2957 inline SignallingMessageTimer* add(u_int64_t interval, const Time& when = Time())
2958 { return interval ? add(new SignallingMessageTimer(interval),when) : 0; }
2959
2967
2974};
2975
2981class YSIG_API AnalogLine : public RefObject, public Mutex
2982{
2983 YCLASS(AnalogLine,RefObject)
2984 friend class AnalogLineGroup; // Reset group if destroyed before the line
2985public:
2989 enum Type {
2990 FXO, // Telephone linked to an exchange
2991 FXS, // Telephone exchange linked to a telephone
2992 Recorder, // Passive FXO recording a 2 wire line
2993 Monitor, // Monitor (a pair of FXS/FXO lines)
2994 Unknown
2995 };
2996
3000 enum State {
3001 OutOfService = -1, // Line is out of service
3002 Idle = 0, // Line is idle (on hook)
3003 Dialing = 1, // FXS line is waiting for the FXO to dial the number
3004 DialComplete = 2, // FXS line: got enough digits from the FXO to reach a destination
3005 Ringing = 3, // Line is ringing
3006 Answered = 4, // Line is answered
3007 CallEnded = 5, // FXS line: notify the FXO on call termination
3008 OutOfOrder = 6, // FXS line: notify the FXO that the hook is off after call ended notification
3009 };
3010
3015 After, // Send/detect call setup after the first ring
3016 Before, // Send/detect call setup before the first ring
3017 NoCallSetup // No call setup detect or send
3018 };
3019
3027 AnalogLine(AnalogLineGroup* grp, unsigned int cic, const NamedList& params);
3028
3032 virtual ~AnalogLine();
3033
3038 inline Type type() const
3039 { return m_type; }
3040
3045 inline State state() const
3046 { return m_state; }
3047
3052 inline AnalogLineGroup* group()
3053 { return m_group; }
3054
3060 { return m_peer; }
3061
3067 void setPeer(AnalogLine* line = 0, bool sync = true);
3068
3074 { return m_circuit; }
3075
3080 inline const char* address() const
3081 { return m_address; }
3082
3087 inline bool outbandDtmf() const
3088 { return !m_inband; }
3089
3094 inline bool answerOnPolarity() const
3095 { return m_answerOnPolarity; }
3096
3101 inline bool hangupOnPolarity() const
3102 { return m_hangupOnPolarity; }
3103
3108 inline bool polarityControl() const
3109 { return m_polarityControl; }
3110
3116 { return m_callSetup; }
3117
3122 inline u_int64_t callSetupTimeout() const
3123 { return m_callSetupTimeout; }
3124
3129 inline u_int64_t noRingTimeout() const
3130 { return m_noRingTimeout; }
3131
3136 inline u_int64_t alarmTimeout() const
3137 { return m_alarmTimeout; }
3138
3143 inline u_int64_t delayDial() const
3144 { return m_delayDial; }
3145
3150 inline void acceptPulseDigit(bool ok)
3151 { m_acceptPulseDigit = ok; }
3152
3157 inline void* userdata() const
3158 { return m_private; }
3159
3165 inline void userdata(void* data, bool sync = true)
3166 {
3167 Lock lock(this);
3168 m_private = data;
3169 if (sync && m_peer)
3170 m_peer->userdata(data,false);
3171 }
3172
3177 virtual const String& toString() const
3178 { return m_address; }
3179
3184 void resetEcho(bool train);
3185
3190 inline bool resetCircuit()
3191 { return state() != OutOfService && m_circuit && m_circuit->reserve(); }
3192
3199 inline bool setCircuitParam(const char* param, const char* value = 0)
3200 { return m_circuit && m_circuit->setParam(param,value); }
3201
3207 bool connect(bool sync);
3208
3214 bool disconnect(bool sync);
3215
3223
3232 NamedList* params = 0)
3233 {
3234 if (!sendEvent(type,params))
3235 return false;
3236 changeState(newState,false);
3237 return true;
3238 }
3239
3245 virtual AnalogLineEvent* getEvent(const Time& when);
3246
3252 virtual AnalogLineEvent* getMonitorEvent(const Time& when);
3253
3258 virtual void checkTimeouts(const Time& when)
3259 { }
3260
3267 bool changeState(State newState, bool sync = false);
3268
3277 bool enable(bool ok, bool sync, bool connectNow = true);
3278
3282 static const TokenDict* typeNames();
3283
3287 static const TokenDict* stateNames();
3288
3292 static const TokenDict* csNames();
3293
3294protected:
3298 virtual void destroyed();
3299
3300private:
3301 Type m_type; // Line type
3302 State m_state; // Line state
3303 bool m_inband; // Refuse to send DTMFs if they should be sent in band
3304 int m_echocancel; // Default echo canceller state (0: managed by the circuit, -1: off, 1: on)
3305 bool m_acceptPulseDigit; // Accept incoming pulse digits
3306 bool m_answerOnPolarity; // Answer on line polarity change
3307 bool m_hangupOnPolarity; // Hangup on line polarity change
3308 bool m_polarityControl; // Set line polarity flag
3309 CallSetupInfo m_callSetup; // Call setup management
3310 u_int64_t m_callSetupTimeout; // FXO: timeout period for received call setup data before first ring
3311 u_int64_t m_noRingTimeout; // FXO: timeout period with no ring received on incoming calls
3312 u_int64_t m_alarmTimeout; // Timeout period to stay in alarms
3313 u_int64_t m_delayDial; // FXO: Time to delay sending number
3314 AnalogLineGroup* m_group; // The group owning this line
3315 SignallingCircuit* m_circuit; // The circuit managed by this line
3316 String m_address; // Line address: group and circuit
3317 void* m_private; // Private data used by this line's user
3318 // Monitor data
3319 AnalogLine* m_peer; // This line's peer if any
3320 bool m_getPeerEvent; // Flag used to get events from peer
3321};
3322
3327class YSIG_API AnalogLineEvent : public GenObject
3328{
3329public:
3336 : m_line(0), m_event(event)
3337 { if (line && line->ref()) m_line = line; }
3338
3343 {
3344 TelEngine::destruct(m_line);
3345 TelEngine::destruct(m_event);
3346 }
3347
3353 { return m_line; }
3354
3360 { return m_event; }
3361
3365 virtual void destruct()
3366 {
3367 TelEngine::destruct(m_line);
3368 TelEngine::destruct(m_event);
3370 }
3371
3372private:
3373 AnalogLine* m_line;
3374 SignallingCircuitEvent* m_event;
3375};
3376
3383{
3385public:
3392 AnalogLineGroup(AnalogLine::Type type, const char* name, bool slave = false);
3393
3401
3406
3411 inline AnalogLine::Type type() const
3412 { return m_type; }
3413
3418 inline ObjList& lines()
3419 { return m_lines; }
3420
3426 { return m_fxo; }
3427
3432 inline bool slave()
3433 { return m_slave; }
3434
3441 bool appendLine(AnalogLine* line, bool destructOnFail = true);
3442
3447 void removeLine(unsigned int cic);
3448
3454
3460 AnalogLine* findLine(unsigned int cic);
3461
3467 AnalogLine* findLine(const String& address);
3468
3474 virtual AnalogLineEvent* getEvent(const Time& when);
3475
3476protected:
3480 virtual void destroyed();
3481
3486
3487private:
3488 AnalogLine::Type m_type; // Line type
3489 AnalogLineGroup* m_fxo; // The group containing the FXO lines if this is a monitor
3490 bool m_slave; // True if this is an FXO group owned by an FXS one
3491};
3492
3497class YSIG_API SS7PointCode : public GenObject
3498{
3499 YCLASS(SS7PointCode,GenObject)
3500public:
3504 enum Type {
3505 Other = 0,
3506 ITU = 1, // ITU-T Q.704
3507 ANSI = 2, // ANSI T1.111.4
3508 ANSI8 = 3, // 8-bit SLS
3509 China = 4, // GF 001-9001
3510 Japan = 5, // JT-Q704, NTT-Q704
3511 Japan5 = 6, // 5-bit SLS
3512 // Do not change the next line, must be past last defined type
3513 DefinedTypes
3514 };
3515
3522 inline SS7PointCode(unsigned char network = 0, unsigned char cluster = 0, unsigned char member = 0)
3523 : m_network(network), m_cluster(cluster), m_member(member)
3524 { }
3525
3531 inline SS7PointCode(Type type, unsigned int packed)
3532 : m_network(0), m_cluster(0), m_member(0)
3533 { unpack(type,packed); }
3534
3539 inline SS7PointCode(const SS7PointCode& original)
3540 : m_network(original.network()), m_cluster(original.cluster()), m_member(original.member())
3541 { }
3542
3547 { }
3548
3553 inline unsigned char network() const
3554 { return m_network; }
3555
3560 inline unsigned char cluster() const
3561 { return m_cluster; }
3562
3567 inline unsigned char member() const
3568 { return m_member; }
3569
3576 inline void assign(unsigned char network, unsigned char cluster, unsigned char member)
3577 { m_network = network; m_cluster = cluster; m_member = member; }
3578
3585 bool assign(const String& src, Type type = Other);
3586
3595 bool assign(Type type, const unsigned char* src, int len = -1, unsigned char* spare = 0);
3596
3601 inline SS7PointCode& operator=(const SS7PointCode& original)
3602 { assign(original.network(),original.cluster(),original.member()); return *this; }
3603
3608 inline bool operator==(const SS7PointCode& original) const
3609 { return m_network == original.network() && m_cluster == original.cluster() && m_member == original.member(); }
3610
3615 inline bool operator!=(const SS7PointCode& original) const
3616 { return m_network != original.network() || m_cluster != original.cluster() || m_member != original.member(); }
3617
3622 bool compatible(Type type) const;
3623
3629 unsigned int pack(Type type) const;
3630
3637 bool unpack(Type type, unsigned int packed);
3638
3646 bool store(Type type, unsigned char* dest, unsigned char spare = 0) const;
3647
3653 static unsigned char size(Type type);
3654
3660 static unsigned char length(Type type);
3661
3667 static Type lookup(const char* text)
3668 { return (Type)TelEngine::lookup(text,s_names,(int)Other); }
3669
3675 static const char* lookup(Type type)
3676 { return TelEngine::lookup((int)type,s_names); }
3677
3678private:
3679 static const TokenDict s_names[]; // Keep the strigns associated with point code type
3680 unsigned char m_network;
3681 unsigned char m_cluster;
3682 unsigned char m_member;
3683};
3684
3685// The number of valid point code types
3686#define YSS7_PCTYPE_COUNT (SS7PointCode::DefinedTypes-1)
3687
3693YSIG_API String& operator<<(String& str, const SS7PointCode& cp);
3694
3699class YSIG_API SS7Label
3700{
3701public:
3706
3711 SS7Label(const SS7Label& original);
3712
3719 SS7Label(const SS7Label& original, unsigned char sls, unsigned char spare = 0);
3720
3730 const SS7PointCode& opc, unsigned char sls, unsigned char spare = 0);
3731
3741 unsigned int opc, unsigned char sls, unsigned char spare = 0);
3742
3749
3759 const SS7PointCode& opc, unsigned char sls, unsigned char spare = 0);
3760
3769 void assign(SS7PointCode::Type type, unsigned int dpc,
3770 unsigned int opc, unsigned char sls, unsigned char spare = 0);
3771
3779
3787 bool assign(SS7PointCode::Type type, const unsigned char* src, int len = -1);
3788
3794 bool store(unsigned char* dest) const;
3795
3801
3807 { return m_type; }
3808
3813 inline const SS7PointCode& dpc() const
3814 { return m_dpc; }
3815
3821 { return m_dpc; }
3822
3827 inline const SS7PointCode& opc() const
3828 { return m_opc; }
3829
3835 { return m_opc; }
3836
3841 inline unsigned char sls() const
3842 { return m_sls; }
3843
3848 inline void setSls(unsigned char sls)
3849 { m_sls = sls; }
3850
3855 inline unsigned char spare() const
3856 { return m_spare; }
3857
3862 inline void setSpare(unsigned char spare)
3863 { m_spare = spare; }
3864
3869 inline unsigned int length() const
3870 { return length(m_type); }
3871
3877 static unsigned int length(SS7PointCode::Type type);
3878
3883 inline unsigned char size() const
3884 { return size(m_type); }
3885
3891 static unsigned char size(SS7PointCode::Type type);
3892
3893private:
3894 SS7PointCode::Type m_type;
3895 SS7PointCode m_dpc;
3896 SS7PointCode m_opc;
3897 unsigned char m_sls;
3898 unsigned char m_spare;
3899};
3900
3906YSIG_API String& operator<<(String& str, const SS7Label& label);
3907
3908// Maximum size of a MTP2 MSU including SIO + Routing Label + data (Q.703 2.3.8)
3909#define MAX_TDM_MSU_SIZE 273
3910
3915class YSIG_API SS7MSU : public DataBlock
3916{
3917 YCLASS(SS7MSU,DataBlock)
3918public:
3923 // Signalling Network Management
3924 SNM = 0,
3925 // Maintenance
3926 MTN = 1,
3927 // Maintenance special
3928 MTNS = 2,
3929 // Signalling Connection Control Part
3930 SCCP = 3,
3931 // Telephone User Part
3932 TUP = 4,
3933 // ISDN User Part
3934 ISUP = 5,
3935 // Data User Part - call and circuit related
3936 DUP_C = 6,
3937 // Data User Part - facility messages
3938 DUP_F = 7,
3939 // MTP Testing User Part (reserved)
3940 MTP_T = 8,
3941 // Broadband ISDN User Part
3942 BISUP = 9,
3943 // Satellite ISDN User Part
3944 SISUP = 10,
3945 // AAL type2 Signaling
3946 AAL2 = 12,
3947 // Bearer Independent Call Control
3948 BICC = 13,
3949 // Gateway Control Protocol
3950 GCP = 14,
3951 };
3952
3957 Regular = 0x00,
3958 Special = 0x10,
3959 Circuit = 0x20,
3960 Facility = 0x30
3961 };
3962
3967 International = 0x00,
3968 SpareInternational = 0x40,
3969 National = 0x80,
3970 ReservedNational = 0xc0
3971 };
3972
3976 inline SS7MSU()
3977 { }
3978
3983 inline SS7MSU(const SS7MSU& value)
3984 : DataBlock(value)
3985 { }
3986
3991 inline SS7MSU(const DataBlock& value)
3992 : DataBlock(value)
3993 { }
3994
4001 inline SS7MSU(void* value, unsigned int len, bool copyData = true)
4002 : DataBlock(value,len,copyData)
4003 { }
4004
4012 SS7MSU(unsigned char sio, const SS7Label label, void* value = 0, unsigned int len = 0);
4013
4022 SS7MSU(unsigned char sif, unsigned char ssf, const SS7Label label, void* value = 0, unsigned int len = 0);
4023
4027 virtual ~SS7MSU();
4028
4034 inline SS7MSU& operator=(const SS7MSU& value)
4035 { DataBlock::operator=(value); return *this; }
4036
4042 inline SS7MSU& operator=(const DataBlock& value)
4043 { DataBlock::operator=(value); return *this; }
4044
4049 bool valid() const;
4050
4057 inline unsigned char* getData(unsigned int offs, unsigned int len = 1)
4058 { return (offs+len <= length()) ? offs + (unsigned char*)data() : 0; }
4059
4066 inline const unsigned char* getData(unsigned int offs, unsigned int len = 1) const
4067 { return (offs+len <= length()) ? offs + (const unsigned char*)data() : 0; }
4068
4075 inline unsigned char* getData(const SS7Label& label, unsigned int len = 1)
4076 { return getData(label.length()+1,len); }
4077
4084 inline const unsigned char* getData(const SS7Label& label, unsigned int len = 1) const
4085 { return getData(label.length()+1,len); }
4086
4091 inline int getSIO() const
4092 { return null() ? -1 : *(const unsigned char*)data(); }
4093
4098 inline int getSIF() const
4099 { return null() ? -1 : 0x0f & *(const unsigned char*)data(); }
4100
4105 inline int getSSF() const
4106 { return null() ? -1 : 0xf0 & *(const unsigned char*)data(); }
4107
4112 inline int getPrio() const
4113 { return null() ? -1 : 0x30 & *(const unsigned char*)data(); }
4114
4119 inline int getNI() const
4120 { return null() ? -1 : 0xc0 & *(const unsigned char*)data(); }
4121
4126 const char* getServiceName() const;
4127
4132 const char* getPriorityName() const;
4133
4138 const char* getIndicatorName() const;
4139
4146 static unsigned char getPriority(const char* name, unsigned char defVal = Regular);
4147
4154 static unsigned char getNetIndicator(const char* name, unsigned char defVal = National);
4155};
4156
4162{
4163public:
4164 enum Result {
4165 Rejected = 0,
4166 Unequipped = 1,
4167 Inaccessible = 2,
4168 // private used (non Q.704)
4169 Accepted = 16,
4170 Failure = 17,
4171 NoAddress = 18,
4172 NoCircuit = 19,
4173 };
4174
4179 inline HandledMSU(Result result = Rejected)
4180 { m_result = result; }
4181
4186 inline HandledMSU(bool success)
4187 { m_result = success ? Accepted : Failure; }
4188
4193 inline HandledMSU(const HandledMSU& original)
4194 { m_result = original; }
4195
4200 inline HandledMSU& operator=(Result result)
4201 { m_result = result; return *this; }
4202
4207 inline HandledMSU& operator=(const HandledMSU& original)
4208 { m_result = original; return *this; }
4209
4214 inline bool operator==(Result result)
4215 { return m_result == result; }
4216
4221 inline bool operator==(const HandledMSU& result)
4222 { return m_result == result; }
4223
4228 inline bool operator!=(Result result)
4229 { return m_result != result; }
4230
4235 inline bool operator!=(const HandledMSU& result)
4236 { return m_result != result; }
4237
4242 inline operator Result() const
4243 { return m_result; }
4244
4249 inline bool ok() const
4250 { return Accepted == m_result; }
4251
4256 inline unsigned char upu() const
4257 { return (Accepted > m_result) ? m_result : Rejected; }
4258
4259private:
4260 Result m_result;
4261};
4262
4267class YSIG_API SIGTransport : public SignallingComponent
4268{
4270 friend class SIGTRAN;
4271public:
4276 None = 0,
4277 Sctp,
4278 // All the following transports are not standard
4279 Tcp,
4280 Udp,
4281 Unix,
4282 };
4283
4288 inline SIGTRAN* sigtran() const
4289 { return m_sigtran; }
4290
4295 u_int32_t defPort() const;
4296
4301 virtual bool reliable() const = 0;
4302
4308
4314 virtual bool initialize(const NamedList* config)
4315 { return false;}
4316
4322 virtual bool connected(int streamId) const = 0;
4323
4328 void attach(SIGTRAN* sigtran);
4329
4339 bool processMSG(unsigned char msgVersion, unsigned char msgClass,
4340 unsigned char msgType, const DataBlock& msg, int streamId) const;
4341
4346 virtual void reconnect(bool force = false)
4347 { }
4348
4355 virtual bool getSocketParams(const String& params, NamedList& result)
4356 { return false; }
4357
4365 virtual bool transportNotify(SIGTransport* newTransport, const SocketAddr& addr);
4366
4371 virtual bool hasThread()
4372 { return false; }
4373
4377 virtual void stopThread()
4378 { }
4379protected:
4384 inline explicit SIGTransport(const char* name = 0)
4385 : SignallingComponent(name), m_sigtran(0)
4386 { }
4387
4392 virtual void attached(bool hasUAL) = 0;
4393
4403 virtual bool transmitMSG(unsigned char msgVersion, unsigned char msgClass,
4404 unsigned char msgType, const DataBlock& msg, int streamId = 0);
4405
4413 virtual bool transmitMSG(const DataBlock& header, const DataBlock& msg, int streamId = 0) = 0;
4414
4415private:
4416 SIGTRAN* m_sigtran;
4417};
4418
4423class YSIG_API SIGTRAN
4424{
4425 friend class SIGTransport;
4426public:
4431 // Management (IUA/M2UA/M3UA/SUA)
4432 MGMT = 0,
4433 // Transfer (M3UA)
4434 TRAN = 1,
4435 // SS7 Signalling Network Management (M3UA/SUA)
4436 SSNM = 2,
4437 // ASP State Maintenance (IUA/M2UA/M3UA/SUA)
4438 ASPSM = 3,
4439 // ASP Traffic Maintenance (IUA/M2UA/M3UA/SUA)
4440 ASPTM = 4,
4441 // Q.921/Q.931 Boundary Primitives Transport (IUA)
4442 QPTM = 5,
4443 // MTP2 User Adaptation (M2UA)
4444 MAUP = 6,
4445 // Connectionless Messages (SUA)
4446 CLMSG = 7,
4447 // Connection-Oriented Messages (SUA)
4448 COMSG = 8,
4449 // Routing Key Management (M3UA/SUA)
4450 RKM = 9,
4451 // Interface Identifier Management (M2UA)
4452 IIM = 10,
4453 // M2PA Messages (M2PA)
4454 M2PA = 11,
4455 };
4456
4460 enum MsgMGMT {
4461 MgmtERR = 0,
4462 MgmtNTFY = 1,
4463 };
4464
4468 enum MsgSSNM {
4469 SsnmDUNA = 1, // Destination Unavailable
4470 SsnmDAVA = 2, // Destination Available
4471 SsnmDAUD = 3, // Destination State Audit
4472 SsnmSCON = 4, // Signalling Congestion
4473 SsnmDUPU = 5, // Destination User Part Unavailable
4474 SsnmDRST = 6, // Destination Restricted
4475 };
4476
4481 AspsmUP = 1,
4482 AspsmDOWN = 2,
4483 AspsmBEAT = 3,
4484 AspsmUP_ACK = 4,
4485 AspsmDOWN_ACK = 5,
4486 AspsmBEAT_ACK = 6,
4487 };
4488
4493 AsptmACTIVE = 1,
4494 AsptmINACTIVE = 2,
4495 AsptmACTIVE_ACK = 3,
4496 AsptmINACTIVE_ACK = 4,
4497 };
4498
4502 enum MsgRKM {
4503 RkmREG_REQ = 1,
4504 RkmREG_RSP = 2,
4505 RkmDEREG_REQ = 3,
4506 RkmDEREG_RSP = 4,
4507 };
4508
4512 enum MsgIIM {
4513 IimREG_REQ = 1,
4514 IimREG_RSP = 2,
4515 IimDEREG_REQ = 3,
4516 IimDEREG_RSP = 4,
4517 };
4518
4524 explicit SIGTRAN(u_int32_t payload = 0, u_int16_t port = 0);
4525
4529 virtual ~SIGTRAN();
4530
4535 virtual void attach(SIGTransport* trans);
4536
4541 inline SIGTransport* transport() const
4542 { return m_trans; }
4543
4548 inline u_int32_t payload() const
4549 { return m_payload; }
4550
4555 inline u_int16_t defPort() const
4556 { return m_defPort; }
4557
4563 bool connected(int streamId = 0) const;
4564
4565 virtual void notifyLayer(SignallingInterface::Notification status)
4566 { }
4567
4572 static const TokenDict* classNames();
4573
4581 static const char* typeName(unsigned char msgClass, unsigned char msgType,
4582 const char* defValue = 0);
4583
4593 bool transmitMSG(unsigned char msgVersion, unsigned char msgClass,
4594 unsigned char msgType, const DataBlock& msg, int streamId = 0) const;
4595
4604 inline bool transmitMSG(unsigned char msgClass, unsigned char msgType,
4605 const DataBlock& msg, int streamId = 0) const
4606 { return transmitMSG(1,msgClass,msgType,msg,streamId); }
4607
4613 bool restart(bool force);
4614
4621 bool getSocketParams(const String& params, NamedList& result);
4622
4629 virtual bool transportNotify(SIGTransport* newTransport, const SocketAddr& addr)
4630 { TelEngine::destruct(newTransport); return false; }
4631
4637
4642
4643protected:
4653 virtual bool processMSG(unsigned char msgVersion, unsigned char msgClass,
4654 unsigned char msgType, const DataBlock& msg, int streamId) = 0;
4655
4656private:
4657 SIGTransport* m_trans;
4658 u_int32_t m_payload;
4659 u_int16_t m_defPort;
4660 mutable Mutex m_transMutex;
4661};
4662
4667class YSIG_API SIGAdaptation : public SignallingComponent, public SIGTRAN, public Mutex
4668{
4670public:
4675 TrafficUnused = 0,
4676 TrafficOverride = 1,
4677 TrafficLoadShare = 2,
4678 TrafficBroadcast = 3,
4679 };
4680
4681 enum HeartbeatState {
4682 HeartbeatDisabled = 0,
4683 HeartbeatEnabled = 1,
4684 HeartbeatWaitResponse = 2,
4685 };
4686
4687 enum Errors {
4688 InvalidVersion = 0x01,
4689 InvalidIID = 0x02,
4690 UnsupportedMessageClass = 0x03,
4691 UnsupportedMessageType = 0x04,
4692 UnsupportedTrafficMode = 0x05,
4693 UnexpectedMessage = 0x06,
4694 ProtocolError = 0x07,
4695 UnsupportedIIDType = 0x08,
4696 InvalidStreamIdentifier = 0x09,
4697 UnassignedTEI = 0x0a,
4698 UnrecognizedSAPI = 0x0b,
4699 InvalidTEISAPI = 0x0c,
4700 ManagementBlocking = 0x0d,
4701 ASPIDRequired = 0x0e,
4702 InvalidASPID = 0x0f,
4703 ASPActiveIID = 0x10,
4704 InvalidParameterValue = 0x11,
4705 ParameterFieldError = 0x12,
4706 UnexpectedParameter = 0x13,
4707 DestinationStatusUnknown = 0x14,
4708 InvalidNetworkAppearance = 0x15,
4709 MissingParameter = 0x16,
4710 InvalidRoutingContext = 0x19,
4711 NotConfiguredAS = 0x1a,
4712 SubsystemStatusUnknown = 0x1b,
4713 InvalidLoadsharingLabel = 0x1c
4714 };
4715
4720
4725 virtual bool initialize(const NamedList* config);
4726
4735 static bool nextTag(const DataBlock& data, int& offset, uint16_t& tag, uint16_t& length);
4736
4745 static bool findTag(const DataBlock& data, int& offset, uint16_t tag, uint16_t& length);
4746
4754 static bool getTag(const DataBlock& data, uint16_t tag, uint32_t& value);
4755
4763 static bool getTag(const DataBlock& data, uint16_t tag, String& value);
4764
4772 static bool getTag(const DataBlock& data, uint16_t tag, DataBlock& value);
4773
4780 static void addTag(DataBlock& data, uint16_t tag, uint32_t value);
4781
4788 static void addTag(DataBlock& data, uint16_t tag, const String& value);
4789
4796 static void addTag(DataBlock& data, uint16_t tag, const DataBlock& value);
4797
4803
4804protected:
4812 explicit SIGAdaptation(const char* name = 0, const NamedList* params = 0,
4813 u_int32_t payload = 0, u_int16_t port = 0);
4814
4823 virtual bool processCommonMSG(unsigned char msgClass,
4824 unsigned char msgType, const DataBlock& msg, int streamId);
4825
4833 virtual bool processMgmtMSG(unsigned char msgType, const DataBlock& msg, int streamId) = 0;
4834
4842 virtual bool processAspsmMSG(unsigned char msgType, const DataBlock& msg, int streamId) = 0;
4843
4851 virtual bool processAsptmMSG(unsigned char msgType, const DataBlock& msg, int streamId) = 0;
4852
4857 virtual void timerTick(const Time& when);
4858
4866 bool processHeartbeat(unsigned char msgType, const DataBlock& msg,
4867 int streamId);
4868
4872 inline void resetHeartbeat()
4873 {
4874 Lock myLock(this);
4875 for (int i = 0;i < 32;i++)
4876 m_streamsHB[i] = HeartbeatDisabled;
4877 }
4878
4883 inline void enableHeartbeat(unsigned char streamId) {
4884 if (streamId > 31)
4885 return;
4886 m_streamsHB[streamId] = HeartbeatEnabled;
4887 }
4888private:
4889 unsigned int m_maxRetransmit;
4890 SignallingTimer m_sendHeartbeat;
4891 SignallingTimer m_waitHeartbeatAck;
4892 unsigned char m_streamsHB[32];
4893};
4894
4899class YSIG_API SIGAdaptClient : public SIGAdaptation
4900{
4901 friend class SIGAdaptUser;
4903public:
4908 AspDown = 0,
4909 AspUpRq,
4910 AspUp,
4911 AspActRq,
4912 AspActive
4913 };
4914
4920
4921protected:
4929 explicit SIGAdaptClient(const char* name = 0, const NamedList* params = 0,
4930 u_int32_t payload = 0, u_int16_t port = 0);
4931
4939 virtual bool processMgmtMSG(unsigned char msgType, const DataBlock& msg, int streamId);
4940
4948 virtual bool processAspsmMSG(unsigned char msgType, const DataBlock& msg, int streamId);
4949
4957 virtual bool processAsptmMSG(unsigned char msgType, const DataBlock& msg, int streamId);
4958
4963 virtual void activeChange(bool active);
4964
4969 inline bool aspUp() const
4970 { return m_state >= AspUp; }
4971
4976 inline bool aspActive() const
4977 { return m_state >= AspActive; }
4978
4983 bool activate();
4984
4990 void setState(AspState state, bool notify = true);
4991
4996 inline ObjList& users()
4997 { return m_users; }
4998
5002 int32_t m_aspId;
5003
5008
5009private:
5010 void attach(SIGAdaptUser* user);
5011 void detach(SIGAdaptUser* user);
5012 ObjList m_users;
5013 AspState m_state;
5014};
5015
5020class YSIG_API SIGAdaptServer : public SIGAdaptation
5021{
5023protected:
5031 inline explicit SIGAdaptServer(const char* name = 0, const NamedList* params = 0,
5032 u_int32_t payload = 0, u_int16_t port = 0)
5033 : SIGAdaptation(name,params,payload,port)
5034 { }
5035
5043 virtual bool processMgmtMSG(unsigned char msgType, const DataBlock& msg, int streamId);
5044
5052 virtual bool processAspsmMSG(unsigned char msgType, const DataBlock& msg, int streamId);
5053
5061 virtual bool processAsptmMSG(unsigned char msgType, const DataBlock& msg, int streamId);
5062};
5063
5068class YSIG_API SIGAdaptUser
5069{
5070 friend class SIGAdaptClient;
5071public:
5075 virtual ~SIGAdaptUser();
5076
5077protected:
5082 : m_autostart(false), m_streamId(1), m_adaptation(0)
5083 { }
5084
5089 inline SIGAdaptClient* adaptation() const
5090 { return m_adaptation; }
5091
5096 inline SIGTransport* transport() const
5097 { return m_adaptation ? m_adaptation->transport() : 0; }
5098
5103 void adaptation(SIGAdaptClient* adapt);
5104
5109 virtual void activeChange(bool active) = 0;
5110
5115 inline bool activate()
5116 { return m_adaptation && m_adaptation->activate(); }
5117
5122 inline bool aspUp() const
5123 { return m_adaptation && m_adaptation->aspUp(); }
5124
5129 inline bool aspActive() const
5130 { return m_adaptation && m_adaptation->aspActive(); }
5131
5136 inline unsigned char getStreamId()
5137 { return m_streamId; }
5138
5143
5147 unsigned char m_streamId;
5148
5149private:
5150 SIGAdaptClient* m_adaptation;
5151};
5152
5157class YSIG_API ASPUser
5158{
5159};
5160
5165class YSIG_API GTT : virtual public SignallingComponent
5166{
5167public:
5171 GTT(const NamedList& config);
5172
5176 virtual ~GTT();
5177
5185 virtual NamedList* routeGT(const NamedList& gt, const String& prefix, const String& nextPrefix);
5186
5190 virtual bool initialize(const NamedList* config);
5191
5196 virtual void attach(SCCP* sccp);
5197
5203 virtual void updateTables(const NamedList& params)
5204 { }
5205
5210 inline SCCP* sccp() const
5211 { return m_sccp; }
5212
5213protected:
5214 virtual void destroyed();
5215
5216private:
5217 SCCP* m_sccp;
5218
5219};
5220
5225class YSIG_API SCCP : virtual public SignallingComponent
5226{
5228 friend class SCCPManagement;
5229public:
5230
5231 enum Type { // used in management status method Flow
5232 CoordinateRequest = 0, // Request that a subsystem to go oos (out of service) (User->SCCP)
5233 CoordinateConfirm = 1, // Confirmation that a subsystem can go oos (SCCP->User)
5234 CoordinateIndication = 2, // Indication that a subsystem requires to go oos (SCCP->User)
5235 CoordinateResponse = 3, // Response to a subsystem requires to go oos (User->SCCP)
5236 StatusIndication = 4, // Indication form SCCP that a subsystem status has been changed (SCCP->User)
5237 StatusRequest = 5, // Indication from a user that a subsystem status has been changed (User->SCCP)
5238 PointCodeStatusIndication = 6, // Indication to User that a point code is available / unavailable (SCCP->User)
5239 TraficIndication = 7, // ANSI only! Indication that a traffic mix has been detected (SCCP->User).
5240 SubsystemStatus = 8, // Request from sccp t users to find the status of a local subsystem
5241 };
5242
5247
5251 virtual ~SCCP();
5252
5273 virtual int sendMessage(DataBlock& data, const NamedList& params);
5274
5281 virtual bool managementStatus(Type type, NamedList& params);
5282
5287 virtual void attach(SCCPUser* user);
5288
5293 virtual void detach(SCCPUser* user);
5294
5299 virtual void attachGTT(GTT* gtt);
5300
5305 static const TokenDict* notifTypes();
5306
5307 virtual void updateTables(const NamedList& params)
5308 {
5309 Lock lock(m_translatorLocker);
5310 if (m_translator)
5311 m_translator->updateTables(params);
5312 }
5313protected:
5321 NamedList* translateGT(const NamedList& params, const String& prefix,
5322 const String& nextPrefix);
5323
5331 HandledMSU pushMessage(DataBlock& data, NamedList& params, int ssn);
5332
5341
5348 bool managementMessage(Type type, NamedList& params);
5349
5354 virtual bool isEndpoint()
5355 { return false; }
5356
5362 void resolveGTParams(SS7MsgSCCP* msg, const NamedList* gtParams);
5363private:
5364 ObjList m_users;
5365 Mutex m_translatorLocker;
5366 Mutex m_usersLocker;
5367 GTT* m_translator;
5368};
5369
5370class YSIG_API SubsystemStatusTest : public RefObject
5371{
5373public:
5378 inline SubsystemStatusTest(u_int32_t interval)
5379 : m_interval(interval), m_statusInfo(interval), m_remoteSccp(0), m_remoteSubsystem(0),
5380 m_markAllowed(false)
5381 { }
5382
5387
5394 bool startTest(SccpRemote* remoteSccp, SccpSubsystem* rSubsystem);
5395
5401 { return m_remoteSccp; };
5402
5407 inline bool timeout()
5408 { return m_statusInfo.started() && m_statusInfo.timeout(); }
5409
5414 { return m_remoteSubsystem; }
5415
5420
5424 inline bool markAllowed()
5425 { return m_markAllowed; }
5426
5431 inline void setAllowed(bool allowed)
5432 { m_markAllowed = allowed; }
5433private:
5434 u_int32_t m_interval;
5435 SignallingTimer m_statusInfo;
5436 SccpRemote* m_remoteSccp;
5437 SccpSubsystem* m_remoteSubsystem;
5438 bool m_markAllowed;
5439};
5440
5445class YSIG_API SCCPUser : virtual public SignallingComponent
5446{
5448public:
5452 SCCPUser(const NamedList& params);
5453
5457 virtual ~SCCPUser();
5458
5464 virtual bool initialize(const NamedList* config);
5465
5473 virtual bool sendData(DataBlock& data, NamedList& params);
5474
5496 virtual bool sccpNotify(SCCP::Type type, NamedList& params);
5497
5505
5513 virtual HandledMSU notifyData(DataBlock& data, NamedList& params);
5514
5533 virtual bool managementNotify(SCCP::Type type, NamedList& params);
5534
5542 virtual void attach(SCCP* sccp);
5543
5548 inline SCCP* sccp() const
5549 { return m_sccp; }
5550
5551protected:
5552 virtual void destroyed();
5553
5554private:
5555 SCCP* m_sccp;
5556 Mutex m_sccpMutex;
5557 int m_sls;
5558};
5559
5564class YSIG_API TCAPUser : public SignallingComponent
5565{
5566 YCLASS(TCAPUser,SignallingComponent)
5567 friend class SS7TCAP;
5568public:
5569 TCAPUser(const char* name, const NamedList* params = 0)
5570 : SignallingComponent(name,params),
5571 m_tcap(0)
5572 {}
5576 virtual ~TCAPUser();
5577
5582 virtual void attach(SS7TCAP* tcap);
5583
5589 virtual bool tcapIndication(NamedList& params);
5590
5595 inline SS7TCAP* tcap() const
5596 { return m_tcap; }
5597
5604 virtual bool managementNotify(SCCP::Type type, NamedList& params);
5605
5610 virtual int managementState();
5611
5616 virtual void destroyed();
5617
5618protected:
5619 inline void setTCAP(SS7TCAP* tcap)
5620 {
5621 Lock l(m_tcapMtx);
5622 m_tcap = tcap;
5623 }
5624
5625private:
5626 SS7TCAP* m_tcap;
5627 Mutex m_tcapMtx;
5628};
5629
5630
5635class YSIG_API SS7L2User : virtual public SignallingComponent
5636{
5638 friend class SS7Layer2;
5639public:
5644 virtual void attach(SS7Layer2* link) = 0;
5645
5650 virtual void detach(SS7Layer2* link) = 0;
5651
5652protected:
5660 virtual bool receivedMSU(const SS7MSU& msu, SS7Layer2* link, int sls) = 0;
5661
5669 virtual bool recoveredMSU(const SS7MSU& msu, SS7Layer2* link, int sls) = 0;
5670
5675 virtual void notify(SS7Layer2* link) = 0;
5676};
5677
5682class YSIG_API SS7Layer2 : virtual public SignallingComponent
5683{
5685 friend class SS7MTP3;
5686public:
5691 OutOfAlignment = 0,
5692 NormalAlignment = 1,
5693 EmergencyAlignment = 2,
5694 OutOfService = 3,
5695 ProcessorOutage = 4,
5696 Busy = 5,
5697 // short versions as defined by RFC
5698 O = OutOfAlignment,
5699 N = NormalAlignment,
5700 E = EmergencyAlignment,
5701 OS = OutOfService,
5702 PO = ProcessorOutage,
5703 B = Busy,
5704 };
5705
5710 // take link out of service
5711 Pause = 0x100,
5712 // start link operation, align if it needs to
5713 Resume = 0x200,
5714 // start link, force realignment
5715 Align = 0x300,
5716 // get operational status
5717 Status = 0x400,
5718 };
5719
5724 // basic maintenance checks not performed
5725 Unchecked = 0x01,
5726 // management inactivation
5727 Inactive = 0x02,
5728 // locally inhibited
5729 Local = 0x04,
5730 // remotely inhibited
5731 Remote = 0x08,
5732 };
5733
5739 virtual bool transmitMSU(const SS7MSU& msu) = 0;
5740
5745 virtual void recoverMSU(int sequence)
5746 { }
5747
5752 virtual unsigned int status() const;
5753
5760 virtual const char* statusName(unsigned int status, bool brief) const;
5761
5767 inline const char* statusName(bool brief = false) const
5768 { return statusName(status(),brief); }
5769
5774 virtual bool operational() const = 0;
5775
5780 unsigned int upTime() const
5781 { return m_lastUp ? (Time::secNow() - m_lastUp) : 0; }
5782
5787 void attach(SS7L2User* l2user);
5788
5793 inline SS7L2User* user() const
5794 { return m_l2user; }
5795
5800 inline int sls() const
5801 { return m_sls; }
5802
5807 inline void sls(int linkSel)
5808 { if ((m_sls < 0) || !m_l2user) m_sls = linkSel; }
5809
5814 inline int inhibited() const
5815 { return m_inhibited; }
5816
5822 inline bool inhibited(int flags) const
5823 { return (m_inhibited & flags) != 0; }
5824
5829 virtual unsigned int congestion()
5830 { return m_congestion; }
5831
5836 virtual int getSequence()
5837 { return m_lastSeqRx; }
5838
5847 virtual bool control(Operation oper, NamedList* params = 0);
5848
5854 virtual bool control(NamedList& params);
5855
5856protected:
5860 inline SS7Layer2()
5861 : m_autoEmergency(true), m_lastSeqRx(-1), m_congestion(0),
5862 m_l2userMutex(true,"SS7Layer2::l2user"), m_l2user(0), m_sls(-1),
5863 m_checkTime(0), m_checkFail(0), m_inhibited(Unchecked), m_lastUp(0),
5864 m_notify(false)
5865 { }
5866
5871 virtual void timerTick(const Time& when);
5872
5878 inline bool receivedMSU(const SS7MSU& msu)
5879 {
5880 m_l2userMutex.lock();
5881 RefPointer<SS7L2User> tmp = m_l2user;
5882 m_l2userMutex.unlock();
5883 return tmp && tmp->receivedMSU(msu,this,m_sls);
5884 }
5885
5891 inline bool recoveredMSU(const SS7MSU& msu)
5892 {
5893 m_l2userMutex.lock();
5894 RefPointer<SS7L2User> tmp = m_l2user;
5895 m_l2userMutex.unlock();
5896 return tmp && tmp->recoveredMSU(msu,this,m_sls);
5897 }
5898
5903 void notify();
5904
5911 bool inhibit(int setFlags, int clrFlags = 0);
5912
5919 bool getEmergency(NamedList* params = 0, bool emg = false) const;
5920
5925
5930
5934 unsigned int m_congestion;
5935
5936private:
5937 Mutex m_l2userMutex;
5938 SS7L2User* m_l2user;
5939 int m_sls;
5940 u_int64_t m_checkTime;
5941 int m_checkFail;
5942 int m_inhibited;
5943 u_int32_t m_lastUp;
5944 bool m_notify; // Notify on timer tick
5945};
5946
5952class YSIG_API SS7Route : public RefObject, public Mutex
5953{
5954 friend class SS7Layer3;
5955 friend class SS7Router;
5956public:
5960 enum State {
5961 Unknown = 0x80,
5962 // Standard route states
5963 Prohibited = 0x01,
5964 Restricted = 0x02,
5965 Congestion = 0x04,
5966 Allowed = 0x08,
5967 // Masks for typical combinations
5968 NotAllowed = 0x77,
5969 NotCongested = 0x78,
5970 NotRestricted = 0x7c,
5971 NotProhibited = 0x7e,
5972 KnownState = 0x7f,
5973 AnyState = 0xff
5974 };
5975
5985 inline SS7Route(unsigned int packed, SS7PointCode::Type type,
5986 unsigned int priority = 0, unsigned int shift = 0,
5987 unsigned int maxDataLength = MAX_TDM_MSU_SIZE)
5988 : Mutex(true,"SS7Route"), m_packed(packed), m_type(type),
5989 m_priority(priority), m_shift(shift),m_maxDataLength(maxDataLength),
5990 m_state(Unknown),m_buffering(0), m_congCount(0),m_congBytes(0)
5991 { m_networks.setDelete(false); }
5992
5997 inline SS7Route(const SS7Route& original)
5998 : Mutex(true,"SS7Route"), m_packed(original.packed()),
5999 m_type(original.m_type), m_priority(original.priority()),
6000 m_shift(original.shift()), m_maxDataLength(original.getMaxDataLength()),
6001 m_state(original.state()), m_buffering(0), m_congCount(0), m_congBytes(0)
6002 { m_networks.setDelete(false); }
6003
6007 virtual ~SS7Route()
6008 { }
6009
6014 State state() const
6015 { return m_state; }
6016
6021 static const TokenDict* stateNames();
6022
6027 const char* stateName() const
6028 { return lookup(m_state,stateNames()); }
6029
6035 static const char* stateName(State state)
6036 { return lookup(state,stateNames()); }
6037
6042 unsigned int priority() const
6043 { return m_priority; }
6044
6049 unsigned int getMaxDataLength() const
6050 { return m_maxDataLength; }
6051
6056 unsigned int packed() const
6057 { return m_packed; }
6058
6063 unsigned int shift() const
6064 { return m_shift; }
6065
6072 void attach(SS7Layer3* network, SS7PointCode::Type type);
6073
6080 bool detach(SS7Layer3* network);
6081
6087 bool hasNetwork(const SS7Layer3* network);
6088
6094 bool hasNetwork(const SS7Layer3* network) const;
6095
6101 bool operational(int sls = -1);
6102
6114 int transmitMSU(const SS7Router* router, const SS7MSU& msu,
6115 const SS7Label& label, int sls, State states, const SS7Layer3* source = 0);
6116
6122
6126 void reroute();
6127
6128private:
6129 int transmitInternal(const SS7Router* router, const SS7MSU& msu,
6130 const SS7Label& label, int sls, State states, const SS7Layer3* source);
6131 void rerouteCheck(u_int64_t when);
6132 void rerouteFlush();
6133 unsigned int m_packed; // Packed destination point code
6134 SS7PointCode::Type m_type; // The point code type
6135 unsigned int m_priority; // Network priority for the given destination (used by SS7Layer3)
6136 unsigned int m_shift; // SLS right shift when selecting linkset
6137 unsigned int m_maxDataLength; // The maximum data length that can be transported on this route
6138 ObjList m_networks; // List of networks used to route to the given destination (used by SS7Router)
6139 State m_state; // State of the route
6140 u_int64_t m_buffering; // Time when controlled rerouting ends
6141 ObjList m_reroute; // Controlled rerouting buffer
6142 unsigned int m_congCount; // Congestion event count
6143 unsigned int m_congBytes; // Congestion MSU bytes count
6144};
6145
6150class YSIG_API SS7L3User : virtual public SignallingComponent
6151{
6152 friend class SS7Layer3;
6153 friend class SS7Router;
6154public:
6159 virtual void attach(SS7Layer3* network) = 0;
6160
6161protected:
6170 virtual HandledMSU receivedMSU(const SS7MSU& msu, const SS7Label& label, SS7Layer3* network, int sls) = 0;
6171
6180 virtual bool recoveredMSU(const SS7MSU& msu, const SS7Label& label, SS7Layer3* network, int sls)
6181 { return false; }
6182
6192 virtual void receivedUPU(SS7PointCode::Type type, const SS7PointCode node,
6193 SS7MSU::Services part, unsigned char cause, const SS7Label& label, int sls)
6194 { }
6195
6201 virtual void notify(SS7Layer3* link, int sls);
6202
6210 { }
6211
6218 static ObjList* getNetRoutes(SS7Layer3* network, SS7PointCode::Type type);
6219
6226 static const ObjList* getNetRoutes(const SS7Layer3* network, SS7PointCode::Type type);
6227};
6228
6233class YSIG_API SS7Layer3 : virtual public SignallingComponent
6234{
6236 friend class SS7L3User;
6237 friend class SS7Router; // Access the data members to build the routing table
6238 friend class SS7Route;
6239public:
6243 virtual ~SS7Layer3()
6244 { attach(0); }
6245
6251 virtual bool initialize(const NamedList* config);
6252
6260 virtual int transmitMSU(const SS7MSU& msu, const SS7Label& label, int sls = -1) = 0;
6261
6267 virtual bool operational(int sls = -1) const = 0;
6268
6274 virtual int inhibited(int sls) const
6275 { return 0; }
6276
6283 inline bool inhibited(int sls, int flags) const
6284 { return (inhibited(sls) & flags) != 0; }
6285
6293 virtual bool inhibit(int sls, int setFlags, int clrFlags = 0)
6294 { return false; }
6295
6302 inline bool inService(int sls, int ignore = 0)
6303 { return operational(sls) && !inhibited(sls,~ignore); }
6304
6310 virtual unsigned int congestion(int sls)
6311 { return 0; }
6312
6318 virtual int getSequence(int sls) const
6319 { return -1; }
6320
6326 virtual void recoverMSU(int sls, int sequence)
6327 { }
6328
6333 virtual bool restart()
6334 { return false; }
6335
6341 void attach(SS7L3User* l3user);
6342
6347 inline SS7L3User* user() const
6348 { return m_l3user; }
6349
6355 SS7PointCode::Type type(unsigned char netType) const;
6356
6362 void setType(SS7PointCode::Type type, unsigned char netType);
6363
6369
6375 bool hasType(SS7PointCode::Type pcType) const;
6376
6383 virtual unsigned char getNI(SS7PointCode::Type pcType, unsigned char defNI) const;
6384
6390 inline unsigned char getNI(SS7PointCode::Type pcType) const
6391 { return getNI(pcType,m_defNI); }
6392
6397 inline unsigned char getNI() const
6398 { return m_defNI; }
6399
6404 void setNI(unsigned char defNI);
6405
6412 bool buildRoutes(const NamedList& params);
6413
6421 unsigned int getRouteMaxLength(SS7PointCode::Type type, unsigned int packedPC);
6422
6430 unsigned int getRoutePriority(SS7PointCode::Type type, unsigned int packedPC);
6431
6439 inline unsigned int getRoutePriority(SS7PointCode::Type type, const SS7PointCode& dest)
6440 { return getRoutePriority(type,dest.pack(type)); }
6441
6450 SS7Route::State getRouteState(SS7PointCode::Type type, unsigned int packedPC, bool checkAdjacent = false);
6451
6460 inline SS7Route::State getRouteState(SS7PointCode::Type type, const SS7PointCode& dest, bool checkAdjacent = false)
6461 { return getRouteState(type,dest.pack(type),checkAdjacent); }
6462
6469 virtual bool allowedTo(SS7PointCode::Type type, unsigned int packedPC) const
6470 { return true; }
6471
6476
6482 inline unsigned int getLocal(SS7PointCode::Type type) const
6483 { return (type < SS7PointCode::DefinedTypes) ? m_local[type-1] : 0; }
6484
6490 virtual unsigned int getDefaultLocal(SS7PointCode::Type type) const
6491 { return getLocal(type); }
6492
6493protected:
6498 SS7Layer3(SS7PointCode::Type type = SS7PointCode::Other);
6499
6507 inline HandledMSU receivedMSU(const SS7MSU& msu, const SS7Label& label, int sls)
6508 {
6509 m_l3userMutex.lock();
6510 RefPointer<SS7L3User> tmp = m_l3user;
6511 m_l3userMutex.unlock();
6512 return tmp ? tmp->receivedMSU(msu,label,this,sls) : HandledMSU(HandledMSU::Unequipped);
6513 }
6514
6522 inline bool recoveredMSU(const SS7MSU& msu, const SS7Label& label, int sls)
6523 {
6524 m_l3userMutex.lock();
6525 RefPointer<SS7L3User> tmp = m_l3user;
6526 m_l3userMutex.unlock();
6527 return tmp && tmp->recoveredMSU(msu,label,this,sls);
6528 }
6529
6534 inline void notify(int sls = -1)
6535 {
6536 m_l3userMutex.lock();
6537 RefPointer<SS7L3User> tmp = m_l3user;
6538 m_l3userMutex.unlock();
6539 if (tmp)
6540 tmp->notify(this,sls);
6541 }
6542
6548 virtual void linkChecked(int sls, bool remote)
6549 { }
6550
6558 virtual bool maintenance(const SS7MSU& msu, const SS7Label& label, int sls);
6559
6567 virtual bool management(const SS7MSU& msu, const SS7Label& label, int sls);
6568
6577 virtual bool unavailable(const SS7MSU& msu, const SS7Label& label, int sls, unsigned char cause = 0);
6578
6586 virtual bool prohibited(unsigned char ssf, const SS7Label& label, int sls);
6587
6592 virtual bool responder() const
6593 { return true; }
6594
6602 SS7Route* findRoute(SS7PointCode::Type type, unsigned int packed);
6603
6610 { return (type < SS7PointCode::DefinedTypes) ? &m_route[type-1] : 0; }
6611
6618 { return (type < SS7PointCode::DefinedTypes) ? &m_route[type-1] : 0; }
6619
6622
6624 ObjList m_route[YSS7_PCTYPE_COUNT];
6625
6626private:
6627 Mutex m_l3userMutex; // Mutex to lock L3 user pointer
6628 SS7L3User* m_l3user;
6629 SS7PointCode::Type m_cpType[4]; // Map incoming MSUs net indicators to point code type
6630 // or the routing table of a message router
6631 unsigned int m_local[YSS7_PCTYPE_COUNT];
6632 unsigned char m_defNI; // Default Network Indicator
6633};
6634
6639class YSIG_API SS7Layer4 : public SS7L3User
6640{
6641public:
6646 virtual void destroyed();
6647
6653 virtual bool initialize(const NamedList* config);
6654
6659 virtual void attach(SS7Layer3* network);
6660
6665 inline SS7Layer3* network() const
6666 { return m_layer3; }
6667
6672 inline unsigned char sio() const
6673 { return m_sio; }
6674
6679 inline unsigned char sif() const
6680 { return m_sio & 0x0f; }
6681
6686 inline unsigned char ssf() const
6687 { return m_sio & 0xf0; }
6688
6693 inline unsigned char prio() const
6694 { return m_sio & 0x30; }
6695
6700 inline unsigned char ni() const
6701 { return m_sio & 0xc0; }
6702
6711 static unsigned char getSIO(const NamedList& params, unsigned char sif, unsigned char prio, unsigned char ni);
6712
6720 static inline unsigned char getSIO(const NamedList& params, unsigned char sif, unsigned char ssf)
6721 { return getSIO(params,sif,ssf & 0x30,ssf & 0xc0); }
6722
6729 static inline unsigned char getSIO(const NamedList& params, unsigned char sio)
6730 { return getSIO(params,sio & 0x0f,sio & 0x30,sio & 0xc0); }
6731
6737 inline unsigned char getSIO(const NamedList& params) const
6738 { return getSIO(params,m_sio); }
6739
6740protected:
6746 SS7Layer4(unsigned char sio = SS7MSU::National, const NamedList* params = 0);
6747
6755 inline int transmitMSU(const SS7MSU& msu, const SS7Label& label, int sls = -1)
6756 {
6757 m_l3Mutex.lock();
6758 RefPointer<SS7Layer3> tmp = m_layer3;
6759 m_l3Mutex.unlock();
6760 return tmp ? tmp->transmitMSU(msu,label,sls) : -1;
6761 }
6762
6766 unsigned char m_sio;
6767
6768private:
6769 Mutex m_l3Mutex; // Lock pointer use operations
6770 SS7Layer3* m_layer3;
6771};
6772
6778class YSIG_API SS7Router : public SS7L3User, public SS7Layer3, public Mutex
6779{
6780 YCLASS2(SS7Router,SS7L3User,SS7Layer3)
6781public:
6786 // stop MTP operation, disable the router
6787 Pause = 0x100,
6788 // start router, restart MTP if needed
6789 Resume = 0x200,
6790 // forcibly execute MTP restart
6791 Restart = 0x300,
6792 // get operational status
6793 Status = 0x400,
6794 // forcibly advertise availability to adjacent routes
6795 Traffic = 0x500,
6796 // forcibly advertise available routes
6797 Advertise = 0x600,
6798 };
6799
6804 SS7Router(const NamedList& params);
6805
6809 virtual ~SS7Router();
6810
6816 virtual bool initialize(const NamedList* config);
6817
6825 virtual int transmitMSU(const SS7MSU& msu, const SS7Label& label, int sls = -1);
6826
6832 virtual bool operational(int sls = -1) const;
6833
6838 virtual bool restart();
6839
6844 virtual void attach(SS7Layer3* network);
6845
6850 virtual void detach(SS7Layer3* network);
6851
6856 void attach(SS7Layer4* service);
6857
6862 void detach(SS7Layer4* service);
6863
6871 bool uninhibit(SS7Layer3* network, int sls, bool remote);
6872
6881 bool inhibit(const SS7Label& link, int setFlags, int clrFlags = 0, bool notLast = false);
6882
6889 bool inhibited(const SS7Label& link, int flags);
6890
6896 int getSequence(const SS7Label& link);
6897
6903 void recoverMSU(const SS7Label& link, int sequence);
6904
6915 SS7MSU::Services part, unsigned char cause, const SS7Label& label, int sls);
6916
6921 inline bool transfer() const
6922 { return m_transfer; }
6923
6928 inline bool transferring() const
6929 { return m_transfer || m_transferSilent; }
6930
6935 inline bool starting() const
6936 { return !m_started; }
6937
6943 { return m_mngmt; }
6944
6951 virtual unsigned char getNI(SS7PointCode::Type pcType, unsigned char defNI) const;
6952
6958 virtual unsigned int getDefaultLocal(SS7PointCode::Type type) const;
6959
6960protected:
6964 void clearView(const SS7Layer3* network);
6965
6975 unsigned int remotePC = 0, const SS7Layer3* network = 0);
6976
6987 bool setRouteState(SS7PointCode::Type type, unsigned int packedPC, SS7Route::State state,
6988 unsigned int remotePC = 0, const SS7Layer3* network = 0);
6989
7001 unsigned int remotePC = 0, const SS7Layer3* network = 0)
7002 { return setRouteState(type,dest.pack(type),state,remotePC,network); }
7003
7008 void loadLocalPC(const NamedList& params);
7009
7014 virtual void timerTick(const Time& when);
7015
7024 virtual HandledMSU receivedMSU(const SS7MSU& msu, const SS7Label& label, SS7Layer3* network, int sls);
7025
7031 void updateRoutes(SS7Layer3* network);
7032
7039 void removeRoutes(SS7Layer3* network);
7040
7046 void notifyRoutes(SS7Route::State states = SS7Route::AnyState, unsigned int onlyPC = 0);
7047
7053 void notifyRoutes(SS7Route::State states, const SS7Layer3* network);
7054
7065 virtual void routeChanged(const SS7Route* route, SS7PointCode::Type type,
7066 unsigned int remotePC = 0, const SS7Layer3* network = 0,
7067 unsigned int onlyPC = 0, bool forced = false);
7068
7075 virtual void notify(SS7Layer3* network, int sls);
7076
7082 virtual bool control(NamedList& params);
7083
7087 virtual void destroyed();
7088
7105
7106private:
7107 void restart2();
7108 void disable();
7109 void sendRestart(const SS7Layer3* network = 0);
7110 void sendRestart(SS7PointCode::Type type, unsigned int packedPC);
7111 void silentAllow(const SS7Layer3* network = 0);
7112 void silentAllow(SS7PointCode::Type type, unsigned int packedPC);
7113 void checkRoutes(const SS7Layer3* noResume = 0);
7114 void clearRoutes(SS7Layer3* network, bool ok);
7115 void reroute(const SS7Layer3* network);
7116 void rerouteCheck(const Time& when);
7117 void rerouteFlush();
7118 bool setRouteSpecificState(SS7PointCode::Type type, unsigned int packedPC,
7119 unsigned int srcPC, SS7Route::State state, const SS7Layer3* changer = 0);
7120 inline bool setRouteSpecificState(SS7PointCode::Type type, const SS7PointCode& dest,
7121 const SS7PointCode&src, SS7Route::State state, const SS7Layer3* changer = 0)
7122 { return setRouteSpecificState(type,dest.pack(type),src.pack(type),state,changer); }
7123 void sendRouteTest();
7124 int routeMSU(const SS7MSU& msu, const SS7Label& label, SS7Layer3* network, int sls, SS7Route::State states);
7125 void buildView(SS7PointCode::Type type, ObjList& view, SS7Layer3* network);
7126 void buildViews();
7127 void printStats();
7128 Mutex m_statsMutex;
7129 SignallingTimer m_trafficOk;
7130 SignallingTimer m_trafficSent;
7131 SignallingTimer m_routeTest;
7132 bool m_testRestricted;
7133 bool m_transferSilent;
7134 bool m_checkRoutes;
7135 bool m_autoAllowed;
7136 bool m_sendUnavail;
7137 bool m_sendProhibited;
7138 unsigned long m_rxMsu;
7139 unsigned long m_txMsu;
7140 unsigned long m_fwdMsu;
7141 unsigned long m_failMsu;
7142 unsigned long m_congestions;
7143 SS7Management* m_mngmt;
7144};
7145
7152class YSIG_API SS7M2PA : public SS7Layer2, public SIGTRAN
7153{
7154 YCLASS(SS7M2PA,SS7Layer2)
7155public:
7156 enum m2paState {
7157 Alignment = 1,
7158 ProvingNormal = 2,
7159 ProvingEmergency = 3,
7160 Ready = 4,
7161 ProcessorOutage = 5,
7162 ProcessorRecovered = 6,
7163 Busy = 7,
7164 BusyEnded = 8,
7165 OutOfService = 9,
7166 };
7167
7168 enum msgType {
7169 UserData = 1,
7170 LinkStatus = 2
7171 };
7172
7173 enum sctpState {
7174 Idle,
7175 Associating,
7176 Established
7177 };
7178
7179 enum M2PAOperations {
7180 Pause = SS7Layer2::Pause,
7181 // start link operation, align if it needs to
7182 Resume = SS7Layer2::Resume,
7183 // start link, force realignment
7184 Align = SS7Layer2::Align,
7185 // get operational status
7186 Status = SS7Layer2::Status,
7187 // restart transport layer
7188 TransRestart = 0x500
7189 };
7190
7194 SS7M2PA(const NamedList& params);
7195
7200
7206 virtual bool initialize(const NamedList* config);
7207
7213 virtual bool control(NamedList& params);
7214
7223 virtual bool control(M2PAOperations oper, NamedList* params = 0);
7224
7233 virtual bool control(SS7Layer2::Operation oper, NamedList* params = 0)
7234 { return control((M2PAOperations)oper,params); }
7235
7240 virtual unsigned int status() const;
7241
7247 virtual bool transmitMSU(const SS7MSU& msu);
7248
7254
7259 virtual void recoverMSU(int sequence);
7260
7267 bool decodeSeq(const DataBlock& data, u_int8_t msgType);
7268
7274 void abortAlignment(const char* info = 0);
7275
7280 void transmitLS(int streamId = 0);
7281
7287
7294 bool processLinkStatus(DataBlock& data, int streamId);
7295
7302 bool processSLinkStatus(DataBlock& data, int streamId);
7303
7308 void sendAck();
7309
7315 bool removeFrame(u_int32_t bsn);
7316
7322 bool nextBsn(u_int32_t bsn) const;
7323
7329 static inline u_int32_t increment(u_int32_t& nr)
7330 { return (nr == 0xffffff) ? (nr = 0) : nr++; }
7331
7337 static inline u_int32_t getNext(u_int32_t nr)
7338 { return (nr == 0xffffff) ? 0 : nr + 1; }
7339
7340protected:
7341
7346 virtual void timerTick(const Time& when);
7347
7353 virtual bool aligned() const;
7354
7359 virtual bool operational() const;
7360
7370 virtual bool processMSG(unsigned char msgVersion, unsigned char msgClass,
7371 unsigned char msgType, const DataBlock& msg, int streamId);
7372
7377 void startAlignment(bool emergency = false);
7378
7383
7384 virtual void destroyed();
7385private:
7386 void dumpMsg(u_int8_t version, u_int8_t mClass, u_int8_t type,
7387 const DataBlock& data, int stream, bool send);
7388 void setLocalStatus(unsigned int status);
7389 void setRemoteStatus(unsigned int status);
7390 u_int32_t m_seqNr;
7391 u_int32_t m_needToAck;
7392 u_int32_t m_lastAck;
7393 u_int32_t m_confCounter;
7394 u_int32_t m_maxUnack;
7395 u_int32_t m_maxQueueSize;
7396 unsigned int m_localStatus;
7397 unsigned int m_state;
7398 unsigned int m_remoteStatus;
7399 unsigned int m_transportState;
7400 unsigned int m_connFailCounter;
7401 unsigned int m_connFailThreshold;
7402 Mutex m_mutex;
7403 ObjList m_ackList;
7404 SignallingTimer m_t1;
7405 SignallingTimer m_t2;
7406 SignallingTimer m_t3;
7407 SignallingTimer m_t4;
7408 SignallingTimer m_ackTimer;
7409 SignallingTimer m_confTimer;
7410 SignallingTimer m_oosTimer;
7411 SignallingTimer m_waitOosTimer;
7412 SignallingTimer m_connFailTimer;
7413 bool m_autostart;
7414 bool m_sequenced;
7415 bool m_dumpMsg;
7416};
7417
7422class YSIG_API SS7M2UAClient : public SIGAdaptClient
7423{
7425public:
7429 inline SS7M2UAClient(const NamedList& params)
7430 : SIGAdaptClient(params.safe("SS7M2UAClient"),&params,2,2904)
7431 { }
7432 virtual bool processMSG(unsigned char msgVersion, unsigned char msgClass,
7433 unsigned char msgType, const DataBlock& msg, int streamId);
7434};
7435
7442class YSIG_API SS7M2UA : public SS7Layer2, public SIGAdaptUser
7443{
7444 friend class SS7M2UAClient;
7445 YCLASS(SS7M2UA,SS7Layer2)
7446public:
7451 SS7M2UA(const NamedList& params);
7452
7458 virtual bool initialize(const NamedList* config);
7459
7468 virtual bool control(Operation oper, NamedList* params = 0);
7469
7474 virtual unsigned int status() const;
7475
7481 virtual bool transmitMSU(const SS7MSU& msu);
7482
7487 virtual void recoverMSU(int sequence);
7488
7493 virtual bool operational() const;
7494
7499 virtual int getSequence();
7500
7505 virtual void activeChange(bool active);
7506
7511 inline int32_t iid() const
7512 { return m_iid; }
7513
7514protected:
7515 enum LinkState {
7516 LinkDown,
7517 LinkReq,
7518 LinkReqEmg,
7519 LinkUp,
7520 LinkUpEmg,
7521 };
7522
7527 virtual void timerTick(const Time& when);
7528
7529 SS7M2UAClient* client() const
7530 { return static_cast<SS7M2UAClient*>(adaptation()); }
7531 virtual bool processMGMT(unsigned char msgType, const DataBlock& msg, int streamId);
7532 virtual bool processMAUP(unsigned char msgType, const DataBlock& msg, int streamId);
7533 void postRetrieve();
7534 SignallingTimer m_retrieve;
7535 int32_t m_iid;
7536 int m_linkState;
7537 bool m_rpo;
7538 bool m_longSeq;
7539};
7540
7547class YSIG_API SS7M3UA : public SS7Layer3, public SIGAdaptUser
7548{
7549 YCLASS(SS7M3UA,SS7Layer3)
7550};
7551
7556class YSIG_API SS7MTP2 : public SS7Layer2, public SignallingReceiver, public SignallingDumpable, public Mutex
7557{
7559public:
7564 Basic, // retransmits only based on sequence numbers
7565 Preventive, // continuously retransmit unacknowledged packets
7566 Adaptive, // switch to using preventive retransmission dynamically
7567 };
7568
7574 SS7MTP2(const NamedList& params, unsigned int status = OutOfService);
7575
7579 virtual ~SS7MTP2();
7580
7586 virtual bool initialize(const NamedList* config);
7587
7593 virtual bool transmitMSU(const SS7MSU& msu);
7594
7599 virtual void recoverMSU(int sequence);
7600
7605 virtual unsigned int status() const;
7606
7612 virtual bool aligned() const;
7613
7618 virtual bool operational() const;
7619
7628 virtual bool control(Operation oper, NamedList* params = 0);
7629
7636
7637protected:
7641 virtual void destroyed()
7642 {
7644 TelEngine::destruct(SignallingReceiver::attach(0));
7646 }
7647
7652 virtual void timerTick(const Time& when);
7653
7658 virtual bool receivedPacket(const DataBlock& packet);
7659
7663 virtual void processFISU();
7664
7669 virtual void processLSSU(unsigned int status);
7670
7676 bool transmitLSSU(unsigned int status);
7677
7682 inline bool transmitLSSU()
7683 { return transmitLSSU(m_lStatus); }
7684
7690
7695 void startAlignment(bool emergency = false);
7696
7701 void abortAlignment(bool retry = true);
7702
7708
7709private:
7710 virtual bool control(NamedList& params)
7711 { return SignallingDumpable::control(params,this) || SS7Layer2::control(params); }
7712 void unqueueAck(unsigned char bsn);
7713 bool txPacket(const DataBlock& packet, bool repeat, SignallingInterface::PacketType type = SignallingInterface::Unknown);
7714 void setLocalStatus(unsigned int status);
7715 void setRemoteStatus(unsigned int status);
7716 // sent but yet unacknowledged packets
7717 ObjList m_queue;
7718 // data link status (alignment) - desired, local and remote
7719 unsigned int m_status, m_lStatus, m_rStatus;
7720 // various interval period end
7721 u_int64_t m_interval;
7722 // time when resending packets
7723 u_int64_t m_resend;
7724 // time when aborting resending packets
7725 u_int64_t m_abort;
7726 // time when need to transmit next FISU/LSSU
7727 u_int64_t m_fillTime;
7728 // remote congestion indicator
7729 bool m_congestion;
7730 // backward and forward sequence numbers
7731 unsigned char m_bsn, m_fsn;
7732 // backward and forward indicator bits
7733 bool m_bib, m_fib;
7734 // last forward sequence number we sent a retransmission request
7735 unsigned char m_lastFsn;
7736 // last received backward sequence number
7737 unsigned char m_lastBsn;
7738 // last received backward indicator bit
7739 bool m_lastBib;
7740 // count of errors
7741 unsigned int m_errors;
7742 // maximum accepted errors
7743 unsigned int m_maxErrors;
7744 // packet resend interval
7745 unsigned int m_resendMs;
7746 // packet resend abort interval
7747 unsigned int m_abortMs;
7748 // FISU/LSSU soft resend interval
7749 unsigned int m_fillIntervalMs;
7750 // fill link with end-to-end FISU/LSSU
7751 bool m_fillLink;
7752 // automatically align on resume
7753 bool m_autostart;
7754 // flush MSUs after aligning
7755 bool m_flushMsus;
7756};
7757
7762class YSIG_API SS7MTP3 : public SS7Layer3, public SS7L2User, public SignallingDumpable, public Mutex
7763{
7764 YCLASS(SS7MTP3,SS7Layer3)
7765public:
7770 // take linkset out of service
7771 Pause = 0x100,
7772 // start linkset operation
7773 Resume = 0x200,
7774 // force a MTP restart procedure
7775 Restart = 0x300,
7776 // get operational status
7777 Status = 0x400,
7778 };
7779
7784 SS7MTP3(const NamedList& params);
7785
7789 virtual ~SS7MTP3();
7790
7796 virtual bool initialize(const NamedList* config);
7797
7805 virtual int transmitMSU(const SS7MSU& msu, const SS7Label& label, int sls = -1);
7806
7812 virtual bool operational(int sls = -1) const;
7813
7819 virtual int inhibited(int sls) const;
7820
7828 virtual bool inhibit(int sls, int setFlags, int clrFlags = 0);
7829
7835 virtual unsigned int congestion(int sls);
7836
7842 virtual int getSequence(int sls) const;
7843
7849 virtual void recoverMSU(int sls, int sequence);
7850
7858 virtual bool control(Operation oper, NamedList* params = 0);
7859
7864 virtual void attach(SS7Layer2* link);
7865
7870 virtual void detach(SS7Layer2* link);
7871
7877 virtual bool control(NamedList& params);
7878
7885 virtual bool allowedTo(SS7PointCode::Type type, unsigned int packedPC) const;
7886
7891 inline unsigned int linksTotal() const
7892 { return m_total; }
7893
7898 inline unsigned int linksChecked() const
7899 { return m_checked; }
7900
7905 inline unsigned int linksActive() const
7906 { return m_active; }
7907
7912 inline const ObjList* links() const
7913 { return &m_links; }
7914
7915protected:
7919 virtual void destroyed();
7920
7925 virtual void timerTick(const Time& when);
7926
7932 virtual void linkChecked(int sls, bool remote);
7933
7938 virtual bool responder() const
7939 { return !m_inhibit; }
7940
7948 virtual bool receivedMSU(const SS7MSU& msu, SS7Layer2* link, int sls);
7949
7957 virtual bool recoveredMSU(const SS7MSU& msu, SS7Layer2* link, int sls);
7958
7964 virtual void notify(SS7Layer2* link);
7965
7970 unsigned int countLinks();
7971
7972private:
7973 ObjList m_links;
7974 // total links in linkset
7975 unsigned int m_total;
7976 // checked links in linkset
7977 unsigned int m_checked;
7978 // currently active links
7979 unsigned int m_active;
7980 // SLS to SLC shift
7981 bool m_slcShift;
7982 // inhibited flag
7983 bool m_inhibit;
7984 // warn if all links are down
7985 bool m_warnDown;
7986 // check the links before placing them in service
7987 bool m_checklinks;
7988 // realign links that don't respond to test messages anymore
7989 bool m_forcealign;
7990 // maintenance check intervals (Q.707)
7991 u_int64_t m_checkT1;
7992 u_int64_t m_checkT2;
7993 // list of allowed point codes seen from this network
7994 unsigned int* m_allowed[YSS7_PCTYPE_COUNT];
7995};
7996
8001class YSIG_API SS7MsgSNM : public SignallingMessage
8002{
8003public:
8007 enum Type {
8008 Unknown = 0,
8009 COO = 0x11, // Changeover Order signal
8010 ECO = 0x12, // Emergency Changeover Order signal
8011 RCT = 0x13, // Route Set Congestion Test signal
8012 TFP = 0x14, // Transfer Prohibited signal
8013 RST = 0x15, // Route Set Test for prohibited destination
8014 RSP = RST, // Route Set Test for prohibited destination (ANSI)
8015 LIN = 0x16, // Link Inhibit signal
8016 TRA = 0x17, // Traffic Restart Allowed signal
8017 DLC = 0x18, // Data Link Connection Order signal
8018 UPU = 0x1a, // User Part Unavailable signal
8019 COA = 0x21, // Changeover Acknowledgment signal
8020 ECA = 0x22, // Emergency Changeover Acknowledgment signal
8021 TFC = 0x23, // Transfer Controlled signal
8022 TCP = 0x24, // Transfer Cluster Prohibited
8023 TFPA = TCP, // Transfer Prohibited Acknowledgment (Yellow Book only)
8024 RSR = 0x25, // Route Set Test for prohibited destination (national use)
8025 LUN = 0x26, // Link Uninhibit signal
8026 TRW = 0x27, // Traffic Restart Waiting (ANSI only)
8027 CSS = 0x28, // Connection Successful signal
8028 XCO = 0x31, // Extended Changeover Order signal
8029 TFR = 0x34, // Transfer Restricted signal (national use)
8030 RCP = 0x35, // Route Set Test for cluster-prohibited
8031 LIA = 0x36, // Link Inhibit Acknowledgment signal
8032 CNS = 0x38, // Connection Not Successful signal
8033 XCA = 0x41, // Extended Changeover Acknowledgment signal
8034 TCR = 0x44, // Transfer Cluster Restricted signal (ANSI only)
8035 RCR = 0x45, // Route Set Test for cluster-restricted (ANSI only)
8036 LUA = 0x46, // Link Uninhibit Acknowledgment signal
8037 CNP = 0x48, // Connection Not Possible signal
8038 CBD = 0x51, // Changeback Declaration signal
8039 TFA = 0x54, // Transfer Allowed signal
8040 LID = 0x56, // Link Inhibit Denied signal
8041 CBA = 0x61, // Changeback Acknowledgment signal
8042 TCA = 0x64, // Transfer Cluster Allowed
8043 TFAA = TCA, // Transfer Allowed Acknowledgment (Yellow Book only)
8044 LFU = 0x66, // Link Forced Uninhibit signal
8045 LLT = 0x76, // Link Local Inhibit Test signal
8046 LLI = LLT, // Link Local Inhibit Test signal (ANSI)
8047 LRT = 0x86, // Link Remote Inhibit Test signal
8048 LRI = LRT, // Link Remote Inhibit Test signal (ANSI)
8049 };
8050
8054 enum Group {
8055 CHM = 0x01, // Changeover and changeback
8056 ECM = 0x02, // Emergency changeover
8057 FCM = 0x03, // Transfer controlled and signalling route set congestion
8058 TFM = 0x04, // Transfer prohibited/allowed/restricted
8059 RSM = 0x05, // Signalling route/set/test
8060 MIM = 0x06, // Management inhibit
8061 TRM = 0x07, // Traffic restart allowed
8062 DLM = 0x08, // Signalling data/link/connection
8063 UFC = 0x0a, // User part flow control
8064 };
8065
8070 SS7MsgSNM(unsigned char type);
8071
8076 inline unsigned char type() const
8077 { return m_type; }
8078
8083 inline unsigned char group() const
8084 { return m_type & 0x0f; }
8085
8092 void toString(String& dest, const SS7Label& label, bool params) const;
8093
8103 static SS7MsgSNM* parse(SS7Management* receiver, unsigned char type,
8104 SS7PointCode::Type pcType,
8105 const unsigned char* buf, unsigned int len);
8106
8110 static const TokenDict* names();
8111
8118 static inline const char* lookup(Type type, const char* defvalue = 0)
8119 { return TelEngine::lookup(type,names(),defvalue); }
8120
8127 static inline Type lookup(const char* name, Type defvalue = Unknown)
8128 { return static_cast<Type>(TelEngine::lookup(name,names(),defvalue)); }
8129
8130private:
8131 unsigned char m_type;
8132};
8133
8138class YSIG_API SS7MsgMTN
8139{
8140public:
8144 enum Type {
8145 Unknown = 0,
8146 SLTM = 0x11, // Signalling Link Test Message
8147 SLTA = 0x21, // Signalling Link Test Acknowledgment
8148 };
8149
8150 static const TokenDict* names();
8151
8158 static inline const char* lookup(Type type, const char* defvalue = 0)
8159 { return TelEngine::lookup(type,names(),defvalue); }
8160
8167 static inline Type lookup(const char* name, Type defvalue = Unknown)
8168 { return static_cast<Type>(TelEngine::lookup(name,names(),defvalue)); }
8169};
8170
8175class YSIG_API SS7MsgISUP : public SignallingMessage
8176{
8178 friend class SS7ISUPCall;
8179public:
8183 enum Type {
8184 Unknown = 0,
8185 IAM = 0x01, // Initial Address Message
8186 SAM = 0x02, // Subsequent Address Message
8187 INR = 0x03, // Information Request (national use)
8188 INF = 0x04, // Information (national use)
8189 COT = 0x05, // Continuity
8190 ACM = 0x06, // Address Complete Message
8191 CON = 0x07, // Connect
8192 FOT = 0x08, // Forward Transfer
8193 ANM = 0x09, // Answer Message
8194 REL = 0x0c, // Release Request
8195 SUS = 0x0d, // Suspend
8196 RES = 0x0e, // Resume
8197 RLC = 0x10, // Release Complete
8198 CCR = 0x11, // Continuity Check Request
8199 RSC = 0x12, // Reset Circuit
8200 BLK = 0x13, // Blocking
8201 UBL = 0x14, // Unblocking
8202 BLA = 0x15, // Blocking Acknowledgement
8203 UBA = 0x16, // Unblocking Acknowledgement
8204 GRS = 0x17, // Circuit Group Reset
8205 CGB = 0x18, // Circuit Group Blocking
8206 CGU = 0x19, // Circuit Group Unblocking
8207 CGA = 0x1a, // Circuit Group Blocking Acknowledgement
8208 CGBA = CGA,
8209 CUA = 0x1b, // Circuit Group Unblocking Acknowledgement
8210 CMR = 0x1c, // Call Modification Request (ANSI only)
8211 CMC = 0x1d, // Call Modification Completed (ANSI only)
8212 CMRJ = 0x1e, // Call Modification Rejected (ANSI only)
8213 FACR = 0x1f, // Facility Request
8214 FAA = 0x20, // Facility Accepted
8215 FRJ = 0x21, // Facility Reject
8216 FAD = 0x22, // Facility Deactivated (ANSI only)
8217 FAI = 0x23, // Facility Information (ANSI only)
8218 LPA = 0x24, // Loopback Acknowledgement (national use)
8219 CSVR = 0x25, // CUG Selection and Validation Request (ANSI only)
8220 CSVS = 0x26, // CUG Selection and Validation Response (ANSI only)
8221 DRS = 0x27, // Delayed Release (ANSI only)
8222 PAM = 0x28, // Pass Along Message (national use)
8223 GRA = 0x29, // Circuit Group Reset Acknowledgement
8224 CQM = 0x2a, // Circuit Group Query (national use)
8225 CQR = 0x2b, // Circuit Group Query Response (national use)
8226 CPR = 0x2c, // Call Progress
8227 CPG = CPR,
8228 USR = 0x2d, // User-to-User Information
8229 UEC = 0x2e, // Unequipped CIC (national use)
8230 UCIC = UEC,
8231 CNF = 0x2f, // Confusion
8232 OLM = 0x30, // Overload Message (national use)
8233 CRG = 0x31, // Charge Information (national use and format, ITU only)
8234 NRM = 0x32, // Network Resource Management
8235 FAC = 0x33, // Facility (national use)
8236 UPT = 0x34, // User Part Test
8237 UPA = 0x35, // User Part Available
8238 IDR = 0x36, // Identification Request (ITU only)
8239 IRS = 0x37, // Identification Response (ITU only)
8240 SGM = 0x38, // Segmentation
8241 LOP = 0x40, // Loop Prevention
8242 APM = 0x41, // Application Transport
8243 PRI = 0x42, // Pre-Release Information
8244 SDN = 0x43, // Subsequent Directory Number (national use)
8245 CRA = 0xe9, // Circuit Reservation Acknowledgement (ANSI only)
8246 CRM = 0xea, // Circuit Reservation (ANSI only)
8247 CVR = 0xeb, // Circuit Validation Response (ANSI only)
8248 CVT = 0xec, // Circuit Validation Test (ANSI only)
8249 EXM = 0xed, // Exit Message (ANSI only)
8250 // Dummy, used for various purposes
8251 CtrlSave = 256, // control, save circuits
8252 CtrlCicEvent, // control, generate circuit events, debug only
8253 };
8254
8259 EndOfParameters = 0,
8260 CallReference = 0x01,
8261 TransmissionMediumRequirement = 0x02,
8262 AccessTransport = 0x03,
8263 CalledPartyNumber = 0x04,
8264 SubsequentNumber = 0x05,
8265 NatureOfConnectionIndicators = 0x06,
8266 ForwardCallIndicators = 0x07,
8267 OptionalForwardCallIndicators = 0x08,
8268 CallingPartyCategory = 0x09,
8269 CallingPartyNumber = 0x0a,
8270 RedirectingNumber = 0x0b,
8271 RedirectionNumber = 0x0c,
8272 ConnectionRequest = 0x0d,
8273 InformationRequestIndicators = 0x0e,
8274 InformationIndicators = 0x0f,
8275 ContinuityIndicators = 0x10,
8276 BackwardCallIndicators = 0x11,
8277 CauseIndicators = 0x12,
8278 RedirectionInformation = 0x13,
8279 GroupSupervisionTypeIndicator = 0x15,
8280 RangeAndStatus = 0x16,
8281 CallModificationIndicators = 0x17, // ANSI only
8282 FacilityIndicator = 0x18,
8283 FacilityInformationIndicators = 0x19, // ANSI only
8284 CUG_InterlockCode = 0x1a,
8285 Index = 0x1b, // ANSI only
8286 CUG_CheckResponseIndicators = 0x1c, // ANSI only
8287 UserServiceInformation = 0x1d,
8288 SignallingPointCode = 0x1e,
8289 UserToUserInformation = 0x20,
8290 ConnectedNumber = 0x21,
8291 SuspendResumeIndicators = 0x22,
8292 TransitNetworkSelection = 0x23,
8293 EventInformation = 0x24,
8294 CircuitAssignmentMap = 0x25, // ANSI only
8295 CircuitStateIndicator = 0x26,
8296 AutomaticCongestionLevel = 0x27,
8297 OriginalCalledNumber = 0x28,
8298 OptionalBackwardCallIndicators = 0x29,
8299 UserToUserIndicators = 0x2a,
8300 OriginationISCPointCode = 0x2b, // ITU only
8301 GenericNotification = 0x2c, // ITU only
8302 CallHistoryInformation = 0x2d, // ITU only
8303 AccessDeliveryInformation = 0x2e, // ITU only
8304 NetworkSpecificFacilities = 0x2f, // ITU only
8305 UserServiceInformationPrime = 0x30,
8306 PropagationDelayCounter = 0x31, // ITU only
8307 RemoteOperations = 0x32,
8308 ServiceActivation = 0x33,
8309 UserTeleserviceInformation = 0x34, // ITU only
8310 TransmissionMediumUsed = 0x35,
8311 CallDiversionInformation = 0x36, // ITU only
8312 EchoControlInformation = 0x37, // ITU only
8313 MessageCompatInformation = 0x38, // ITU only
8314 ParameterCompatInformation = 0x39, // ITU only
8315 MLPP_Precedence = 0x3a, // ITU name
8316 Precedence = MLPP_Precedence, // ANSI name
8317 MCID_RequestIndicator = 0x3b, // ITU only
8318 MCID_ResponseIndicator = 0x3c, // ITU only
8319 HopCounter = 0x3d,
8320 TransMediumRequirementPrime = 0x3e, // ITU only
8321 LocationNumber = 0x3f, // ITU only
8322 RedirectionNumberRestriction = 0x40, // ITU only
8323 FreephoneIndicators = 0x41, // ITU only
8324 GenericReference = 0x42, // ITU only
8325 CCSScallIndication = 0x4b,
8326 ForwardGVNS = 0x4c,
8327 BackwardGVNS = 0x4d,
8328 RedirectCapability = 0x4e, // National use
8329 CalledINNumber = 0x6f,
8330 UID_ActionIndicators = 0x74,
8331 UID_CapabilityIndicators = 0x75,
8332 RedirectCounter = 0x77, // National use
8333 ApplicationTransport = 0x78,
8334 CCNRpossibleIndicator = 0x7a,
8335 PivotRoutingIndicators = 0x7c,
8336 CalledDirectoryNumber = 0x7d, // National use
8337 OriginalCalledINNumber = 0x7f,
8338 CallingGeodeticLocation = 0x81,
8339 HTR_Information = 0x82,
8340 NetworkRoutingNumber = 0x84, // National use
8341 QueryOnReleaseCapability = 0x85, // Network option
8342 PivotStatus = 0x86, // National use
8343 PivotCounter = 0x87,
8344 PivotRoutingForwardInformation = 0x88,
8345 PivotRoutingBackInformation = 0x89,
8346 RedirectStatus = 0x8a, // National use
8347 RedirectForwardInformation = 0x8b, // National use
8348 RedirectBackwardInformation = 0x8c, // National use
8349 NumberPortabilityInformation = 0x8d, // Network option
8350 GenericNumber = 0xc0, // ITU name
8351 GenericAddress = GenericNumber, // ANSI name
8352 GenericDigits = 0xc1,
8353 OperatorServicesInformation = 0xc2, // ANSI only
8354 Egress = 0xc3, // ANSI only
8355 Jurisdiction = 0xc4, // ANSI only
8356 CarrierIdentification = 0xc5, // ANSI only
8357 BusinessGroup = 0xc6, // ANSI only
8358 GenericName = 0xc7, // ANSI only
8359 NotificationIndicator = 0xe1, // ANSI only
8360 TransactionRequest = 0xe3, // ANSI only
8361 CircuitGroupCharactIndicator = 0xe5, // ANSI only
8362 CircuitValidationRespIndicator = 0xe6, // ANSI only
8363 OutgoingTrunkGroupNumber = 0xe7, // ANSI only
8364 CircuitIdentificationName = 0xe8, // ANSI only
8365 CommonLanguage = 0xe9, // ANSI only
8366 OriginatingLineInformation = 0xea, // ANSI only
8367 ChargeNumber = 0xeb, // ANSI only
8368 ServiceCodeIndicator = 0xec, // ANSI only
8369 SpecialProcessingRequest = 0xed, // ANSI only
8370 CarrierSelectionInformation = 0xee, // ANSI only
8371 NetworkTransport = 0xef, // ANSI only
8372 NationalForwardCallIndicatorsLinkByLink = 0xf4, // UK-ISUP
8373 NationalInformationIndicators = 0xf5, // UK-ISUP
8374 NationalInformationRequestIndicators = 0xf6, // UK-ISUP
8375 CalledSubscribersTerminatingFacilMarks = 0xf7, // UK-ISUP
8376 CallingSubscribersOriginatingFacilMarks = 0xf8, // UK-ISUP
8377 CallingSubscribersBasicServiceMarks = 0xf9, // UK-ISUP
8378 CalledSubscribersBasicServiceMarks = 0xfa, // UK-ISUP
8379 PartialCLI = 0xfb, // UK-ISUP
8380 LastDivertingLineIdentity = 0xfc, // UK-ISUP
8381 PresentationNumber = 0xfd, // UK-ISUP
8382 NationalForwardCallIndicators = 0xfe, // UK-ISUP
8383 };
8384
8390 inline SS7MsgISUP(Type type, unsigned int cic)
8391 : SignallingMessage(lookup(type,"Unknown")), m_type(type), m_cic(cic)
8392 { }
8393
8397 virtual ~SS7MsgISUP()
8398 { }
8399
8404 inline Type type() const
8405 { return m_type; }
8406
8411 inline unsigned int cic() const
8412 { return m_cic; }
8413
8422 void toString(String& dest, const SS7Label& label, bool params,
8423 const void* raw = 0, unsigned int rawLen = 0) const;
8424
8429 static const TokenDict* names();
8430
8437 static inline const char* lookup(Type type, const char* defvalue = 0)
8438 { return TelEngine::lookup(type,names(),defvalue); }
8439
8446 static inline Type lookup(const char* name, Type defvalue = Unknown)
8447 { return static_cast<Type>(TelEngine::lookup(name,names(),defvalue)); }
8448
8449private:
8450 Type m_type; // Message type
8451 unsigned int m_cic; // Source/destination Circuit Identification Code
8452};
8453
8458class YSIG_API SS7Management : public SS7Layer4, public Mutex
8459{
8460 YCLASS(SS7Management,SS7Layer4)
8461public:
8465 SS7Management(const NamedList& params, unsigned char sio = SS7MSU::SNM|SS7MSU::National);
8466
8467protected:
8476 virtual HandledMSU receivedMSU(const SS7MSU& msu, const SS7Label& label, SS7Layer3* network, int sls);
8477
8485 bool inhibit(const SS7Label& link, int setFlags, int clrFlags = 0);
8486
8493 bool inhibited(const SS7Label& link, int flags);
8494
8500 void recover(const SS7Label& link, int sequence);
8501
8508 virtual void notify(SS7Layer3* link, int sls);
8509
8515 virtual bool control(NamedList& params);
8516
8521 virtual void timerTick(const Time& when);
8522
8523private:
8524 bool postpone(SS7MSU* msu, const SS7Label& label, int txSls,
8525 u_int64_t interval, u_int64_t global = 0, bool force = false, const Time& when = Time());
8526 bool timeout(const SS7MSU& msu, const SS7Label& label, int txSls, bool final);
8527 bool timeout(SignallingMessageTimer& timer, bool final);
8529 bool m_changeMsgs;
8530 bool m_changeSets;
8531 bool m_neighbours;
8532};
8533
8538class YSIG_API SS7Testing : public SS7Layer4, public Mutex
8539{
8540 YCLASS(SS7Testing,SS7Layer4)
8541public:
8545 inline SS7Testing(const NamedList& params, unsigned char sio = SS7MSU::MTP_T|SS7MSU::National)
8546 : SignallingComponent(params.safe("SS7Testing"),&params,"ss7-test"),
8547 SS7Layer4(sio,&params),
8548 Mutex(true,"SS7Testing"),
8549 m_timer(0), m_exp(0), m_seq(0), m_len(16), m_sharing(false)
8550 { }
8551
8557 virtual bool initialize(const NamedList* config);
8558
8564 virtual bool control(NamedList& params);
8565
8566protected:
8575 virtual HandledMSU receivedMSU(const SS7MSU& msu, const SS7Label& label, SS7Layer3* network, int sls);
8576
8583 virtual void notify(SS7Layer3* link, int sls);
8584
8589 virtual void timerTick(const Time& when);
8590
8591private:
8592 bool sendTraffic();
8593 void setParams(const NamedList& params, bool setSeq = false);
8594 SignallingTimer m_timer;
8595 SS7Label m_lbl;
8596 u_int32_t m_exp;
8597 u_int32_t m_seq;
8598 u_int16_t m_len;
8599 bool m_sharing;
8600};
8601
8606class YSIG_API SS7ISUPCall : public SignallingCall
8607{
8608 friend class SS7ISUP;
8609public:
8613 enum State {
8614 // NOTE: Keep the order of state values: the code relies on it
8615 Null = 0, // No message exchanged
8616 Testing = 1, // IAM but waiting for continuity check
8617 Setup = 2, // IAM (initial address)
8618 Accepted = 3, // ACM (address complete)
8619 Ringing = 4, // CPM (call progress)
8620 Answered = 5, // ANM (answer)
8621 Releasing = 6, // REL (release)
8622 Released = 7 // Call released, no message or events allowed
8623 };
8624
8629 virtual ~SS7ISUPCall();
8630
8635 inline State state() const
8636 { return m_state; }
8637
8642 inline bool earlyState() const
8643 { return m_state <= Setup && !m_testCall; }
8644
8649 inline const String& cicRange() const
8650 { return m_cicRange; }
8651
8656 inline unsigned int id() const
8657 { return m_circuit ? m_circuit->code() : 0; }
8658
8665 virtual SignallingEvent* getEvent(const Time& when);
8666
8672 virtual bool sendEvent(SignallingEvent* event);
8673
8681 inline void setTerminate(bool gracefully, const char* reason = 0,
8682 const char* diagnostic = 0, const char* location = 0)
8683 {
8684 Lock lock(this);
8685 m_terminate = true;
8686 m_gracefully = gracefully;
8687 setReason(reason,0,diagnostic,location);
8688 }
8689
8695 virtual void* getObject(const String& name) const;
8696
8697protected:
8710 const SS7PointCode& local, const SS7PointCode& remote, bool outgoing,
8711 int sls = -1, const char* range = 0, bool testCall = false);
8712
8723 SignallingEvent* releaseComplete(bool final, SS7MsgISUP* msg = 0, const char* reason = 0,
8724 bool timeout = false);
8725
8731
8743
8749 void stopWaitSegment(bool discard);
8750
8751private:
8752 // Initialize/set IAM message parameters
8753 // @param msg Valid ISUP message
8754 // @param outgoing Message direction: true for outgoing
8755 // @param sigMsg Valid signalling message with parameters if outgoing
8756 bool copyParamIAM(SS7MsgISUP* msg, bool outgoing = false, SignallingMessage* sigMsg = 0);
8757 // If already releasing, set termination flag. Otherwise, send REL (Release) message
8758 // Set m_lastEvent if event is 0 (the method is called internally)
8759 // @param event Event with the parameters. 0 if release is started on some timeout
8760 // @param msg Received message to put in release event
8761 // @return Generated release event if any
8762 SignallingEvent* release(SignallingEvent* event = 0, SS7MsgISUP* msg = 0);
8763 // Set termination reason from message or parameter
8764 void setReason(const char* reason, SignallingMessage* msg, const char* diagnostic = 0,
8765 const char* location = 0);
8766 // Accept send/receive messages in current state based on call direction
8767 bool validMsgState(bool send, SS7MsgISUP::Type type, bool hasBkwCallInd = false);
8768 // Connect the reserved circuit. Return false if it fails. Return true if this call is a signalling only one
8769 bool connectCircuit(const char* special = 0);
8770 // Transmit the IAM message. Start IAM timer if not started
8771 bool transmitIAM();
8772 // Transmit SAM digits
8773 bool transmitSAM(const char* extra = 0);
8774 // (Re)transmit REL. Create and populate message if needed. Remember sls
8775 bool transmitREL(const NamedList* params = 0);
8776 // Check if the circuit needs continuity testing
8777 bool needsTesting(const SS7MsgISUP* msg);
8778 // Stop waiting for a SGM (Segmentation) message. Copy parameters to the pending segmented message if sgm is valid.
8779 // Change call state and set m_lastEvent
8780 // @param sgm Optional received SGM message with parameters to be added to the pending segmented message
8781 // @param timeout True if waiting timer timed out. Ignored if sgm is non null
8782 // @return m_lastEvent
8783 SignallingEvent* processSegmented(SS7MsgISUP* sgm = 0, bool timeout = false);
8784 // Transmit message. Set routing label's link if not already set
8785 inline bool transmitMessage(SS7MsgISUP* msg);
8786 // Get the ISUP call controller
8787 inline SS7ISUP* isup() const;
8788 // Set overlapped flag. Output a debug message
8789 void setOverlapped(bool on, bool numberComplete = true);
8790
8791 State m_state; // Call state
8792 bool m_testCall; // Test only call
8793 SignallingCircuit* m_circuit; // Circuit reserved for this call
8794 String m_cicRange; // The range used to re(alloc) a circuit
8795 SS7Label m_label; // The routing label for this call
8796 bool m_terminate; // Termination flag
8797 bool m_gracefully; // Terminate gracefully: send RLC
8798 bool m_circuitChanged; // Circuit change flag
8799 bool m_circuitTesting; // The circuit is tested for continuity
8800 bool m_inbandAvailable; // Inband data is available
8801 int m_replaceCounter; // Circuit replace counter
8802 String m_format; // Data format used by the circuit
8803 String m_reason; // Termination reason
8804 String m_diagnostic; // Termination diagnostic
8805 String m_location; // Termination location
8806 SS7MsgISUP* m_iamMsg; // Message with the call parameters for outgoing calls
8807 SS7MsgISUP* m_sgmMsg; // Pending received message with segmentation flag set
8808 SS7MsgISUP* m_relMsg; // Release message preserved for retransmissions
8809 // Overlapped
8810 String m_samDigits; // SAM digits
8811 unsigned int m_sentSamDigits; // The number of sent SAM digits
8812 // Timers
8813 SignallingTimer m_relTimer; // Send release
8814 SignallingTimer m_iamTimer; // Send initial address
8815 SignallingTimer m_sgmRecvTimer; // Receive segmented message
8816 SignallingTimer m_contTimer; // Continuity timer
8817 SignallingTimer m_anmTimer; // T9 ACM -> ANM timer
8818};
8819
8824class YSIG_API SS7ISUP : public SignallingCallControl, public SS7Layer4
8825{
8826 YCLASS(SS7ISUP,SS7Layer4)
8827 friend class SS7ISUPCall;
8828public:
8832 enum {
8833 SlsAuto = -1,
8834 SlsLatest = -2,
8835 SlsCircuit = -3,
8836 SlsDefault = -4
8837 };
8838
8839 enum ChargeProcess {
8840 Confusion,
8841 Ignore,
8842 Raw,
8843 Parsed
8844 };
8845
8851 SS7ISUP(const NamedList& params, unsigned char sio = SS7MSU::ISUP|SS7MSU::National);
8852
8856 virtual ~SS7ISUP();
8857
8863 virtual bool initialize(const NamedList* config);
8864
8869 virtual const char* statusName() const;
8870
8875 virtual void attach(SS7Layer3* network);
8876
8881 unsigned int cicLen() const
8882 { return m_cicLen; }
8883
8888 const String& format() const
8889 { return m_format; }
8890
8895 inline bool ignoreUnknownAddrSignals() const
8896 { return m_ignoreUnkDigits; }
8897
8906 bool setPointCode(SS7PointCode* pc, bool def);
8907
8914 unsigned int setPointCode(const NamedList& params);
8915
8922
8928 inline bool handlesRemotePC(const SS7PointCode& pc) const
8929 { return !m_remotePoint || (pc == *m_remotePoint); }
8930
8938 inline void setLabel(SS7Label& label, const SS7PointCode& opc, const SS7PointCode& dpc,
8939 unsigned char sls = 255)
8940 { label.assign(m_type,dpc,opc,sls); }
8941
8947 inline void setDebug(bool printMsg, bool extendedDebug)
8948 { m_extendedDebug = ((m_printMsg = printMsg) && extendedDebug); }
8949
8959 virtual SS7MSU* createMSU(SS7MsgISUP::Type type, unsigned char ssf,
8960 const SS7Label& label, unsigned int cic, const NamedList* params = 0) const;
8961
8969 virtual SignallingCall* call(SignallingMessage* msg, String& reason);
8970
8981 int transmitMessage(SS7MsgISUP* msg, const SS7Label& label, bool recvLbl, int sls = SlsDefault);
8982
8988 virtual void cleanup(const char* reason = "net-out-of-order");
8989
8995 virtual bool control(NamedList& params);
8996
9007 const unsigned char* paramPtr, unsigned int paramLen);
9008
9020 const NamedList& params, unsigned int* cic = 0);
9021
9031 bool processParamCompat(const NamedList& list, unsigned int cic, bool* callReleased = 0);
9032
9037 inline ChargeProcess getChargeProcessType() const
9038 { return m_chargeProcessType; }
9039
9040protected:
9044 virtual void destroyed();
9045
9050 virtual void timerTick(const Time& when);
9051
9057 virtual void notify(SS7Layer3* link, int sls);
9058
9068 SS7MSU* buildMSU(SS7MsgISUP::Type type, unsigned char sio,
9069 const SS7Label& label, unsigned int cic, const NamedList* params) const;
9070
9079 virtual HandledMSU receivedMSU(const SS7MSU& msu, const SS7Label& label, SS7Layer3* network, int sls);
9080
9092 virtual bool processMSU(SS7MsgISUP::Type type, unsigned int cic,
9093 const unsigned char* paramPtr, unsigned int paramLen,
9094 const SS7Label& label, SS7Layer3* network, int sls);
9095
9105 virtual void receivedUPU(SS7PointCode::Type type, const SS7PointCode node,
9106 SS7MSU::Services part, unsigned char cause, const SS7Label& label, int sls);
9107
9115 SignallingCall* call = 0);
9116
9125 bool startCircuitReset(SignallingCircuit*& cic, const String& timer);
9126
9130 unsigned int m_cicLen;
9131
9132private:
9133 // Process a received message that should be processed by a call
9134 // @param msg The received message
9135 // @param label The routing label of the received message
9136 // @param sls Signalling Link the message was received from
9137 void processCallMsg(SS7MsgISUP* msg, const SS7Label& label, int sls);
9138 // Process a received message that should be processed by this call controller
9139 // @param msg The received message
9140 // @param label The routing label of the received message
9141 // @param sls Signalling Link the message was received from
9142 void processControllerMsg(SS7MsgISUP* msg, const SS7Label& label, int sls);
9143 // Replace a call's circuit if checkCall is true
9144 // Clear lock flags of the circuit. Release currently reseting circuit if the code match
9145 // Return false if the given circuit doesn't exist
9146 bool resetCircuit(unsigned int cic, bool remote, bool checkCall);
9147 // Block/unblock a circuit side (local or remote)
9148 // Return false if the given circuit doesn't exist
9149 bool blockCircuit(unsigned int cic, bool block, bool remote, bool hwFail,
9150 bool changed, bool changedState, bool resetLocking = false);
9151 // Find a call by its circuit identification code
9152 // This method is not thread safe
9153 SS7ISUPCall* findCall(unsigned int cic);
9154 // Find a call by its circuit identification code
9155 // This method is thread safe
9156 inline void findCall(unsigned int cic, RefPointer<SS7ISUPCall>& call) {
9157 Lock mylock(this);
9158 call = findCall(cic);
9159 }
9160 // Encode a raw message
9161 SS7MSU* encodeRawMessage(SS7MsgISUP::Type type, unsigned char sio,
9162 const SS7Label& label, unsigned int cic, const String& param) const;
9163 // Send blocking/unblocking messages.
9164 // Restart the re-check timer if there is any (un)lockable, not sent cic
9165 // Return false if no request was sent
9166 bool sendLocalLock(const Time& when = Time());
9167 // Fill label from local/remote point codes
9168 // This method is thread safe
9169 // Return a true if local and remote point codes are valid
9170 bool setLabel(SS7Label& label, unsigned int cic);
9171 // Retrieve a pending message
9172 SignallingMessageTimer* findPendingMessage(SS7MsgISUP::Type type, unsigned int cic,
9173 bool remove = false);
9174 // Retrieve a pending message with given parameter
9175 SignallingMessageTimer* findPendingMessage(SS7MsgISUP::Type type, unsigned int cic,
9176 const String& param, const String& value, bool remove = false);
9177 // Transmit a list of messages. Return true if at least 1 message was sent
9178 bool transmitMessages(ObjList& list);
9179 // Handle circuit(s) (un)block command
9180 bool handleCicBlockCommand(const NamedList& p, bool block);
9181 // Handle remote circuit(s) (un)block command
9182 bool handleCicBlockRemoteCommand(const NamedList& p, unsigned int* cics,
9183 unsigned int count, bool block);
9184 // Handle circuit(s) event generation command
9185 bool handleCicEventCommand(const NamedList& p);
9186 // Try to start single circuit (un)blocking. Set a pending operation on success
9187 // @param force True to ignore resetting/(un)blocking flags of the circuit
9188 // Return built message to be sent on success
9189 SS7MsgISUP* buildCicBlock(SignallingCircuit* cic, bool block, bool force = false);
9190 // Replace circuit for outgoing calls in Setup state
9191 // Send REL/RSC before repeat attempt
9192 void replaceCircuit(unsigned int cic, const String& map, bool rel = true);
9193 // Handle circuit hw-fail block
9194 // Replace cics for outgoing calls. Terminate incoming
9195 void cicHwBlocked(unsigned int cic, const String& map);
9196
9197 SS7PointCode::Type m_type; // Point code type of this call controller
9198 ObjList m_pointCodes; // Point codes serviced by this call controller
9199 SS7PointCode* m_defPoint; // Default point code for outgoing calls
9200 SS7PointCode* m_remotePoint; // Default remote point code for outgoing calls and maintenance
9201 unsigned char m_sls; // Last known valid SLS
9202 bool m_earlyAcm; // Accept progress/ringing in early ACM
9203 bool m_inn; // Routing to internal network number flag
9204 int m_defaultSls; // Default SLS to use in outbound calls
9205 unsigned int m_maxCalledDigits; // Maximum digits allowed in Called Number in IAM
9206 String m_numPlan; // Numbering plan
9207 String m_numType; // Number type
9208 String m_numPresentation; // Number presentation
9209 String m_numScreening; // Number screening
9210 String m_callerCat; // Caller party category
9211 String m_format; // Default format
9212 String m_continuity; // Continuity test type
9213 bool m_confirmCCR; // Send LPA in response to CCR
9214 bool m_dropOnUnknown; // Drop call in early state on unknown message
9215 bool m_ignoreGRSSingle; // Ignore (drop) GRS with range 0 (1 circuit affected)
9216 bool m_ignoreCGBSingle; // Ignore (drop) CGB with range 0 (1 circuit in map)
9217 bool m_ignoreCGUSingle; // Ignore (drop) CGU with range 0 (1 circuit in map)
9218 bool m_duplicateCGB; // Send duplicate CGB messages (ANSI)
9219 bool m_ignoreUnkDigits; // Check if the message parser should ignore unknown digits encoding
9220 bool m_l3LinkUp; // Flag indicating the availability of a Layer3 data link
9221 ChargeProcess m_chargeProcessType; // Indicates the way that charge message should be processed
9222 u_int64_t m_t1Interval; // Q.764 T1 timer interval
9223 u_int64_t m_t5Interval; // Q.764 T5 timer interval
9224 u_int64_t m_t7Interval; // Q.764 T7 timer interval
9225 u_int64_t m_t9Interval; // Q.764 T9 AMM/CON recv timer interval
9226 u_int64_t m_t12Interval; // Q.764 T12 BLK timer interval
9227 u_int64_t m_t13Interval; // Q.764 T13 BLK global timer interval
9228 u_int64_t m_t14Interval; // Q.764 T14 UBL timer interval
9229 u_int64_t m_t15Interval; // Q.764 T15 UBL global timer interval
9230 u_int64_t m_t16Interval; // Q.764 T16 RSC timer interval
9231 u_int64_t m_t17Interval; // Q.764 T17 timer interval
9232 u_int64_t m_t18Interval; // Q.764 T18 CGB timer interval
9233 u_int64_t m_t19Interval; // Q.764 T19 CGB global timer interval
9234 u_int64_t m_t20Interval; // Q.764 T20 CGU timer interval
9235 u_int64_t m_t21Interval; // Q.764 T21 CGU global timer interval
9236 u_int64_t m_t27Interval; // Q.764 T27 Reset after Cont. Check failure
9237 u_int64_t m_t34Interval; // Q.764 T34 Segmentation receive timout
9238 SignallingMessageTimerList m_pending;// Pending messages (RSC ...)
9239 // Remote User Part test
9240 SignallingTimer m_uptTimer; // Timer for UPT
9241 bool m_userPartAvail; // Flag indicating the remote User Part availability
9242 SS7MsgISUP::Type m_uptMessage; // Message used, may not be always UPT
9243 unsigned int m_uptCicCode; // The circuit code sent with UPT
9244 int m_cicWarnLevel; // Wrong CIC warn level
9245 int m_replaceCounter; // Circuit replace counter
9246 // Circuit reset
9247 SignallingTimer m_rscTimer; // RSC message or idle timeout
9248 SignallingCircuit* m_rscCic; // Circuit currently beeing reset
9249 u_int32_t m_rscInterval; // Saved reset interval
9250 u_int32_t m_rscSpeedup; // Circuits left for speedup
9251 // Blocking/unblocking circuits
9252 SignallingTimer m_lockTimer; // Timer used to re-check local lock
9253 bool m_lockGroup; // Allow sending requests for a group
9254 // Debug flags
9255 bool m_printMsg; // Print messages to output
9256 bool m_extendedDebug; // Extended debug flag
9257};
9258
9263class YSIG_API SS7BICC : public SS7ISUP
9264{
9265 YCLASS(SS7BICC,SS7ISUP)
9266public:
9272 SS7BICC(const NamedList& params, unsigned char sio = SS7MSU::BICC|SS7MSU::National);
9273
9278 virtual ~SS7BICC();
9279
9280protected:
9289 virtual HandledMSU receivedMSU(const SS7MSU& msu, const SS7Label& label, SS7Layer3* network, int sls);
9290};
9291
9296class YSIG_API SS7TUP : public SignallingCallControl, public SS7Layer4
9297{
9298public:
9304 SS7TUP(const NamedList& params, unsigned char sif = SS7MSU::TUP);
9305
9310 virtual ~SS7TUP();
9311};
9312
9317
9318class YSIG_API SCCPManagement : public SignallingComponent , public Mutex
9319{
9320 friend class SS7SCCP;
9321 friend class SccpLocalSubsystem; // Local Broadcast
9323public:
9324 enum MsgType {
9325 SSA = 0x01, // Subsystem-allowed
9326 SSP = 0x02, // Subsystem-prohibited
9327 SST = 0x03, // Subsystem-status-test
9328 SOR = 0x04, // Subsystem-out-of-service-request
9329 SOG = 0x05, // Subsystem-out-of-service-grant
9330 SSC = 0x06, // SCCP/Subsystem-congested (ITU only)
9331 SBR = 0xfd, // Subsystem-backup-routing (ANSI only)
9332 SNR = 0xfe, // Subsystem-normal-routing (ANSI only)
9333 SRT = 0xff // Subsystem-routing-status-test (ANSI only)
9334 };
9335
9336 enum LocalBroadcast {
9337 UserOutOfService,
9338 UserInService,
9339 PCInaccessible, // Signalling Point Inaccessible
9340 PCAccessible, // Signalling Point Accessible
9341 SccpRemoteInaccessible,
9342 SccpRemoteAccessible,
9343 PCCongested, // Signalling Point Congested
9344 SubsystemStatus // Request send by sccp management to find if a ssn is available
9345 };
9346
9347 enum SccpStates {
9348 Allowed = SS7Route::Allowed,
9349 Prohibited = SS7Route::Prohibited,
9350 Unknown = SS7Route::Unknown,
9351 WaitForGrant,
9352 IgnoreTests
9353 };
9354
9359
9364
9368 virtual bool initialize(const NamedList* config);
9369
9375 virtual bool processMessage(SS7MsgSCCP* message);
9376
9381 void attach(SS7SCCP* sccp);
9382
9388 virtual void pointcodeStatus(SS7Layer3* link, bool operational);
9389
9396 virtual void routeStatus(SS7PointCode::Type type, const SS7PointCode& node, SS7Route::State state);
9397
9403 virtual void notify(SCCP::Type type, NamedList& params);
9404
9409 virtual void routeFailure(SS7MsgSCCP* msg);
9410
9416 virtual void subsystemFailure(SS7MsgSCCP* msg, const SS7Label& label);
9417
9423 virtual void sccpUnavailable(const SS7PointCode& pointcode, unsigned char cause);
9424
9430 void subsystemsStatus(String& dest,bool extended = true);
9431
9437 void routeStatus(String& dest,bool extended = false);
9438
9445 virtual void notifyConcerned(MsgType msg, unsigned char ssn, int smi);
9446
9451 static const TokenDict* broadcastType();
9452
9458 virtual void updateTables(SccpRemote* rsccp, SccpSubsystem* ssn = 0);
9459
9466 virtual void printMessage(String& dest, MsgType type, const NamedList& params);
9467
9473 static const char* stateName(SCCPManagement::SccpStates state)
9474 { return lookup(state,s_states); }
9475protected:
9476
9482 virtual void timerTick(const Time& when);
9483
9484 inline SS7SCCP* sccp()
9485 { return m_sccp; }
9486
9487 ObjList m_remoteSccp;
9488 ObjList m_statusTest;
9489 ObjList m_localSubsystems;
9490 ObjList m_concerned;
9491 SS7PointCode::Type m_pcType;
9492
9497 inline u_int32_t getTestTimeout()
9498 { return m_testTimeout; }
9499
9506 bool managementMessage(SCCP::Type type, NamedList& params);
9507
9513 SccpLocalSubsystem* getLocalSubsystem(unsigned char ssn);
9514
9520 SccpRemote* getRemoteSccp(int pointcode);
9521
9528 virtual bool sendMessage(SCCPManagement::MsgType msgType, const NamedList& params) = 0;
9529
9536 virtual void stopSst(SccpRemote* remoteSccp, SccpSubsystem* rSubsystem = 0, SccpSubsystem* less = 0);
9537
9541 inline void stopSSTs()
9542 { Lock lock(this); m_statusTest.clear(); }
9543
9549 virtual void startSst(SccpRemote* remoteSccp, SccpSubsystem* rSubsystem);
9550
9555
9566 void localBroadcast(SCCP::Type type, int pointcode, int sps, int rss = -1,
9567 int rl = -1, int ssn = -1, int ss = -1);
9568
9575 bool sendSST(SccpRemote* remote, SccpSubsystem* sub);
9576
9585 bool handleMessage(int msgType, unsigned char ssn, unsigned char smi, NamedList& params);
9586
9593 { }
9594
9599 inline bool printMessagess()
9600 { return m_printMessages; }
9601
9608 void handleCoordinateChanged(unsigned char ssn, int smi, const NamedList& params);
9609
9616 void handleSog(unsigned char ssn, int pointcode);
9617
9625 virtual void handleSubsystemStatus(SccpSubsystem* subsystem, bool allowed, SccpRemote* remote, int smi)
9626 { }
9627
9632 inline u_int32_t getCoordTimeout()
9633 { return m_coordTimeout; }
9634
9639 inline u_int32_t getIgnoreTestsInterval()
9640 { return m_ignoreStatusTestsInterval; }
9641private:
9642 // Helper method to fill broadcast param list
9643 void putValue(NamedList& params,int val,const char* name, bool dict = false);
9644
9645 SS7SCCP* m_sccp;
9646 NamedList m_unknownSubsystems;
9647 unsigned int m_subsystemFailure; // Counter used in status to inform about the total number of packets received for a unknown ssn
9648 unsigned int m_routeFailure;
9649 u_int32_t m_testTimeout;
9650 u_int32_t m_coordTimeout;
9651 u_int32_t m_ignoreStatusTestsInterval;
9652 bool m_autoAppend;
9653 bool m_printMessages;
9654 static const TokenDict s_broadcastType[];
9655 static const TokenDict s_states[];
9656};
9657
9658class YSIG_API SS7MsgSCCP : public SignallingMessage
9659{
9661public:
9665 enum Type {
9666 Unknown = 0,
9667 CR = 0x01, // Connection request
9668 CC = 0x02, // Connection confirm
9669 CREF = 0x03, // Connection refused
9670 RLSD = 0x04, // Released
9671 RLC = 0x05, // Release complete
9672 DT1 = 0x06, // Data form 1
9673 DT2 = 0x07, // Data form 2
9674 AK = 0x08, // Data acknowledgement
9675 UDT = 0x09, // Unitdata
9676 UDTS = 0x0a, // Unitdata service
9677 ED = 0x0b, // Expedited data
9678 EA = 0x0c, // Expedited data acknowledgement
9679 RSR = 0x0d, // Reset request
9680 RSC = 0x0e, // Reset confirmation
9681 ERR = 0x0f, // Protocol data unit error
9682 IT = 0x10, // Inactivity test
9683 XUDT = 0x11, // Extended unitdata
9684 XUDTS = 0x12, // Extended unitdata service
9685 LUDT = 0x13, // Long unitdata
9686 LUDTS = 0x14, // Long unitdata service
9687 };
9688
9689 enum Parameters {
9690 EndOfParameters = 0,
9691 DestinationLocalReference = 0x01,
9692 SourceLocalReference = 0x02,
9693 CalledPartyAddress = 0x03,
9694 CallingPartyAddress = 0x04,
9695 ProtocolClass = 0x05,
9696 Segmenting = 0x06,
9697 ReceiveSequenceNumber = 0x07,
9698 Sequencing = 0x08,
9699 Credit = 0x09,
9700 ReleaseCause = 0x0a,
9701 ReturnCause = 0x0b,
9702 ResetCause = 0x0c,
9703 ErrorCause = 0x0d,
9704 RefusalCause = 0x0e,
9705 Data = 0x0f,
9706 Segmentation = 0x10,
9707 HopCounter = 0x11,
9708 Importance = 0x12, // ITU only
9709 LongData = 0x13,
9710 MessageTypeInterworking = 0xf8, // ANSI only
9711 INS = 0xf9, // ANSI only
9712 ISNI = 0xfa, // ANSI only
9713 };
9714
9720 : SignallingMessage(lookup(type,"Unknown")), m_type(type), m_data(0)
9721 { }
9722
9730 virtual ~SS7MsgSCCP();
9731
9736 inline Type type() const
9737 { return m_type; }
9738
9743 inline void updateType(Type type)
9744 { m_type = type; params().assign(lookup(type,"Unknown")); }
9745
9750 inline bool isLongDataMessage() const
9751 { return m_type == LUDT || m_type == LUDTS; }
9752
9759 inline bool canBeUDT() const
9760 { return !(params().getParam(YSTRING("Importance")) ||
9761 params().getParam(YSTRING("HopCounter"))); }
9762
9771 void toString(String& dest, const SS7Label& label, bool params,
9772 const void* raw = 0, unsigned int rawLen = 0) const;
9773
9778 static const TokenDict* names();
9779
9786 static inline const char* lookup(Type type, const char* defvalue = 0)
9787 { return TelEngine::lookup(type,names(),defvalue); }
9788
9795 static inline Type lookup(const char* name, Type defvalue = Unknown)
9796 { return static_cast<Type>(TelEngine::lookup(name,names(),defvalue)); }
9797
9802 inline void setData(DataBlock* data)
9803 { m_data = data; }
9804
9808 inline void removeData()
9809 { m_data = 0; }
9810
9816 { return m_data; }
9817
9823 {
9824 DataBlock* data = m_data;
9825 m_data = 0;
9826 return data;
9827 }
9828
9829private:
9830 Type m_type; // Message type
9831 DataBlock* m_data; // Message data NOTE: The message never owns the data
9832};
9833
9834class YSIG_API SS7MsgSccpReassemble : public SS7MsgSCCP
9835{
9837public:
9838 enum Return {
9839 Rejected,
9840 Accepted,
9841 Error,
9842 Finished,
9843 };
9850 SS7MsgSccpReassemble(SS7MsgSCCP* msg, const SS7Label& label, unsigned int timeToLive);
9851
9856
9863 bool canProcess(const SS7MsgSCCP* msg, const SS7Label& label);
9864
9871 Return appendSegment(SS7MsgSCCP* msg, const SS7Label& label);
9872
9877 inline bool timeout()
9878 { return m_timeout > 0 ? Time::msecNow() > m_timeout : false; }
9879
9884 inline bool haveAllSegments()
9885 { return m_remainingSegments == 0; }
9886private:
9887 SS7Label m_label;
9888 NamedList m_callingPartyAddress;
9889 u_int32_t m_segmentationLocalReference;
9890 u_int64_t m_timeout;
9891 unsigned char m_remainingSegments;
9892 unsigned int m_firstSgmDataLen;
9893};
9894
9895class YSIG_API SccpSubsystem : public RefObject
9896{
9897 YCLASS(SccpSubsystem,RefObject);
9898public:
9905 inline SccpSubsystem(int ssn, SCCPManagement::SccpStates state = SCCPManagement::Allowed, unsigned char smi = 0)
9906 : m_ssn(ssn), m_smi(smi), m_state(state)
9907 { }
9908
9909 virtual ~SccpSubsystem()
9910 { }
9911
9916 inline unsigned char getSSN()
9917 { return m_ssn; }
9918
9923 inline SCCPManagement::SccpStates getState()
9924 { return m_state; }
9925
9930 inline void setState(SCCPManagement::SccpStates state)
9931 { m_state = state; }
9932
9937 inline unsigned char getSmi()
9938 { return m_smi; }
9939
9944 void dump(String& dest)
9945 {
9946 dest << "Subsystem: " << m_ssn << " , smi: " << m_smi;
9947 dest << ", state: " << SCCPManagement::stateName(m_state) << " ";
9948 }
9949private:
9950 unsigned char m_ssn;
9951 unsigned char m_smi;
9952 SCCPManagement::SccpStates m_state;
9953};
9954
9955class YSIG_API RemoteBackupSubsystem : public GenObject
9956{
9958public:
9959
9966 RemoteBackupSubsystem(unsigned char ssn, int pointcode, bool wfg = false)
9967 : m_ssn(ssn), m_pointcode(pointcode), m_waitForGrant(wfg)
9968 { }
9969
9970 virtual ~RemoteBackupSubsystem()
9971 { }
9972
9979 inline bool equals(unsigned char ssn, int pointcode)
9980 { return m_pointcode == pointcode && m_ssn == ssn; }
9981
9985 inline void permisionGranted()
9986 { m_waitForGrant = false; }
9987
9992 inline bool waitingForGrant()
9993 { return m_waitForGrant; }
9994
9995private:
9996 unsigned char m_ssn;
9997 int m_pointcode;
9998 bool m_waitForGrant;
9999};
10000
10001class YSIG_API SccpLocalSubsystem : public RefObject, public Mutex
10002{
10004public:
10012 SccpLocalSubsystem(unsigned char ssn, u_int64_t coordInterval, u_int64_t istInterval, unsigned char smi = 0);
10013
10018
10023 inline unsigned char getSSN()
10024 { return m_ssn; }
10025
10030 inline void setState(SCCPManagement::SccpStates newState)
10031 { m_state = newState; }
10032
10037 inline SCCPManagement::SccpStates getState()
10038 { return m_state; }
10039
10043 inline void startCoord()
10044 { m_coordTimer.start(); }
10045
10049 inline bool ignoreTests()
10050 { return m_ignoreTestsTimer.started(); }
10051
10056 void setIgnoreTests(bool ignore);
10057
10062 bool timeout();
10063
10069
10073 inline void stopCoordTimer()
10074 { m_coordTimer.stop(); }
10075
10080 inline unsigned char getSmi()
10081 { return m_smi; }
10082
10087 void dump(String& dest);
10088
10095 bool receivedSOG(unsigned char ssn, int pointcode);
10096
10100 inline void resetTimers()
10101 { m_coordTimer.stop(); m_ignoreTestsTimer.stop(); }
10102
10105 inline void clearBackups()
10106 {
10107 Lock lock(this);
10108 m_backups.clear();
10109 }
10110
10116 {
10117 Lock lock(this);
10118 m_backups.append(backup);
10119 }
10120private:
10121 unsigned char m_ssn;
10122 unsigned char m_smi;
10123 SCCPManagement::SccpStates m_state;
10124 SignallingTimer m_coordTimer;
10125 SignallingTimer m_ignoreTestsTimer;
10126 ObjList m_backups;
10127 bool m_receivedAll;
10128};
10129
10133class YSIG_API SccpRemote : public RefObject, public Mutex
10134{
10135 YCLASS(SccpRemote,RefObject);
10136public:
10142
10149 SccpRemote(unsigned int pointcode, SS7PointCode::Type pcType);
10150
10154 virtual ~SccpRemote();
10155
10162 bool initialize(const String& params);
10163
10168 inline SCCPManagement::SccpStates getState()
10169 { return m_state; }
10170
10177
10182 void setState(SCCPManagement::SccpStates state);
10183
10189 { return m_pointcode; }
10190
10196 { return m_pointcode.pack(m_pointcodeType); }
10197
10202 inline const char* getPointCodeType()
10203 { return SS7PointCode::lookup(m_pointcodeType); }
10204
10210 void dump(String& dest, bool extended = false);
10211
10218 bool changeSubsystemState(int ssn,SCCPManagement::SccpStates newState);
10219
10225 { return m_subsystems; }
10226
10231 inline void setCongestion(unsigned int cl)
10232 { m_congestionLevel = cl; }
10233
10237 inline void resetCongestion()
10238 { m_congestionLevel = 0; }
10239
10244 inline unsigned int getCongestion()
10245 { return m_congestionLevel; }
10246private:
10247 SS7PointCode m_pointcode;
10248 SS7PointCode::Type m_pointcodeType;
10249 ObjList m_subsystems;
10250 SCCPManagement::SccpStates m_state;
10251 unsigned int m_congestionLevel;
10252};
10253
10255{
10257public:
10258
10262 inline SS7AnsiSccpManagement(const NamedList& params)
10263 : SCCPManagement(params,SS7PointCode::ANSI)
10264 { }
10265
10266 virtual ~SS7AnsiSccpManagement();
10267
10273 virtual bool processMessage(SS7MsgSCCP* message);
10274
10281 virtual bool sendMessage(SCCPManagement::MsgType msgType, const NamedList& params);
10282
10288 virtual void manageSccpRemoteStatus(SccpRemote* rsccp, SS7Route::State newState);
10289
10297 virtual void handleSubsystemStatus(SccpSubsystem* subsystem, bool allowed, SccpRemote* remote, int smi);
10298
10305 bool handleMessage(int msgType, NamedList& params);
10306};
10307
10309{
10311public:
10312
10317
10322 { }
10323
10329 virtual bool processMessage(SS7MsgSCCP* message);
10330
10337 virtual bool sendMessage(MsgType msgType, const NamedList& params);
10338
10344 virtual void manageSccpRemoteStatus(SccpRemote* rsccp, SS7Route::State newState);
10345
10352 bool handleMessage(int msgType, NamedList& params);
10353
10361 virtual void handleSubsystemStatus(SccpSubsystem* subsystem, bool allowed, SccpRemote* remote, int smi);
10362
10363};
10364
10369{
10371public:
10377 inline SS7SCCPDataSegment(unsigned int index, unsigned int length)
10378 : m_length(length), m_index(index)
10379 {}
10380
10385 {}
10386
10392 inline void fillSegment(DataBlock& temp, const DataBlock& orig)
10393 { temp.assign(orig.data(m_index,m_length),m_length,false); }
10394
10395private:
10396 unsigned int m_length;
10397 unsigned int m_index;
10398};
10399
10404class YSIG_API SS7SCCP : public SS7Layer4, public SCCP, public Mutex
10405{
10406 YCLASS(SS7SCCP,SCCP)
10407 friend class SCCPManagement;
10408public:
10409 enum ReturnCauses {
10410 NoTranslationAddressNature = 0x00,
10411 NoTranslationSpecificAddress = 0x01,
10412 SubsystemCongestion = 0x02,
10413 SubsystemFailure = 0x03,
10414 UnequippedUser = 0x04,
10415 MtpFailure = 0x05,
10416 NetworkCongestion = 0x06,
10417 Unqualified = 0x07,
10418 ErrorInMessageTransport = 0x08,
10419 ErrorInLocalProcessing = 0x09,
10420 DestinationCanNotPerformReassembly = 0x0a,
10421 SccpFailure = 0x0b,
10422 HopCounterViolation = 0x0c,
10423 SegmentationNotSupported = 0x0d,
10424 SegmentationFailure = 0x0e,
10425 // ANSI only
10426 MessageChangeFailure = 0xf7,
10427 InvalidINSRoutingRequest = 0xf8,
10428 InvalidISNIRoutingRequest = 0xf9,
10429 UnauthorizedMessage = 0xfa,
10430 MessageIncompatibility = 0xfb,
10431 NotSupportedISNIRouting = 0xfc,
10432 RedundantISNIConstrainedRouting = 0xfd,
10433 ISNIIdentificationFailed = 0xfe,
10434 };
10435
10436 enum Control {
10437 Status = 0x01,
10438 FullStatus = 0x02,
10439 EnableExtendedMonitoring = 0x03,
10440 DisableExtendedMonitoring = 0x04,
10441 EnablePrintMsg = 0x05,
10442 DisablePrintMsg = 0x06,
10443 };
10447 SS7SCCP(const NamedList& config);
10448
10453
10459 virtual bool initialize(const NamedList* config);
10460
10465 virtual void attach(SS7Layer3* network);
10466
10474 int transmitMessage(SS7MsgSCCP* msg, bool local = false);
10475
10482 virtual bool managementStatus(Type type, NamedList& params);
10483
10490 virtual int sendMessage(DataBlock& data, const NamedList& params);
10491
10500 virtual HandledMSU receivedMSU(const SS7MSU& msu, const SS7Label& label, SS7Layer3* network, int sls);
10501
10511 virtual void receivedUPU(SS7PointCode::Type type, const SS7PointCode node,
10512 SS7MSU::Services part, unsigned char cause, const SS7Label& label, int sls);
10513
10514 virtual bool control(NamedList& params);
10515
10523 int segmentMessage(SS7MsgSCCP* origMsg, const SS7Label& label, bool local);
10524
10528 inline const bool ITU() const
10529 { return m_type == SS7PointCode::ITU; }
10530
10535 inline bool ignoreUnknownAddrSignals() const
10536 { return m_ignoreUnkDigits; }
10537
10543 virtual void notify(SS7Layer3* link, int sls);
10544
10556 inline unsigned int messagesSend()
10557 { return m_totalSent; }
10558
10563 inline unsigned int messagesReceived()
10564 { return m_totalReceived; }
10565
10570 inline unsigned int errors()
10571 { return m_errors; }
10572
10577 inline unsigned int translations()
10578 { return m_totalGTTranslations; }
10579
10584 inline const SS7PointCode* getLocalPointCode() const
10585 { return m_localPointCode; }
10586
10592 { return m_type; }
10593
10599 { return m_localPointCode ? m_localPointCode->pack(m_type) : 0; }
10600
10605 inline bool isLayer3Up()
10606 { return m_layer3Up; }
10607protected:
10608
10613 virtual void destroyed();
10614
10620 { return m_extendedMonitoring; }
10621
10626 virtual void timerTick(const Time& when);
10627
10635 SS7MsgSccpReassemble::Return reassembleSegment(SS7MsgSCCP* segment, const SS7Label& label, SS7MsgSCCP*& msg);
10636
10641 virtual bool isEndpoint()
10642 { return m_endpoint; }
10643
10650private:
10651 // Helper method to calculate sccp address length
10652 unsigned int getAddressLength(const NamedList& params, const String& prefix);
10653 // Helper method used to ajust HopCounter and Importance parameters
10654 void ajustMessageParams(NamedList& params, SS7MsgSCCP::Type type);
10655 // Obtain maximum data length for a UDT, XUDT and LUDT message
10656 void getMaxDataLen(const SS7MsgSCCP* msg, const SS7Label& label,
10657 unsigned int& udtLength, unsigned int& xudtLength, unsigned int& ludtLength);
10658 // Helper method to obtain data segments
10659 // NOTE The list must be destroyed
10660 ObjList* getDataSegments(unsigned int dataLength, unsigned int maxSegmentSize);
10661 // Helper method to print a SCCP message
10662 void printMessage(const SS7MSU* msu, const SS7MsgSCCP* msg, const SS7Label& label);
10663 // Helper method used to extract the pointcode from Calling/Called party address.
10664 // Also will call GT translate if there is no pointcode in called party address
10665 int getPointCode(SS7MsgSCCP* msg, const String& prefix, const char* pCode, bool translate);
10666 // Transmit a SCCP message
10667 int sendSCCPMessage(SS7MsgSCCP* sccpMsg,int dpc,int opc, bool local);
10668 // Helper method used to verify if the message is a connectionless data message
10669 inline bool isSCLCMessage(int msgType)
10670 { return msgType == SS7MsgSCCP::UDT || msgType == SS7MsgSCCP::XUDT || msgType == SS7MsgSCCP::LUDT; }
10671 // Helper method used to verify if the message is a connectionless service message
10672 inline bool isSCLCSMessage(int msgType)
10673 { return msgType == SS7MsgSCCP::UDTS || msgType == SS7MsgSCCP::XUDTS || msgType == SS7MsgSCCP::LUDTS; }
10674 bool isSCOCMsg(int msgType);
10675
10676 bool fillLabelAndReason(String& dest, const SS7Label& label,const SS7MsgSCCP* msg);
10677 inline bool unknownPointCodeType()
10678 { return m_type != SS7PointCode::ITU && m_type != SS7PointCode::ANSI && m_type != SS7PointCode::ANSI8; }
10679 // Helper method used to verify if th importance level is in standard range
10680 int checkImportanceLevel(int msgType,int initialImportance);
10681 // Helper method used to verify if the optional parameters present in message are declared in standards
10682 void checkSCLCOptParams(SS7MsgSCCP* msg);
10683 // Helper method used to monitor service messages
10684 void archiveMessage(SS7MsgSCCP* msg);
10685 // Helper method used to dump service messages and error codes status
10686 void dumpArchive(String& msg, bool extended);
10687
10688 bool processMSU(SS7MsgSCCP::Type type, const unsigned char* paramPtr,
10689 unsigned int paramLen, const SS7Label& label, SS7Layer3* network, int sls);
10690
10691 bool decodeMessage(SS7MsgSCCP* msg, SS7PointCode::Type pcType,
10692 const unsigned char* paramPtr, unsigned int paramLen);
10693
10694 void returnMessage(SS7MsgSCCP* message, int error);
10695
10696 static void switchAddresses(const NamedList& source, NamedList& dest);
10697 // Helper method to dump sccp status
10698 void printStatus(bool extended);
10699 void setNetworkUp(bool operational);
10700
10701 SS7MSU* buildMSU(SS7MsgSCCP* msg, const SS7Label& label, bool checkLength = true) const;
10702 bool routeSCLCMessage(SS7MsgSCCP*& msg, const SS7Label& label);
10703 // Member data
10704 SS7PointCode::Type m_type; // Point code type of this SCCP
10705 SS7PointCode* m_localPointCode; // Local point code
10706 SCCPManagement* m_management; // SCCP management
10707 ObjList m_reassembleList; // List of sccp messages that are waiting to be reassembled
10708 u_int8_t m_hopCounter; // Hop counter value
10709 NamedList m_msgReturnStatus; // List with message return statistics
10710 u_int32_t m_segTimeout; // Time in milliseconds for segmentation timeout
10711 bool m_ignoreUnkDigits; // Check if GT digit parser of should ignore unknown digits encoding
10712 bool m_layer3Up; // Flag used to verify if the network is operational
10713 unsigned int m_maxUdtLength; // The maximum length of data packet transported in a UDT message
10714 u_int32_t m_totalSent; // Counter of the total number of SCCP messages sent
10715 u_int32_t m_totalReceived; // The number of incoming sccp messages
10716 u_int32_t m_errors; // Counter of the number of messages that failed to be delivered
10717 u_int32_t m_totalGTTranslations; // The number of GT translations made
10718 u_int32_t m_gttFailed; // Number of global title that failed to be translated
10719 bool m_extendedMonitoring; // Flag used to check if the monitoring is normal or extended
10720 const char* m_mgmName; // The name of the sccp management section from ysigchan.conf
10721 // Debug flags
10722 bool m_printMsg; // Print messages to output
10723 bool m_extendedDebug; // Extended debug flag
10724 bool m_endpoint; // Flag used to force message processing if the message have a ssn
10725};
10726
10733class YSIG_API SS7SUA : public SIGAdaptUser, public SCCP
10734{
10735};
10736
10741class YSIG_API SS7TCAPMessage : public GenObject
10742{
10743public:
10750 inline SS7TCAPMessage(NamedList& params, DataBlock& data, bool notice = false)
10751 : m_msgParams(params), m_msgData(data), m_notice(notice)
10752 {}
10753
10759 { return m_msgParams; }
10760
10766 { return m_msgData; }
10767
10772 inline bool& isNotice()
10773 { return m_notice; }
10774
10775private:
10776 NamedList m_msgParams;
10777 DataBlock m_msgData;
10778 bool m_notice;
10779};
10780
10785class YSIG_API SS7TCAP : public SCCPUser
10786{
10787 YCLASS(SS7TCAP,SCCPUser)
10788public:
10793 UnknownTCAP,
10794 ITUTCAP,
10795 ANSITCAP,
10796 };
10797
10802 TC_Invoke = 1, // ITU-T Invoke primitive, ANSI InvokeLast - Request/Indication
10803 TC_ResultLast = 2, // ITU-T & ANSI ResultLast primitive - Request/Indication
10804 TC_U_Error = 3, // ITU-T & ANSI ReturnError primitive - Request/Indication
10805 TC_U_Reject = 4, // ITU-T & ANSI Reject primitive - Request/Indication, TC-user rejected the component
10806 TC_R_Reject = 5, // ITU-T & ANSI Reject primitive - Indication, Remote TC-user rejected the component
10807 TC_L_Reject = 6, // ITU-T & ANSI Reject primitive - Indication, local Component Sublayer rejected the component
10808 TC_InvokeNotLast = 7, // ANSI InvokeNotLast primitive - Request/Indication
10809 TC_ResultNotLast = 8, // ITU-T & ANSI ResultNotLast primitive - Request/Indication
10810 TC_L_Cancel = 9, // Local Cancel primitive - Indication, inform TC-user that an operation has timed out
10811 TC_U_Cancel = 10, // User Cancel primitive - Request, TC-user request cancellation of an operation
10812 TC_TimerReset = 11, // Timer Reset - Indication, allow TC-user to refresh an operation timer
10813 };
10814
10819 TC_Unknown = 0,
10820 TC_Unidirectional = 1, // ITU-T & ANSI - Request/Indication, request Unidirectional message
10821 TC_Begin, // ITU-T - Request/Indication, begin a dialogue
10822 TC_QueryWithPerm, // ANSI - Request/Indication, begin a dialogue with permission to end it
10823 TC_QueryWithoutPerm, // ANSI - Request/Indication, begin a dialogue without permission to end it
10824 TC_Continue, // ITU-T - Request/Indication, continue a dialogue
10825 TC_ConversationWithPerm, // ANSI - Request/Indication, continue a dialogue with permission
10826 TC_ConversationWithoutPerm, // ANSI - Request/Indication, continue a dialogue without permission
10827 TC_End, // ITU-T -Request/Indication, end a dialogue
10828 TC_Response, // ANSI - Request/Indication, end a dialogue
10829 TC_U_Abort, // ITU-T & ANSI - Request/Indication, abort a dialogue per user's request
10830 TC_P_Abort, // ITU-T & ANSI - Indication, notify the abort of a dialogue because of a protocol error
10831 TC_Notice, // ITU-T & ANSI - Indication, notify the TC-user that the network was unable to provide the requested service
10832 };
10833
10838 SuccessOrFailureReport = 1,
10839 FailureOnlyReport = 2,
10840 SuccessOnlyReport = 3,
10841 NoReport = 4,
10842 };
10843
10848 IncomingMsgs,
10849 OutgoingMsgs,
10850 DiscardedMsgs,
10851 NormalMsgs,
10852 AbnormalMsgs,
10853 };
10854
10859 SS7TCAP(const NamedList& params);
10860
10864 virtual ~SS7TCAP();
10865
10871 virtual bool initialize(const NamedList* config);
10872
10878 virtual bool sendData(DataBlock& data, NamedList& params);
10879
10887
10895 virtual HandledMSU notifyData(DataBlock& data, NamedList& params);
10896
10902 bool managementNotify(SCCP::Type type, NamedList& params);
10903
10908 void attach(TCAPUser* user);
10909
10914 void detach(TCAPUser* user);
10915
10921 virtual SS7TCAPError userRequest(NamedList& requestParams);
10922
10929
10934 { return m_tcapType; }
10935
10940 inline void setTCAPType(TCAPType type)
10941 { m_tcapType = type; }
10942
10947 virtual void enqueue(SS7TCAPMessage* msg);
10948
10954
10960
10966
10970 static const TokenDict s_tcapVersion[];
10971
10976
10981
10986
10996 bool initLocal = true) = 0;
10997
11004
11010
11015 virtual void timerTick(const Time& when);
11016
11022 virtual bool sendToUser(NamedList& params);
11023
11029 virtual void buildSCCPData(NamedList& params, SS7TCAPTransaction* tr);
11030
11035 virtual void status(NamedList& status);
11036
11042
11052
11059 virtual void updateUserStatus(TCAPUser* user, SCCPManagement::LocalBroadcast status, NamedList& params);
11060
11065 inline void incCounter(TCAPCounter counterType)
11066 {
11067 switch (counterType) {
11068 case IncomingMsgs:
11069 m_recvMsgs++;
11070 break;
11071 case OutgoingMsgs:
11072 m_sentMsgs++;
11073 break;
11074 case DiscardedMsgs:
11075 m_discardMsgs++;
11076 break;
11077 case NormalMsgs:
11078 m_normalMsgs++;
11079 break;
11080 case AbnormalMsgs:
11081 m_abnormalMsgs++;
11082 break;
11083 default:
11084 break;
11085 }
11086 }
11087
11093 inline unsigned int count(TCAPCounter counterType)
11094 {
11095 switch (counterType) {
11096 case IncomingMsgs:
11097 return m_recvMsgs;
11098 case OutgoingMsgs:
11099 return m_sentMsgs;
11100 case DiscardedMsgs:
11101 return m_discardMsgs;
11102 case NormalMsgs:
11103 return m_normalMsgs;
11104 case AbnormalMsgs:
11105 return m_abnormalMsgs;
11106 default:
11107 break;
11108 }
11109 return 0;
11110 }
11111
11117 static inline const char* lookupTransaction(int tr)
11118 { return lookup(tr,s_transPrimitives,"Unknown"); }
11119
11125 static inline int lookupTransaction(const char* tr)
11126 { return lookup(tr,s_transPrimitives,TC_Unknown); }
11127
11133 static inline const char* lookupComponent(int comp)
11134 { return lookup(comp,s_compPrimitives,"Unknown"); }
11135
11141 static inline int lookupComponent(const char* comp)
11142 { return lookup(comp,s_compPrimitives,TC_Unknown); }
11143
11144protected:
11145 virtual SS7TCAPError decodeTransactionPart(NamedList& params, DataBlock& data) = 0;
11146 virtual void encodeTransactionPart(NamedList& params, DataBlock& data) = 0;
11147 bool sendSCCPNotify(NamedList& params);
11148 // list of TCAP users attached to this TCAP instance
11149 ObjList m_users;
11150 Mutex m_usersMtx;
11151
11152 // list of messages received from sublayer, waiting to be processed
11153 ObjList m_inQueue;
11154 Mutex m_inQueueMtx;
11155
11156 unsigned int m_SSN;
11157 unsigned int m_defaultRemoteSSN;
11158 unsigned int m_defaultHopCounter;
11159 SS7PointCode m_defaultRemotePC;
11160 SS7PointCode::Type m_remoteTypePC;
11161 u_int64_t m_trTimeout;
11162
11163 // list of current TCAP transactions
11164 Mutex m_transactionsMtx;
11165 ObjList m_transactions;
11166 // type of TCAP
11167 TCAPType m_tcapType;
11168
11169 // counter for allocating transaction IDs
11170 u_int32_t m_idsPool;
11171
11172 // counters
11173 unsigned int m_recvMsgs;
11174 unsigned int m_sentMsgs;
11175 unsigned int m_discardMsgs;
11176 unsigned int m_normalMsgs;
11177 unsigned int m_abnormalMsgs;
11178
11179 // Subsystem Status
11180 SCCPManagement::LocalBroadcast m_ssnStatus;
11181};
11182
11183class YSIG_API SS7TCAPError
11184{
11185public:
11186 enum ErrorType {
11187 // P-AbortCause TransactionProblems
11188 Transact_UnrecognizedPackageType, // named after the ANSI specification, equivalent to ITU-T UnrecongnizedMessageType P-AbortCause
11189 Transact_IncorrectTransactionPortion, // <==> ITU-T incorrectTrasactionPortion P-AbortCause
11190 Transact_BadlyStructuredTransaction, // <==> ITU-T badlyFormattedTransactionPortion P-AbortCause
11191 Transact_UnassignedTransactionID,
11192 Transact_PermissionToReleaseProblem, // HANDLING NOT DEFINED
11193 Transact_ResourceUnavailable, // <==> ITU-T resourceLimitation P-AbortCause
11194
11195 // P-AbortCause DialogProblem
11196 Dialog_UnrecognizedDialoguePortionID, // ANSI only
11197 Dialog_BadlyStructuredDialoguePortion,// ANSI only
11198 Dialog_MissingDialoguePortion, // ANSI only
11199 Dialog_InconsistentDialoguePortion, // ANSI only
11200 Dialog_Abnormal, // ITU only, indication only
11201
11202 // GeneralProblem
11203 General_UnrecognizedComponentType, // named after the ANSI specification, equivalent to ITU-T UnrecognizedComponent General Problem
11204 General_IncorrectComponentPortion, // ANSI specification, equivalent to ITU-T MistypedComponent General Problem
11205 General_BadlyStructuredCompPortion, // ANSI specification, equivalent to ITU-T BadlyStructuredComponent General Problem
11206 General_IncorrectComponentCoding, // ANSI specification, no ITU-T equivalent
11207
11208 // InvokeProblem
11209 Invoke_DuplicateInvokeID, // ANSI & ITU-T specification
11210 Invoke_UnrecognizedOperationCode, // ANSI specification, equivalent to ITU-T UnrecognizedOperation Invoke Problem
11211 Invoke_IncorrectParameter, // ANSI specification, equivalent to ITU-T MistypedParameter Invoke Problem
11212 Invoke_UnrecognizedCorrelationID, // ANSI specification, equivalent to ITU-T UnrecognizedLinkedID Invoke Problem
11213 Invoke_ResourceLimitation, // ITU-T only
11214 Invoke_InitiatingRelease, // ITU-T only
11215 Invoke_LinkedResponseUnexpected, // ITU-T only
11216 Invoke_UnexpectedLinkedOperation, // ITU-T only
11217
11218 // ReturnResult
11219 Result_UnrecognizedInvokeID, // ITU-T only
11220 Result_UnrecognisedCorrelationID, // ANSI only
11221 Result_UnexpectedReturnResult, // ANSI specification, equivalent to ITU-T ReturnResultUnexpected Result Problem
11222 Result_IncorrectParameter, // ANSI specification, equivalent to ITU-T MistypedParameter Result Problem
11223
11224 // ReturnError
11225 Error_UnrecognizedInvokeID, // ITU-T only
11226 Error_UnrecognisedCorrelationID, // ANSI only
11227 Error_UnexpectedReturnError, // ANSI only
11228 Error_UnrecognisedError, // ANSI & ITU-T
11229 Error_UnexpectedError, // ANSI & ITU-T
11230 Error_IncorrectParameter, // ANSI specification, equivalent to ITU-T MistypedParameter Return Error Problem
11231
11232 Discard,
11233 NoError,
11234 };
11235
11241
11248
11253
11258 inline ErrorType error()
11259 { return m_error; }
11260
11265 inline void setError(ErrorType error)
11266 { m_error = error; }
11267
11273
11278 u_int16_t errorCode();
11279
11286 static int errorFromCode(SS7TCAP::TCAPType tcapType, u_int16_t code);
11287
11294 static u_int16_t codeFromError(SS7TCAP::TCAPType tcapType, int err);
11295
11299 static const TokenDict s_errorTypes[];
11300
11301private:
11302 SS7TCAP::TCAPType m_tcapType;
11303 ErrorType m_error;
11304};
11305
11310class YSIG_API SS7TCAPTransaction : public RefObject, public Mutex
11311{
11312public:
11313 enum TransactionState {
11314 Idle = 0,
11315 PackageSent = 1,
11316 PackageReceived = 2,
11317 Active = 3,
11318 };
11319
11320 enum TransactionTransmit {
11321 NoTransmit = 0,
11322 PendingTransmit = 256,
11323 Transmitted = 521,
11324 };
11325
11336 u_int64_t timeout, bool initLocal = true);
11337
11342
11349 virtual SS7TCAPError handleData(NamedList& params, DataBlock& data) = 0;
11350
11358 virtual SS7TCAPError update(SS7TCAP::TCAPUserTransActions type, NamedList& params, bool updateByUser = true) = 0;
11359
11366 virtual SS7TCAPError handleDialogPortion(NamedList& params,bool byUser = true) = 0;
11367
11376
11383 virtual SS7TCAPError handleComponents(NamedList& params, bool updateByUser = true);
11384
11390 virtual void requestComponents(NamedList& params, DataBlock& data);
11391
11396 virtual void transactionData(NamedList& params);
11397
11403 virtual void requestContent(NamedList& params, DataBlock& data) = 0;
11404
11408 virtual void checkComponents();
11409
11415 { Lock l(this); m_type = type; }
11416
11422 { return m_type; }
11423
11428 inline void setState(TransactionState state)
11429 {
11430 Lock l(this);
11431 m_state = state;
11432 // changing state automatically triggers a change in transmission state (except for Idle)
11433 if (state != Idle)
11434 m_transmit = PendingTransmit;
11435 }
11436
11441 inline TransactionState transactionState()
11442 { return m_state; }
11443
11448 void setTransmitState(TransactionTransmit state);
11449
11454 inline TransactionTransmit transmitState()
11455 { return m_transmit; }
11456
11461 inline SS7TCAP* tcap()
11462 { return m_tcap; }
11463
11468 const String& toString() const
11469 { return m_localID; }
11470
11475 inline void setUserName(const String& name)
11476 { m_userName = name; }
11477
11483 { return m_userName; }
11484
11489 inline bool basicEnd()
11490 { return m_basicEnd; }
11491
11497 void addSCCPAddressing(NamedList& fillParams, bool local);
11498
11503 inline bool endNow()
11504 { return m_endNow; }
11505
11510 inline void endNow(bool endNow)
11511 { m_endNow = endNow; }
11512
11517 inline bool timedOut()
11518 { return m_timeout.timeout(); }
11519
11526
11530 virtual void updateToEnd();
11531
11536 virtual void updateState(bool byUser = true) = 0;
11537
11542 virtual void abnormalDialogInfo(NamedList& params);
11543
11550
11555 virtual void encodeDialogPortion(NamedList& params, DataBlock& data) = 0;
11556
11563
11568 virtual void encodeComponents(NamedList& params, DataBlock& data) = 0;
11569
11570protected:
11571 SS7TCAP* m_tcap;
11572 SS7TCAP::TCAPType m_tcapType;
11573 String m_userName;
11574 String m_localID;
11575 String m_remoteID;
11577 TransactionState m_state;
11578 TransactionTransmit m_transmit;
11579
11580 ObjList m_components;
11581
11582 NamedList m_localSCCPAddr;
11583 NamedList m_remoteSCCPAddr;
11584
11585 bool m_basicEnd; // basic or prearranged end (specified by user when sending a Response)
11586 bool m_endNow; // delete immediately after sending
11587 SignallingTimer m_timeout;
11588};
11589
11594class YSIG_API SS7TCAPComponent : public GenObject
11595{
11596public:
11601 Idle,
11602 OperationPending,
11603 OperationSent,
11604 WaitForReject,
11605 };
11606
11615
11620
11626 virtual void update(NamedList& params, unsigned int index);
11627
11633 virtual void fill(unsigned int index, NamedList& fillIn);
11634
11644
11650
11655
11661 { m_type = type; }
11662
11667 { return m_type; }
11668
11673 virtual void setInvokeID(String invokeID)
11674 { m_id = invokeID; }
11675
11680 virtual const String& toString () const
11681 { return m_id; }
11682
11687 virtual const String& correlationID() const
11688 { return m_corrID; }
11689
11694 inline bool timedOut()
11695 { return m_opTimer.timeout(); }
11696
11702
11708 { return m_state; }
11709
11715 void resetTimer(NamedList& params, unsigned int index);
11716
11723
11727 static const TokenDict s_compStates[];
11728
11729private:
11730 SS7TCAPTransaction* m_transact;
11732 TCAPComponentState m_state;
11733 String m_id;
11734 String m_corrID;
11735 String m_opCode;
11736 String m_opType;
11738 SignallingTimer m_opTimer;
11739 SS7TCAPError m_error;
11740};
11741
11746class YSIG_API SS7TCAPANSI : virtual public SS7TCAP
11747{
11748 YCLASS(SS7TCAPANSI,SS7TCAP)
11749public:
11750 enum TCAPTags {
11751 TransactionIDTag = 0xc7,
11752 PCauseTag = 0xd7,
11753 UserAbortPTag = 0xd8 , // Primitive
11754 UserAbortCTag = 0xf8, // Constructor
11755 };
11756
11757 enum TCAPDialogTags {
11758 DialogPortionTag = 0xf9,
11759 ProtocolVersionTag = 0xda,
11760 IntApplicationContextTag = 0xdb,
11761 OIDApplicationContextTag = 0xdc,
11762 UserInformationTag = 0xfd,
11763 IntSecurityContextTag = 0x80,
11764 OIDSecurityContextTag = 0x81,
11765 ConfidentialityTag = 0xa2,
11766 };
11767
11768 enum UserInfoTags {
11769 DirectReferenceTag = 0x06,
11770 DataDescriptorTag = 0x07,
11771 ExternalTag = 0x28,
11772 SingleASNTypePEncTag = 0x80, // Primitive Single-ASN1-Type-Encoding
11773 SingleASNTypeCEncTag = 0xa0, // Constructor Single-ASN1-Type-Encoding
11774 OctetAlignEncTag = 0x81,
11775 ArbitraryEncTag = 0x82,
11776 };
11777
11778 enum ConfidentialityTags {
11779 IntConfidentialContextTag = 0x80,
11780 OIDConfidentialContextTag = 0x81,
11781 };
11782
11783 enum TCAPComponentTags {
11784 ComponentPortionTag = 0xe8,
11785 ComponentsIDsTag = 0xcf,
11786 OperationNationalTag = 0xd0,
11787 OperationPrivateTag = 0xd1,
11788 ErrorNationalTag = 0xd3,
11789 ErrorPrivateTag = 0xd4,
11790 ProblemCodeTag = 0xd5,
11791 ParameterSetTag = 0xf2,
11792 ParameterSeqTag = 0x30,
11793 };
11794
11799 SS7TCAPANSI(const NamedList& params);
11800
11805
11815 bool initLocal = true);
11816
11817private:
11818 SS7TCAPError decodeTransactionPart(NamedList& params, DataBlock& data);
11819 void encodeTransactionPart(NamedList& params, DataBlock& data);
11820};
11821
11827{
11828public:
11829 enum TCAPANSIComponentType {
11830 CompUnknown = 0x0,
11831 Local = 0x1,
11832 InvokeLast = 0xe9,
11833 ReturnResultLast = 0xea,
11834 ReturnError = 0xeb,
11835 Reject = 0xec,
11836 InvokeNotLast = 0xed,
11837 ReturnResultNotLast = 0xee,
11838 };
11839
11840 enum ANSITransactionType {
11841 Unknown = 0x0,
11842 Unidirectional = 0xe1,
11843 QueryWithPermission = 0xe2,
11844 QueryWithoutPermission = 0xe3,
11845 Response = 0xe4,
11846 ConversationWithPermission = 0xe5,
11847 ConversationWithoutPermission = 0xe6,
11848 Abort = 0xf6,
11849 };
11850
11861 u_int64_t timeout, bool initLocal = true);
11862
11867
11875
11883 virtual SS7TCAPError update(SS7TCAP::TCAPUserTransActions type, NamedList& params, bool updateByUser = true);
11884
11891 virtual SS7TCAPError handleDialogPortion(NamedList& params, bool byUser = true);
11892
11899 static void encodePAbort(SS7TCAPTransaction* tr, NamedList& params, DataBlock& data);
11900
11908
11912 virtual void updateToEnd();
11913
11918 virtual void updateState(bool byUser);
11919
11925 virtual void requestContent(NamedList& params, DataBlock& data);
11926
11931
11932private:
11933 SS7TCAPError decodeDialogPortion(NamedList& params, DataBlock& data);
11934 void encodeDialogPortion(NamedList& params, DataBlock& data);
11935 SS7TCAPError decodeComponents(NamedList& params, DataBlock& data);
11936 void encodeComponents(NamedList& params, DataBlock& data);
11937
11939};
11940
11945class YSIG_API SS7TCAPITU : virtual public SS7TCAP
11946{
11947 YCLASS(SS7TCAPITU,SS7TCAP)
11948public:
11949 enum TCAPTags {
11950 OriginatingIDTag = 0x48,
11951 DestinationIDTag = 0x49,
11952 PCauseTag = 0x4a,
11953 };
11954
11955 enum TCAPDialogTags {
11956 DialogPortionTag = 0x6b,
11957 ProtocolVersionTag = 0x80,
11958 ApplicationContextTag = 0xa1,
11959 UserInformationTag = 0xbe,
11960 };
11961
11962 enum UserInfoTags {
11963 DirectReferenceTag = 0x06,
11964 DataDescriptorTag = 0x07,
11965 ExternalTag = 0x28,
11966 SingleASNTypePEncTag = 0x80, // Primitive Single-ASN1-Type-Encoding
11967 SingleASNTypeCEncTag = 0xa0, // Constructor Single-ASN1-Type-Encoding
11968 OctetAlignEncTag = 0x81,
11969 ArbitraryEncTag = 0x82,
11970 };
11971
11972 enum TCAPComponentTags {
11973 ComponentPortionTag = 0x6c,
11974 LocalTag = 0x02,
11975 LinkedIDTag = 0x80,
11976 GlobalTag = 0x06,
11977 ParameterSeqTag = 0x30,
11978 ParameterSetTag = 0x31,
11979 };
11980
11985 SS7TCAPITU(const NamedList& params);
11986
11991
12001 bool initLocal = true);
12002
12003private:
12004 SS7TCAPError decodeTransactionPart(NamedList& params, DataBlock& data);
12005 void encodeTransactionPart(NamedList& params, DataBlock& data);
12006};
12007
12013{
12014public:
12015 enum ITUComponentType {
12016 CompUnknown = 0x0,
12017 Local = 0x1,
12018 Invoke = 0xa1,
12019 ReturnResultLast = 0xa2,
12020 ReturnError = 0xa3,
12021 Reject = 0xa4,
12022 ReturnResultNotLast = 0xa7,
12023 };
12024
12025 enum ITUTransactionType {
12026 Unknown = 0x0,
12027 Unidirectional = 0x61,
12028 Begin = 0x62,
12029 End = 0x64,
12030 Continue = 0x65,
12031 Abort = 0x67,
12032 };
12033
12034 enum ITUDialogTags {
12035 AARQDialogTag = 0x60,
12036 AAREDialogTag = 0x61,
12037 ABRTDialogTag = 0x64,
12038 ResultDiagnosticUserTag = 0xa1,
12039 ResultDiagnosticProviderTag = 0xa2,
12040 ResultTag = 0xa2,
12041 ResultDiagnosticTag = 0xa3,
12042 };
12043
12044 enum ITUDialogValues {
12045 ResultAccepted = 0,
12046 ResultRejected = 1,
12047 DiagnosticUserNull = 0x10,
12048 DiagnosticUserNoReason = 0x11,
12049 DiagnosticUserAppCtxtNotSupported = 0x12,
12050 DiagnosticProviderNull = 0x20,
12051 DiagnosticProviderNoReason = 0x21,
12052 DiagnosticProviderNoCommonDialog = 0x22,
12053 AbortSourceUser = 0x30,
12054 AbortSourceProvider = 0x31,
12055 };
12056
12067 u_int64_t timeout, bool initLocal = true);
12068
12073
12081
12089 virtual SS7TCAPError update(SS7TCAP::TCAPUserTransActions type, NamedList& params, bool updateByUser = true);
12090
12097 virtual SS7TCAPError handleDialogPortion(NamedList& params, bool byUser = true);
12098
12105 static void encodePAbort(SS7TCAPTransaction* tr, NamedList& params, DataBlock& data);
12106
12115
12119 virtual void updateToEnd();
12120
12125 inline bool dialogPresent()
12126 { return !(m_appCtxt.null()); }
12127
12134
12141
12149
12154 void updateState(bool byUser = false);
12155
12161 virtual void requestContent(NamedList& params, DataBlock& data);
12162
12167 virtual void abnormalDialogInfo(NamedList& params);
12168
12172 static const TokenDict s_dialogPDUs[];
12173
12178
12179private:
12180 SS7TCAPError decodeComponents(NamedList& params, DataBlock& data);
12181 void encodeComponents(NamedList& params, DataBlock& data);
12182
12183 String m_appCtxt;
12184};
12185
12186// The following classes are ISDN, not SS7, but they use the same signalling
12187// interfaces so they will remain here
12188
12193class YSIG_API ISDNLayer2 : virtual public SignallingComponent
12194{
12196 friend class ISDNQ921Management;
12197public:
12201 enum State {
12202 Released, // Multiple frame acknowledged not allowed
12203 WaitEstablish, // Wating to establish 'multiple frame acknowledged' mode
12204 Established, // Multiple frame acknowledged allowed
12205 WaitRelease, // Wating to release 'multiple frame acknowledged' mode
12206 };
12207
12211 virtual ~ISDNLayer2();
12212
12216 inline ISDNLayer3* layer3() const
12217 { return m_layer3; }
12218
12223 inline State state() const
12224 { return m_state; }
12225
12230 inline bool network() const
12231 { return m_network; }
12232
12237 inline bool detectType() const
12238 { return m_detectType; }
12239
12244 inline u_int8_t localSapi() const
12245 { return m_sapi; }
12246
12251 inline u_int8_t localTei() const
12252 { return m_tei; }
12253
12258 inline u_int32_t maxUserData() const
12259 { return m_maxUserData; }
12260
12265 inline bool teiAssigned() const
12266 { return m_teiAssigned; }
12267
12272 inline bool autoRestart() const
12273 { return m_autoRestart; }
12274
12279 unsigned int upTime() const
12280 { return m_lastUp ? (Time::secNow() - m_lastUp) : 0; }
12281
12291 virtual bool multipleFrame(u_int8_t tei, bool establish, bool force)
12292 { return false; }
12293
12302 virtual bool sendData(const DataBlock& data, u_int8_t tei, bool ack)
12303 { return false; }
12304
12309 virtual void cleanup() = 0;
12310
12317 virtual void attach(ISDNLayer3* layer3);
12318
12324 static inline const char* stateName(State s)
12325 { return lookup((int)s,m_states); }
12326
12327protected:
12335 ISDNLayer2(const NamedList& params, const char* name = 0, u_int8_t tei = 0);
12336
12341 inline Mutex& l2Mutex()
12342 { return m_layerMutex; }
12343
12352 void multipleFrameEstablished(u_int8_t tei, bool confirm, bool timeout);
12353
12362 void multipleFrameReleased(u_int8_t tei, bool confirm, bool timeout);
12363
12374 void dataLinkState(u_int8_t tei, bool cmd, bool value);
12375
12381
12388 void receiveData(const DataBlock& data, u_int8_t tei);
12389
12395 void teiAssigned(bool status);
12396
12403 void changeState(State newState, const char* reason = 0);
12404
12410
12415 inline void autoRestart(bool restart)
12416 { m_autoRestart = restart; }
12417
12422 inline void setRi(u_int16_t ri)
12423 { m_ri = ri; }
12424
12431
12432private:
12433 ISDNLayer3* m_layer3; // The attached Layer 3 interface
12434 Mutex m_layerMutex; // Layer 2 operations mutex
12435 Mutex m_layer3Mutex; // Control m_layer3 operations
12436 State m_state; // Layer's state
12437 bool m_network; // Network/CPE type of the interface
12438 bool m_detectType; // Detect interface type
12439 u_int8_t m_sapi; // SAPI value
12440 u_int8_t m_tei; // TEI value
12441 u_int16_t m_ri; // Reference number
12442 u_int32_t m_lastUp; // Time when the interface got up
12443 bool m_checked; // Flag to indicate if the layer was checked
12444 bool m_teiAssigned; // The TEI status
12445 bool m_autoRestart; // True to restart when released
12446 u_int32_t m_maxUserData; // Maximum length of user data transported trough this layer
12447 unsigned int m_teiRefNumber; // The Reference Number (Ri) carried by a TEI management frame
12448 static const TokenDict m_states[]; // Keep the string associated with each state
12449};
12450
12455class YSIG_API ISDNLayer3 : virtual public SignallingComponent
12456{
12458public:
12468 virtual void multipleFrameEstablished(u_int8_t tei, bool confirm, bool timeout, ISDNLayer2* layer2)
12469 { }
12470
12480 virtual void multipleFrameReleased(u_int8_t tei, bool confirm, bool timeout, ISDNLayer2* layer2)
12481 { }
12482
12494 virtual void dataLinkState(u_int8_t tei, bool cmd, bool value, ISDNLayer2* layer2)
12495 { }
12496
12502 virtual void idleTimeout(ISDNLayer2* layer2)
12503 { }
12504
12512 virtual void receiveData(const DataBlock& data, u_int8_t tei, ISDNLayer2* layer2) = 0;
12513
12519 virtual ISDNLayer2* attach(ISDNLayer2* layer2)
12520 { return 0; }
12521
12522protected:
12528 inline ISDNLayer3(const char* name = 0)
12529 : SignallingComponent(name),
12530 m_layerMutex(true,"ISDNLayer3::layer")
12531 { }
12532
12537 inline Mutex& l3Mutex()
12538 { return m_layerMutex; }
12539
12540private:
12541 Mutex m_layerMutex; // Layer 3 operations mutex
12542};
12543
12548class YSIG_API ISDNFrame : public RefObject
12549{
12550 friend class ISDNQ921;
12551 friend class ISDNQ921Management;
12552public:
12556 enum Type {
12557 DISC = 1, // disconnect (command)
12558 DM = 2, // disconnected (response)
12559 FRMR = 3, // frame reject (response)
12560 I = 4, // information transfer (response)
12561 REJ = 5, // reject (command/response)
12562 RNR = 6, // receive not ready (command/response)
12563 RR = 7, // receive ready (command/response)
12564 SABME = 8, // set asynchronous balanced mode extended (command)
12565 UA = 9, // unnumbered acknoledgement (response)
12566 UI = 10, // unnumbered information (command)
12567 XID = 11, // exchange identification (command/response)
12568 // Note: Keep all errors greater then Invalid: The code relies on it
12569 Invalid = 100,
12570 ErrUnknownCR = 101, // Error: Unknown command/response. Set by parser
12571 ErrHdrLength = 102, // Error: Invalid header length. Set by parser
12572 ErrDataLength = 103, // Error: Information field too long
12573 ErrRxSeqNo = 104, // Error: Invalid receive sequence number
12574 ErrTxSeqNo = 105, // Error: Invalid send sequence number
12575 ErrInvalidEA = 106, // Error: Invalid 'extended address' bit(s). Set by parser
12576 ErrInvalidAddress = 107, // Error: Invalid SAPI/TEI
12577 ErrUnsupported = 108, // Error: Unsupported command. E.g. XID
12578 ErrInvalidCR = 109, // Error: Invalid command/response flag
12579 };
12580
12585 TeiReq = 1, // TEI request (user to network)
12586 TeiAssigned = 2, // TEI assigned (network to user)
12587 TeiDenied = 3, // TEI denied (network to user)
12588 TeiCheckReq = 4, // TEI check request (network to user)
12589 TeiCheckRsp = 5, // TEI check response (user to network)
12590 TeiRemove = 6, // TEI remove (network to user)
12591 TeiVerify = 7 // TEI verify (user to network)
12592 };
12593
12598 Data, // I, UI
12599 Supervisory, // RR, RNR, REJ
12600 Unnumbered, // SABME, DISC, UA DM, FRMR XID
12601 Error
12602 };
12603
12607 virtual ~ISDNFrame();
12608
12613 inline Type type() const
12614 { return m_type; }
12615
12620 inline Type error() const
12621 { return m_error; }
12622
12627 inline Category category() const
12628 { return m_category; }
12629
12634 inline bool command() const
12635 { return m_command; }
12636
12641 inline u_int8_t sapi() const
12642 { return m_sapi; }
12643
12648 inline u_int8_t tei() const
12649 { return m_tei; }
12650
12655 inline bool poll() const
12656 { return m_poll; }
12657
12662 inline u_int8_t ns() const
12663 { return m_ns; }
12664
12669 inline u_int8_t nr() const
12670 { return m_nr; }
12671
12676 inline u_int8_t headerLength() const
12677 { return m_headerLength; }
12678
12683 inline u_int32_t dataLength() const
12684 { return m_dataLength; }
12685
12690 inline const DataBlock& buffer() const
12691 { return m_buffer; }
12692
12697 inline bool sent() const
12698 { return m_sent; }
12699
12703 inline void sent(bool value)
12704 { m_sent = value; }
12705
12710 inline const char* name() const
12711 { return typeName(type()); }
12712
12718 void update(u_int8_t* ns = 0, u_int8_t* nr = 0);
12719
12724 inline void getData(DataBlock& dest) const
12725 { dest.assign((u_int8_t*)m_buffer.data() + m_headerLength,m_dataLength); }
12726
12732 void toString(String& dest, bool extendedDebug) const;
12733
12739
12745 static u_int16_t getRi(const DataBlock& data);
12746
12752 inline static u_int8_t getType(const DataBlock& data)
12753 { return static_cast<u_int8_t>(data.at(3,0)); }
12754
12760 inline static u_int8_t getAi(const DataBlock& data)
12761 { return static_cast<u_int8_t>(data.at(4,0) >> 1); }
12762
12763
12770 static ISDNFrame* parse(const DataBlock& data, ISDNLayer2* receiver);
12771
12780 static bool buildTeiManagement(DataBlock& data, u_int8_t type, u_int16_t ri,
12781 u_int8_t ai);
12782
12789 static inline bool commandBit(bool network)
12790 { return network; }
12791
12798 static inline bool responseBit(bool network)
12799 { return !network; }
12800
12807 static inline bool isCommand(u_int8_t cr, bool sentByNetwork)
12808 { return cr ? sentByNetwork : !sentByNetwork; }
12809
12815 static inline const char* typeName(Type type)
12816 { return lookup(type,s_types,"Invalid frame"); }
12817
12821 static const TokenDict s_types[];
12822
12823protected:
12829 ISDNFrame(Type type = Invalid);
12830
12844 ISDNFrame(Type type, bool command, bool senderNetwork,
12845 u_int8_t sapi, u_int8_t tei, bool pf, u_int8_t nr = 0);
12846
12859 ISDNFrame(bool ack, bool senderNetwork, u_int8_t sapi, u_int8_t tei,
12860 bool pf, const DataBlock& data);
12861
12862private:
12863 Type m_type; // Frame type
12864 Type m_error; // Frame error type
12865 Category m_category; // Frame category
12866 // Address
12867 bool m_command; // Command/Response frame
12868 bool m_senderNetwork; // True if the sender of this frame is the network side of the data link
12869 u_int8_t m_sapi; // SAPI value
12870 u_int8_t m_tei; // TEI value
12871 // Control
12872 bool m_poll; // Poll/Final flag
12873 u_int8_t m_ns; // N(S) value (when applicable): transmitter send sequence number
12874 u_int8_t m_nr; // N(R) value (when applicable): transmitter receive sequence number
12875 // Data
12876 u_int8_t m_headerLength; // Header length
12877 u_int32_t m_dataLength; // Data length
12878 DataBlock m_buffer; // Whole frame: header + data + FCS (frame check sequence = 2 bytes)
12879 // Outgoing frames only
12880 bool m_sent; // True if already sent
12881};
12882
12887class YSIG_API ISDNQ921 : public ISDNLayer2, public SignallingReceiver, public SignallingDumpable
12888{
12890 friend class ISDNQ921Management;
12891public:
12900 ISDNQ921(const NamedList& params, const char* name = 0, ISDNQ921Management* mgmt = 0, u_int8_t tei = 0);
12901
12905 virtual ~ISDNQ921();
12906
12912 virtual bool initialize(const NamedList* config);
12913
12918 inline u_int64_t dataTimeout() const
12919 { return m_retransTimer.interval() * m_n200.maxVal(); }
12920
12931 virtual bool multipleFrame(u_int8_t tei, bool establish, bool force);
12932
12942 virtual bool sendData(const DataBlock& data, u_int8_t tei, bool ack);
12943
12948 inline bool sendSabme()
12949 { return sendUFrame(ISDNFrame::SABME,true,true); }
12950
12956 virtual void cleanup();
12957
12963 inline void setDebug(bool printFrames, bool extendedDebug)
12964 { m_extendedDebug = ((m_printFrames = printFrames) && extendedDebug); }
12965
12966protected:
12970 virtual void destroyed()
12971 {
12973 TelEngine::destruct(SignallingReceiver::attach(0));
12975 }
12976
12982 virtual void timerTick(const Time& when);
12983
12990 virtual bool receivedPacket(const DataBlock& packet);
12991
12998
13006
13011 void reset();
13012
13013private:
13014 virtual bool control(NamedList& params)
13015 { return SignallingDumpable::control(params,this); }
13016 // Acknoledge outgoing frames
13017 // @param frame The acknoledging frame
13018 bool ackOutgoingFrames(const ISDNFrame* frame);
13019 // Process a received I/UI frame
13020 // @param ack True for I frame, false for UI frame
13021 // @return True to send data to Layer 3
13022 bool processDataFrame(const ISDNFrame* frame, bool ack);
13023 // Process a received S frame
13024 // @return True to exit from timer recovery state
13025 bool processSFrame(const ISDNFrame* frame);
13026 // Process a received U frame
13027 // @param newState The new state if true is returned
13028 // @param confirmation True if the new state is Established or Released and
13029 // this is a confirmation
13030 // @return True to change state
13031 bool processUFrame(const ISDNFrame* frame, State& newState,
13032 bool& confirmation);
13033 // Accept frame according to Q.921 5.8.5
13034 // Update counters.
13035 // If not accepted the frame is rejected or dropped
13036 // reject is set to true if the frame is rejected
13037 bool acceptFrame(ISDNFrame* frame, bool& reject);
13038 // Update rejected frames counter. Print message. Send FRMR (frame reject)
13039 void rejectFrame(const ISDNFrame* frame, const char* reason = 0);
13040 // Update dropped frames counter. Print message
13041 void dropFrame(const ISDNFrame* frame, const char* reason = 0);
13042 // Send S frames other then UI frames
13043 bool sendUFrame(ISDNFrame::Type type, bool command, bool pf,
13044 bool retrans = false);
13045 // Send U frames
13046 bool sendSFrame(ISDNFrame::Type type, bool command, bool pf);
13047 // Send a frame to remote peer
13048 // @param frame Frame to send
13049 // @return False if the operation failed
13050 bool sendFrame(const ISDNFrame* frame);
13051 // Send pending outgoing I frames
13052 // @param retrans: True Send all transmission window
13053 // False Send only the unsent frames in transmission window
13054 // @return True if a transmission took place
13055 bool sendOutgoingData(bool retrans = false);
13056 // Start/Stop T200. Stop/Start T203
13057 // If start is false reset N200 (retransmission counter)
13058 // @param start True to start. False to stop
13059 // @param t203 Start/don't start T203. Ignored if start is false
13060 // @param time Current time if known
13061 void timer(bool start, bool t203, u_int64_t time = 0);
13062
13063 ISDNQ921Management* m_management; // TEI management component
13064 // State variables
13065 bool m_remoteBusy; // Remote peer is busy: don't send any I frames
13066 bool m_timerRecovery; // T200 expired
13067 bool m_rejectSent; // True if we've sent a REJ frame
13068 bool m_pendingDMSabme; // True if we have a pending SABME on DM received
13069 bool m_lastPFBit; // Last P/F bit sent with an I or S frame
13070 u_int8_t m_vs; // Sequence number of the next transmitted I frame
13071 u_int8_t m_va; // Last ack'd I frame by remote peer
13072 u_int8_t m_vr; // Expected I frame sequence number
13073 // Timers and counters
13074 SignallingTimer m_retransTimer; // T200: Retransmission interval
13075 SignallingTimer m_idleTimer; // T203: Channel idle interval
13076 SignallingCounter m_window; // Maximum/current number of pending outgoing I frames
13077 SignallingCounter m_n200; // Maximum/current retransmission counter
13078 // Data
13079 ObjList m_outFrames; // Outgoing I frames queue
13080 // Statistics
13081 u_int32_t m_txFrames; // The number of frames accepted by layer 1 to be transmitted
13082 u_int32_t m_txFailFrames; // The number of frames not accepted by layer 1 to be transmitted
13083 u_int32_t m_rxFrames; // The number of successfully parsed frames
13084 u_int32_t m_rxRejectedFrames; // The number of rejected frames. Doesn't include dropped frames
13085 u_int32_t m_rxDroppedFrames; // The number of dropped frames. Doesn't include rejected frames
13086 u_int32_t m_hwErrors; // The number of hardware notifications
13087 // Debug flags
13088 bool m_printFrames; // Print frames to output
13089 bool m_extendedDebug; // Extended debug flag
13090 // Flags used to avoid repetitive errors
13091 bool m_errorSend; // Send error
13092 bool m_errorReceive; // Receive error
13093};
13094
13103{
13105public:
13112 ISDNQ921Management(const NamedList& params, const char* name = 0, bool net = true);
13113
13118
13124 virtual bool initialize(const NamedList* config);
13125
13130 virtual void engine(SignallingEngine* eng);
13131
13139 virtual bool multipleFrame(u_int8_t tei, bool establish, bool force);
13140
13148 virtual bool sendData(const DataBlock& data, u_int8_t tei, bool ack);
13149
13156 bool sendFrame(const ISDNFrame* frame, const ISDNQ921* q921 = 0);
13157
13158
13163 virtual void cleanup();
13164
13174 virtual void multipleFrameEstablished(u_int8_t tei, bool confirm, bool timeout, ISDNLayer2* layer2);
13175
13185 virtual void multipleFrameReleased(u_int8_t tei, bool confirm, bool timeout, ISDNLayer2* layer2);
13186
13198 virtual void dataLinkState(u_int8_t tei, bool cmd, bool value, ISDNLayer2* layer2);
13199
13207 virtual void receiveData(const DataBlock& data, u_int8_t tei, ISDNLayer2* layer2);
13208
13209protected:
13215 virtual void timerTick(const Time& when);
13216
13223 virtual bool receivedPacket(const DataBlock& packet);
13224
13231
13238
13248 bool sendTeiManagement(ISDNFrame::TeiManagement type, u_int16_t ri, u_int8_t ai, u_int8_t tei = 127, bool pf = false);
13249
13261 void processTeiRequest(u_int16_t ri, u_int8_t ai, bool pf);
13262
13267 void processTeiRemove(u_int8_t ai);
13268
13275 void processTeiCheckRequest(u_int8_t ai, bool pf);
13276
13282 void processTeiCheckResponse(u_int16_t ri, u_int8_t ai);
13283
13289 void processTeiAssigned(u_int16_t ri, u_int8_t ai);
13290
13295 void processTeiDenied(u_int16_t ri);
13296
13302 void processTeiVerify(u_int8_t ai, bool pf);
13303
13308 void sendTeiReq(u_int8_t tei);
13309
13314
13315private:
13316 ISDNQ921* m_layer2[127]; // The list of Layer 2 objects attached to this Layer 3
13317 SignallingTimer m_teiManTimer; // T202
13318 SignallingTimer m_teiTimer; // T201
13319};
13320
13326{
13328public:
13335 ISDNQ921Passive(const NamedList& params, const char* name = 0);
13336
13341
13347 virtual void cleanup();
13348
13354 virtual bool initialize(const NamedList* config);
13355
13361 inline void setDebug(bool printFrames, bool extendedDebug)
13362 { m_extendedDebug = ((m_printFrames = printFrames) && extendedDebug); }
13363
13364protected:
13368 virtual void destroyed()
13369 {
13371 TelEngine::destruct(SignallingReceiver::attach(0));
13373 }
13374
13380 virtual void timerTick(const Time& when);
13381
13388 virtual bool receivedPacket(const DataBlock& packet);
13389
13397
13398private:
13399 virtual bool control(NamedList& params)
13400 { return SignallingDumpable::control(params,this); }
13401 // Filter received frames. Accept only frames that would generate a notification to the upper layer:
13402 // UI/I, and Valid SABME/DISC/UA/DM
13403 // On success, if frame is not a data one, prepare cmd and value to notify layer 3
13404 bool acceptFrame(ISDNFrame* frame, bool& cmd, bool& value);
13405 // Show debug message. Count dropped frames
13406 bool dropFrame(const ISDNFrame* frame, const char* reason = 0);
13407
13408 bool m_checkLinkSide; // Check if this is the correct side of the data link
13409 SignallingTimer m_idleTimer; // Channel idle interval
13410 u_int8_t m_lastFrame; // Transmitter send number of the last received frame
13411 u_int32_t m_rxFrames; // The number of successfully parsed frames
13412 u_int32_t m_rxDroppedFrames; // The number of dropped frames. Doesn't include rejected frames
13413 u_int32_t m_hwErrors; // The number of hardware notifications
13414 bool m_printFrames; // Print frames to output
13415 bool m_extendedDebug; // Extended debug flag
13416 bool m_errorReceive; // Receive error
13417};
13418
13423class YSIG_API ISDNIUAClient : public SIGAdaptClient
13424{
13426public:
13430 inline ISDNIUAClient(const NamedList& params)
13431 : SIGAdaptClient(params.safe("ISDNIUAClient"),&params,1,9900)
13432 { }
13433
13434 virtual bool processMSG(unsigned char msgVersion, unsigned char msgClass,
13435 unsigned char msgType, const DataBlock& msg, int streamId);
13436};
13437
13444class YSIG_API ISDNIUA : public ISDNLayer2, public SIGAdaptUser
13445{
13446 friend class ISDNIUAClient;
13447 YCLASS(ISDNIUA,ISDNLayer2)
13448public:
13456 ISDNIUA(const NamedList& params, const char* name = 0, u_int8_t tei = 0);
13457
13461 virtual ~ISDNIUA();
13462
13468 virtual bool initialize(const NamedList* config);
13469
13478 virtual bool multipleFrame(u_int8_t tei, bool establish, bool force);
13479
13487 virtual bool sendData(const DataBlock& data, u_int8_t tei, bool ack);
13488
13492 virtual void cleanup();
13493
13498 virtual void activeChange(bool active);
13499
13504 inline int32_t iid() const
13505 { return m_iid; }
13506
13507protected:
13508 ISDNIUAClient* client() const
13509 { return static_cast<ISDNIUAClient*>(adaptation()); }
13510 virtual bool processMGMT(unsigned char msgType, const DataBlock& msg, int streamId);
13511 virtual bool processQPTM(unsigned char msgType, const DataBlock& msg, int streamId);
13512 int32_t m_iid;
13513};
13514
13519class YSIG_API ISDNQ931IE : public NamedList
13520{
13521 friend class ISDNQ931Message;
13522public:
13526 enum Type {
13527 // Fixed (1 byte) length information element
13528 Shift = 0x90, // Shift
13529 MoreData = 0xa0, // More data
13530 SendComplete = 0xa1, // Sending complete
13531 Congestion = 0xb0, // Congestion level
13532 Repeat = 0xd0, // Repeat indicator
13533 // Variable length information element
13534 Segmented = 0x00, // Segmented message
13535 BearerCaps = 0x04, // Bearer capability
13536 Cause = 0x08, // Cause
13537 CallIdentity = 0x10, // Call identity
13538 CallState = 0x14, // Call state
13539 ChannelID = 0x18, // Channel identification
13540 Progress = 0x1e, // Progress indicator
13541 NetFacility = 0x20, // Network-specific facilities
13542 Notification = 0x27, // Notification indicator
13543 Display = 0x28, // Display
13544 DateTime = 0x29, // Date/time
13545 Keypad = 0x2c, // Keypad facility
13546 Signal = 0x34, // Signal
13547 ConnectedNo = 0x4c, // Connected number (Q.951)
13548 CallingNo = 0x6c, // Calling party number
13549 CallingSubAddr = 0x6d, // Calling party subaddress
13550 CalledNo = 0x70, // Called party number
13551 CalledSubAddr = 0x71, // Called party subaddress
13552 NetTransit = 0x78, // Transit network selection
13553 Restart = 0x79, // Restart indicator
13554 LoLayerCompat = 0x7c, // Low layer compatibility
13555 HiLayerCompat = 0x7d, // High layer compatibility
13556 // Not used
13557 UserUser = 0x7e, // User-user
13558 Escape = 0x7f, // Escape for extension
13559 };
13560
13566 ISDNQ931IE(u_int16_t type);
13567
13571 virtual ~ISDNQ931IE();
13572
13577 inline u_int8_t type() const
13578 { return (u_int8_t)m_type; }
13579
13585 inline void addParamPrefix(const char* name, const char* value)
13586 { addParam(*this+"."+name,value); }
13587
13595 void toString(String& dest, bool extendedDebug, const char* before = 0);
13596
13603 static inline const char* typeName(int type, const char* defVal = 0)
13604 { return lookup(type,s_type,defVal); }
13605
13609 static const TokenDict s_type[];
13610
13615
13616private:
13617 u_int16_t m_type; // IE type
13618};
13619
13624class YSIG_API ISDNQ931Message : public SignallingMessage
13625{
13626public:
13630 enum Type {
13631 Alerting = 0x01, // ALERTING
13632 Proceeding = 0x02, // CALL PROCEEDING
13633 Connect = 0x07, // CONNECT
13634 ConnectAck = 0x0f, // CONNECT ACK
13635 Progress = 0x03, // PROGRESS
13636 Setup = 0x05, // SETUP
13637 SetupAck = 0x0d, // SETUP ACK
13638 Resume = 0x26, // RESUME
13639 ResumeAck = 0x2e, // RESUME ACK
13640 ResumeRej = 0x22, // RESUME REJECT
13641 Suspend = 0x25, // SUSPEND
13642 SuspendAck = 0x2d, // SUSPEND ACK
13643 SuspendRej = 0x21, // SUSPEND REJECT
13644 UserInfo = 0x20, // USER INFO
13645 Disconnect = 0x45, // DISCONNECT
13646 Release = 0x4d, // RELEASE
13647 ReleaseComplete = 0x5a, // RELEASE COMPLETE
13648 Restart = 0x46, // RESTART
13649 RestartAck = 0x4e, // RESTART ACK
13650 Segment = 0x60, // SEGMENT
13651 CongestionCtrl = 0x79, // CONGESTION CONTROL
13652 Info = 0x7b, // INFORMATION
13653 Notify = 0x6e, // NOTIFY
13654 Status = 0x7d, // STATUS
13655 StatusEnquiry = 0x75, // STATUS ENQUIRY
13656 };
13657
13667
13674
13682
13687
13692 inline Type type() const
13693 { return m_type; }
13694
13699 inline bool initiator() const
13700 { return m_initiator; }
13701
13706 inline u_int32_t callRef() const
13707 { return m_callRef; }
13708
13713 inline u_int8_t callRefLen() const
13714 { return m_callRefLen; }
13715
13720 inline bool dummyCallRef() const
13721 { return m_dummy; }
13722
13727 inline bool unknownMandatory() const
13728 { return m_unkMandatory; }
13729
13734 { m_unkMandatory = true; }
13735
13740 inline ObjList* ieList()
13741 { return &m_ie; }
13742
13750
13758
13766 inline const char* getIEValue(ISDNQ931IE::Type type, const char* param,
13767 const char* defVal = 0)
13768 {
13769 ISDNQ931IE* ie = getIE(type);
13770 return (ie ? ie->getValue(param?param:ie->c_str(),defVal) : defVal);
13771 }
13772
13780 inline ISDNQ931IE* appendIEValue(ISDNQ931IE::Type type, const char* param,
13781 const char* value)
13782 {
13783 ISDNQ931IE* ie = new ISDNQ931IE(type);
13784 ie->addParam(param?param:ie->c_str(),value);
13785 appendSafe(ie);
13786 return ie;
13787 }
13788
13794 inline bool append(ISDNQ931IE* ie)
13795 { return 0 != m_ie.append(ie); }
13796
13804
13812 void toString(String& dest, bool extendedDebug, const char* indent = 0) const;
13813
13819 virtual void* getObject(const String& name) const;
13820
13831 u_int8_t encode(ISDNQ931ParserData& parserData, ObjList& dest);
13832
13843 const DataBlock& buffer, DataBlock* segData);
13844
13850 static inline const char* typeName(int t)
13851 { return lookup(t,s_type,"Unknown"); }
13852
13856 static const TokenDict s_type[];
13857
13862
13863private:
13864 Type m_type; // Message type
13865 bool m_initiator; // The call initiator flag: True: this is the initiator
13866 u_int32_t m_callRef; // The call reference
13867 u_int8_t m_callRefLen; // The call reference length
13868 bool m_unkMandatory; // True if this message contains unknown mandatory IE(s)
13869 bool m_dummy; // True if this message has a dummy call reference
13870 ObjList m_ie; // IE list
13871};
13872
13877class YSIG_API ISDNQ931IEData
13878{
13879 friend class ISDNQ931Call;
13880 friend class ISDNQ931CallMonitor;
13881 friend class ISDNQ931;
13882 friend class ISDNQ931Monitor;
13883private:
13884 // Constructor
13885 ISDNQ931IEData(bool bri = false);
13886 // Process received IEs
13887 // If add is true, append an IE to the message
13888 // If add is false, extract data from message. Set data to default values if IE is missing
13889 // @return False if the IE is missing when decoding or the IE wasn't added
13890 bool processBearerCaps(ISDNQ931Message* msg, bool add, ISDNQ931ParserData* data = 0);
13891 bool processCause(ISDNQ931Message* msg, bool add, ISDNQ931ParserData* data = 0);
13892 bool processDisplay(ISDNQ931Message* msg, bool add, ISDNQ931ParserData* data = 0);
13893 bool processKeypad(ISDNQ931Message* msg, bool add, ISDNQ931ParserData* data = 0);
13894 bool processChannelID(ISDNQ931Message* msg, bool add, ISDNQ931ParserData* data = 0);
13895 bool processProgress(ISDNQ931Message* msg, bool add, ISDNQ931ParserData* data = 0);
13896 bool processRestart(ISDNQ931Message* msg, bool add, ISDNQ931ParserData* data = 0);
13897 bool processNotification(ISDNQ931Message* msg, bool add, ISDNQ931ParserData* data = 0);
13898 bool processCalledNo(ISDNQ931Message* msg, bool add, ISDNQ931ParserData* data = 0);
13899 bool processCallingNo(ISDNQ931Message* msg, bool add, ISDNQ931ParserData* data = 0);
13900
13901 // IE parameters
13902 String m_display; // Display: The data
13903 String m_callerNo; // CallingNo: Number
13904 String m_callerType; // CallingNo: Number type
13905 String m_callerPlan; // CallingNo: Number plan
13906 String m_callerPres; // CallingNo: Number presentation
13907 String m_callerScreening; // CallingNo: Number screening
13908 String m_calledNo; // CalledNo: Number
13909 String m_calledType; // CalledNo: Number type
13910 String m_calledPlan; // CalledNo: Number plan
13911 String m_transferCapability; // BearerCaps: Transfer capability
13912 String m_transferMode; // BearerCaps: Transfer mode
13913 String m_transferRate; // BearerCaps: Transfer rate
13914 String m_format; // BearerCaps: Layer 1 protocol
13915 String m_reason; // Cause
13916 String m_keypad; // Keypad: 'keypad' parameter
13917 String m_progress; // Progress: Progress description
13918 String m_notification; // Notify: Notification indicator
13919 bool m_bri; // ChannelID: BRI interface flag
13920 bool m_channelMandatory; // ChannelID: Indicated channel is mandatory/preferred
13921 bool m_channelByNumber; // ChannelID: m_channels contains a channel list or a slot map
13922 String m_channelType; // ChannelID: Channel type
13923 String m_channelSelect; // ChannelID: Channel select
13924 String m_channels; // ChannelID: Channel list or slot map
13925 String m_restart; // Restart: The class of restarting circuits
13926};
13927
13932class YSIG_API ISDNQ931State
13933{
13934public:
13938 enum State {
13939 // Common state
13940 Null = 0x00, // Null
13941 // Call states
13942 CallInitiated = 0x01, // Call initiated: sent SETUP
13943 OverlapSend = 0x02, // Overlap sending
13944 OutgoingProceeding = 0x03, // Outgoing call proceeding: received valid CALL PROCEEDING
13945 CallDelivered = 0x04, // Call delivered: received valid ALERTING
13946 CallPresent = 0x06, // Call present: received valid SETUP or recover from STATUS
13947 CallReceived = 0x07, // Call received: sent ALERTING or recover from STATUS
13948 ConnectReq = 0x08, // Connect request: sent/received valid CONNECT or recover from STATUS
13949 IncomingProceeding = 0x09, // Incoming call proceeding: sent CALL PROCEEDING or recover from STATUS
13950 Active = 0x0a, // Active: sent/received valid CONNECT ACK
13951 DisconnectReq = 0x0b, // Disconnect request: sent DISCONNECT
13952 DisconnectIndication = 0x0c, // Disconnect indication: received valid DISCONNECT
13953 SuspendReq = 0x0f, // Suspend request
13954 ResumeReq = 0x11, // Resume reques
13955 ReleaseReq = 0x13, // Release request: sent/received valid RELEASE
13956 CallAbort = 0x16, // Call abort: received STATUS in Null state with remote not in Null state
13957 OverlapRecv = 0x19, // Overlap receiving
13958 // Call controller states
13959 RestartReq = 0x3d, // Restart request
13960 Restart = 0x3e, // Restart
13961 };
13962
13966 inline ISDNQ931State() : m_state(Null)
13967 { }
13968
13973 inline State state() const
13974 { return m_state; }
13975
13981 static const char* stateName(u_int8_t s)
13982 { return lookup(s,s_states,0); }
13983
13987 static const TokenDict s_states[];
13988
13989protected:
13996 bool checkStateRecv(int type, bool* retrans);
13997
14003 bool checkStateSend(int type);
14004
14009
14010};
14011
14016class YSIG_API ISDNQ931Call : public ISDNQ931State, public SignallingCall
14017{
14018 friend class ISDNQ931;
14019public:
14023 virtual ~ISDNQ931Call();
14024
14029 inline u_int32_t callRef() const
14030 { return m_callRef; }
14031
14036 inline u_int32_t callRefLen() const
14037 { return m_callRefLen; }
14038
14043 inline u_int8_t callTei() const
14044 { return m_tei; }
14045
14051 { return m_circuit; }
14052
14059 void setTerminate(bool destroy, const char* reason);
14060
14067 virtual bool sendEvent(SignallingEvent* event);
14068
14075 virtual SignallingEvent* getEvent(const Time& when);
14076
14082 void dataLinkState(bool up);
14083
14089 virtual void* getObject(const String& name) const;
14090
14091protected:
14100 ISDNQ931Call(ISDNQ931* controller, bool outgoing, u_int32_t callRef,
14101 u_int8_t callRefLen, u_int8_t tei = 0);
14102
14111 SignallingEvent* releaseComplete(const char* reason = 0, const char* diag = 0);
14112
14119
14120private:
14121 // Reserve and connect a circuit. Change the reserved one if it must to
14122 bool reserveCircuit();
14123 // Process call when terminate flag is set. Check timeout
14124 // @param msg Optional message extracted from queue
14125 SignallingEvent* processTerminate(ISDNQ931Message* msg = 0);
14126 // Check timer(s)
14127 SignallingEvent* checkTimeout(u_int64_t time);
14128 // Check received messages for valid state
14129 // True to send status if not accepted
14130 bool checkMsgRecv(ISDNQ931Message* msg, bool status);
14131 // Process received messages
14132 // @param msg Valid ISDNQ931Message pointer
14133 SignallingEvent* processMsgAlerting(ISDNQ931Message* msg);
14134 SignallingEvent* processMsgCallProceeding(ISDNQ931Message* msg);
14135 SignallingEvent* processMsgConnect(ISDNQ931Message* msg);
14136 SignallingEvent* processMsgConnectAck(ISDNQ931Message* msg);
14137 SignallingEvent* processMsgDisconnect(ISDNQ931Message* msg);
14138 SignallingEvent* processMsgInfo(ISDNQ931Message* msg);
14139 SignallingEvent* processMsgNotify(ISDNQ931Message* msg);
14140 SignallingEvent* processMsgProgress(ISDNQ931Message* msg);
14141 SignallingEvent* processMsgRelease(ISDNQ931Message* msg);
14142 SignallingEvent* processMsgSetup(ISDNQ931Message* msg);
14143 SignallingEvent* processMsgSetupAck(ISDNQ931Message* msg);
14144 SignallingEvent* processMsgStatus(ISDNQ931Message* msg);
14145 SignallingEvent* processMsgStatusEnquiry(ISDNQ931Message* msg);
14146 // Send message
14147 // @param msg Pointer to SignallingMessage with parameters
14148 bool sendAlerting(SignallingMessage* sigMsg);
14149 bool sendCallProceeding(SignallingMessage* sigMsg);
14150 bool sendConnect(SignallingMessage* sigMsg);
14151 bool sendConnectAck(SignallingMessage* sigMsg);
14152 bool sendDisconnect(SignallingMessage* sigMsg);
14153 bool sendInfo(SignallingMessage* sigMsg);
14154 bool sendProgress(SignallingMessage* sigMsg);
14155 bool sendRelease(const char* reason = 0, SignallingMessage* sigMsg = 0);
14156 bool sendReleaseComplete(const char* reason = 0, const char* diag = 0, u_int8_t tei = 0);
14157 bool sendSetup(SignallingMessage* sigMsg);
14158 bool sendSuspendRej(const char* reason = 0, SignallingMessage* sigMsg = 0);
14159 bool sendSetupAck();
14160 // Errors on processing received messages
14161 // Missing mandatory IE
14162 // @param release True to send release complete and generate a release event
14163 SignallingEvent* errorNoIE(ISDNQ931Message* msg, ISDNQ931IE::Type type, bool release);
14164 SignallingEvent* errorWrongIE(ISDNQ931Message* msg, ISDNQ931IE::Type type, bool release);
14165 // Change call state
14166 void changeState(State newState);
14167 // Remove the call from controller's list
14168 void removeFromController();
14169 // Get the Q931 call controller
14170 inline ISDNQ931* q931();
14171
14172 // Call data
14173 u_int32_t m_callRef; // Call reference
14174 u_int32_t m_callRefLen; // Call reference length
14175 u_int8_t m_tei; // TEI used for the call
14176 SignallingCircuit* m_circuit; // Circuit reserved for this call
14177 bool m_circuitChange; // True if circuit changed
14178 bool m_channelIDSent; // Incoming calls: ChannelID IE already sent
14179 bool m_rspBearerCaps; // Incoming calls: Send BearerCaps IE in the first response
14180 bool m_inbandAvailable; // Inband data is available
14181 bool m_net; // Flag indicating call is sent by a NT
14182 ISDNQ931IEData m_data; // Data to process IEs
14183 ObjList m_inMsg; // Incoming message queue
14184 bool m_broadcast[127]; // TEIs that answered to PTMP SETUP
14185 // Timers
14186 SignallingTimer m_discTimer; // T305: sending DISCONNECT
14187 SignallingTimer m_relTimer; // T308: sending RELEASE
14188 SignallingTimer m_conTimer; // T313: sending CONNECT
14189 SignallingTimer m_overlapSendTimer; // T302 for overlapped sending
14190 SignallingTimer m_overlapRecvTimer; // T304
14191 SignallingTimer m_retransSetupTimer; // T302 for setup retransmission (PTMP)
14192 // Termination
14193 bool m_terminate; // Terminate flag: send RELEASE
14194 bool m_destroy; // Destroy flag: call releaseComplete()
14195 bool m_destroyed; // Call destroyed flag
14196};
14197
14202class YSIG_API ISDNQ931CallMonitor : public ISDNQ931State, public SignallingCall
14203{
14204 friend class ISDNQ931Monitor;
14205public:
14210
14215 inline bool netInit() const
14216 { return m_netInit; }
14217
14224 virtual SignallingEvent* getEvent(const Time& when);
14225
14231 void setTerminate(const char* reason);
14232
14238 virtual void* getObject(const String& name) const;
14239
14240protected:
14247 ISDNQ931CallMonitor(ISDNQ931Monitor* controller, u_int32_t callRef, bool netInit);
14248
14255 SignallingEvent* releaseComplete(const char* reason = 0);
14256
14257private:
14258 // Get an event from one of the reserved circuits
14259 SignallingEvent* getCircuitEvent(const Time& when);
14260 // Process received setup message
14261 SignallingEvent* processMsgSetup(ISDNQ931Message* msg);
14262 // Process received responses to setup message (Proceeding, Alerting, Connect)
14263 SignallingEvent* processMsgResponse(ISDNQ931Message* msg);
14264 // Process termination messages (Disconnect, Release, Release Complete)
14265 SignallingEvent* processMsgTerminate(ISDNQ931Message* msg);
14266 // Process INFORMATION messages to get tones
14267 SignallingEvent* processMsgInfo(ISDNQ931Message* msg);
14268 // Reserve/release the circuits
14269 bool reserveCircuit();
14270 void releaseCircuit();
14271 // Connect the caller's or called's circuit
14272 bool connectCircuit(bool caller);
14273 // Change call state
14274 void changeState(State newState);
14275 // Remove the call from controller's list
14276 void removeFromController();
14277 // Get the Q931Monitor call controller
14278 inline ISDNQ931Monitor* q931();
14279
14280 u_int32_t m_callRef; // Call reference
14281 SignallingCircuit* m_callerCircuit; // Circuit reserved for caller
14282 SignallingCircuit* m_calledCircuit; // Circuit reserved for called
14283 SignallingCircuit* m_eventCircuit; // Last circuit that generated an event
14284 bool m_netInit; // The call initiator is from the network side of the link
14285 bool m_circuitChange; // True if circuit changed
14286 ISDNQ931IEData m_data; // Data to process IEs
14287 bool m_terminate; // Terminate flag
14288 String m_terminator; // The name of the entity that terminated the call
14289 ObjList m_inMsg; // Incoming messages queue
14290};
14291
14297{
14298public:
14305
14311 inline bool flag(int mask) const
14312 { return (0 != (m_flags & mask)); }
14313
14314 DebugEnabler* m_dbg; // The debug enabler used for output
14315 u_int32_t m_maxMsgLen; // Maximum length of outgoing messages (or message segments)
14316 int m_flags; // The current behaviour flags
14317 int m_flagsOrig; // The original behaviour flags
14318 u_int8_t m_maxDisplay; // Max Display IE size
14319 bool m_allowSegment; // True if message segmentation is allowed
14320 u_int8_t m_maxSegments; // Maximum allowed segments for outgoing messages
14321 bool m_extendedDebug; // True to fill message/IE buffer
14322};
14323
14328class YSIG_API ISDNQ931 : public SignallingCallControl, public SignallingDumpable, public ISDNLayer3
14329{
14330 YCLASS(ISDNQ931,ISDNLayer3)
14331 friend class ISDNQ931Call;
14332public:
14338 // Append the progress indicator 'non-isdn-source' if present when
14339 // sending SETUP. If this flag is not set, the indicator will be
14340 // removed from the message
14341 SendNonIsdnSource = 0x00000001,
14342 // Ignore (don't send) the progress indicator 'non-isdn-destination'
14343 // if present when sending SETUP ACKNOWLEDGE or CONNECT
14344 IgnoreNonIsdnDest = 0x00000002,
14345 // Always set presentation='allowed' and screening='network-provided'
14346 // for Calling Party Number IE
14347 ForcePresNetProv = 0x00000004,
14348 // Translate '3.1khz-audio' transfer capability code 0x10 to/from 0x08
14349 Translate31kAudio = 0x00000008,
14350 // Send only transfer mode and rate when sending the Bearer Capability IE
14351 // with transfer capability 'udi' or 'rdi' (unrestricted/restricted
14352 // digital information)
14353 URDITransferCapsOnly = 0x00000010,
14354 // Don't send Layer 1 capabilities (data format) with the
14355 // Bearer Capability IE when in circuit switch mode
14356 NoLayer1Caps = 0x00000020,
14357 // Don't parse incoming IEs found after a temporary (non-locking) shift
14358 IgnoreNonLockedIE = 0x00000040,
14359 // Don't send the Display IE
14360 // This flag is internally set for EuroIsdnE1 type when the call
14361 // controller is the CPE side of the link
14362 NoDisplayIE = 0x00000080,
14363 // Don't append a charset byte 0xb1 before Display data
14364 NoDisplayCharset = 0x00000100,
14365 // Send a Sending Complete IE even if no overlap dialing
14366 ForceSendComplete = 0x00000200,
14367 // Don't change call state to Active instead of ConnectRequest after
14368 // sending CONNECT. This flag is internally set when the call
14369 // controller is the CPE side of the data link
14370 NoActiveOnConnect = 0x00000400,
14371 // Check the validity of the notification indicator when sending a NOTIFY message
14372 CheckNotifyInd = 0x00000800,
14373 // Request an outbound PRI channel to be exclusive
14374 ChannelExclusive = 0x00001000,
14375 };
14376
14381 Unknown = 0,
14382 // Standard Euro ISDN (CTR4, ETSI 300-102)
14383 EuroIsdnE1 = ForceSendComplete|CheckNotifyInd|NoDisplayCharset|URDITransferCapsOnly,
14384 // T1 Euro ISDN variant (ETSI 300-102)
14385 EuroIsdnT1 = ForceSendComplete|CheckNotifyInd,
14386 // National ISDN
14387 NationalIsdn = SendNonIsdnSource,
14388 // DMS 100
14389 Dms100 = ForcePresNetProv|IgnoreNonIsdnDest,
14390 // Lucent 5E
14391 Lucent5e = IgnoreNonLockedIE,
14392 // AT&T 4ESS
14393 Att4ess = ForcePresNetProv|IgnoreNonLockedIE|Translate31kAudio|NoLayer1Caps,
14394 // QSIG Switch
14395 QSIG = NoActiveOnConnect|NoDisplayIE|NoDisplayCharset
14396 };
14397
14404 ISDNQ931(const NamedList& params, const char* name = 0);
14405
14410 virtual ~ISDNQ931();
14411
14417 virtual bool initialize(const NamedList* config);
14418
14423 virtual const char* statusName() const;
14424
14429 inline const ISDNLayer2* layer2() const
14430 { return m_q921; }
14431
14436 inline bool primaryRate() const
14437 { return m_primaryRate; }
14438
14443 inline bool network() const
14444 { return m_q921 ? m_q921->network() : m_networkHint; }
14445
14450 inline bool transferModeCircuit() const
14451 { return m_transferModeCircuit; }
14452
14458 { return m_parserData; }
14459
14464 inline const String& numPlan() const
14465 { return m_numPlan; }
14466
14471 inline const String& numType() const
14472 { return m_numType; }
14473
14478 inline const String& numPresentation() const
14479 { return m_numPresentation; }
14480
14485 inline const String& numScreening() const
14486 { return m_numScreening; }
14487
14492 inline const String& format() const
14493 { return m_format; }
14494
14502 bool sendMessage(ISDNQ931Message* msg, u_int8_t tei, String* reason = 0);
14503
14512 virtual void multipleFrameEstablished(u_int8_t tei, bool confirm, bool timeout, ISDNLayer2* layer2);
14513
14522 virtual void multipleFrameReleased(u_int8_t tei, bool confirm, bool timeout, ISDNLayer2* layer2);
14523
14530 virtual void receiveData(const DataBlock& data, u_int8_t tei, ISDNLayer2* layer2);
14531
14539
14546 SignallingCall* call(SignallingMessage* msg, String& reason);
14547
14553 bool restart(const char* circuits);
14554
14564 inline bool sendStatus(ISDNQ931Call* call, const char* cause, u_int8_t tei = 0,
14565 const char* display = 0, const char* diagnostic = 0)
14566 {
14567 return call && sendStatus(cause,call->callRefLen(),call->callRef(),tei,
14568 call->outgoing(),call->state(),display,diagnostic);
14569 }
14570
14582 inline bool sendRelease(ISDNQ931Call* call, bool release, const char* cause, u_int8_t tei = 0,
14583 const char* diag = 0, const char* display = 0, const char* signal = 0)
14584 {
14585 return call && sendRelease(release,call->callRefLen(),call->callRef(),tei,
14586 call->outgoing(),cause,diag,display,signal);
14587 }
14588
14594 virtual void cleanup(const char* reason = "offline");
14595
14602 void setInterval(SignallingTimer& timer, int id);
14603
14608
14614 inline void setDebug(bool printMsg, bool extendedDebug)
14615 { m_parserData.m_extendedDebug = m_extendedDebug =
14616 ((m_printMsg = printMsg) && extendedDebug); }
14617
14621 static const TokenDict s_flags[];
14622
14626 static const TokenDict s_swType[];
14627
14628protected:
14632 virtual void destroyed()
14633 {
14634 TelEngine::destruct(attach(0));
14635 TelEngine::destruct(SignallingCallControl::attach(0));
14637 }
14638
14644 virtual void timerTick(const Time& when);
14645
14653 ISDNQ931Call* findCall(u_int32_t callRef, bool outgoing, u_int8_t tei = 0);
14654
14660 ISDNQ931Call* findCall(unsigned int circuit);
14661
14667 void terminateCalls(ObjList* list, const char* reason);
14668
14675 bool acceptNewCall(bool outgoing, String& reason);
14676
14683
14691 ISDNQ931Message* endReceiveSegment(const char* reason = 0);
14692
14698 void processGlobalMsg(ISDNQ931Message* msg, u_int8_t tei = 0);
14699
14705 void processMsgRestart(ISDNQ931Message* msg, u_int8_t tei = 0);
14706
14712 void processInvalidMsg(ISDNQ931Message* msg, u_int8_t tei = 0);
14713
14721 void sendRestart(u_int64_t time = Time::msecNow(), bool retrans = false);
14722
14730 void endRestart(bool restart, u_int64_t time, bool timeout = false);
14731
14744 bool sendStatus(const char* cause, u_int8_t callRefLen, u_int32_t callRef = 0,
14745 u_int8_t tei = 0, bool initiator = false, ISDNQ931Call::State state = ISDNQ931Call::Null,
14746 const char* display = 0, const char* diagnostic = 0);
14747
14761 bool sendRelease(bool release, u_int8_t callRefLen, u_int32_t callRef, u_int8_t tei,
14762 bool initiator, const char* cause = 0, const char* diag = 0,
14763 const char* display = 0, const char* signal = 0);
14764
14765private:
14766 virtual bool control(NamedList& params)
14767 { return SignallingDumpable::control(params,this); }
14768 bool q921Up() const; // Check if layer 2 may be up
14769 ISDNLayer2* m_q921; // The attached layer 2
14770 bool m_q921Up; // Layer 2 state
14771 // Protocol data
14772 bool m_networkHint; // NET / CPE hint, layer 2 is authoritative
14773 bool m_primaryRate; // Primary/base rate support
14774 bool m_transferModeCircuit; // Circuit switch/packet mode transfer
14775 u_int32_t m_callRef; // Current available call reference for outgoing calls
14776 u_int8_t m_callRefLen; // Call reference length
14777 u_int32_t m_callRefMask; // Call reference mask
14778 ISDNQ931ParserData m_parserData; // Parser settings
14779 ISDNQ931IEData m_data; // Process IEs
14780 // Timers & counters
14781 SignallingTimer m_l2DownTimer; // T309: Layer 2 is down timeout
14782 SignallingTimer m_recvSgmTimer; // T314: Receive segment timeout
14783 SignallingTimer m_syncCicTimer; // T316: Restart individual circuit timeout
14784 SignallingCounter m_syncCicCounter; // RESTART retransmission counter
14785 SignallingTimer m_callDiscTimer; // Q931 call value (see ISDQ931Call)
14786 SignallingTimer m_callRelTimer; // Q931 call value (see ISDQ931Call)
14787 SignallingTimer m_callConTimer; // Q931 call value (see ISDQ931Call)
14788 // Default values
14789 String m_numPlan; // Numbering plan
14790 String m_numType; // Number type
14791 String m_numPresentation; // Number presentation
14792 String m_numScreening; // Number screening
14793 String m_format; // Data format
14794 String m_cpeNumber; // The number of the BRI CPE
14795 // Restart data
14796 SignallingCircuit* m_restartCic; // Currently restarting circuit
14797 unsigned int m_lastRestart; // Last restarted circuit's code
14798 SignallingTimer m_syncGroupTimer; // Restarting circuit group interval
14799 // Message segmentation data
14800 DataBlock m_segmentData; // Message segments buffer
14801 ISDNQ931Message* m_segmented; // Segmented message
14802 u_int8_t m_remaining; // Remaining segments
14803 // Debug
14804 bool m_printMsg; // True to print messages to output
14805 bool m_extendedDebug; // Extended debug flag
14806 // Flags used to print error messages
14807 bool m_flagQ921Down; // Layer 2 is down period timed out
14808 bool m_flagQ921Invalid; // Refusing to send message when Layer 2 is missing or down
14809};
14810
14815class YSIG_API ISDNQ931Monitor : public SignallingCallControl, public ISDNLayer3
14816{
14818 friend class ISDNQ931CallMonitor;
14819public:
14826 ISDNQ931Monitor(const NamedList& params, const char* name = 0);
14827
14833
14839 virtual bool initialize(const NamedList* config);
14840
14845 virtual const char* statusName() const;
14846
14857 virtual void dataLinkState(u_int8_t tei, bool cmd, bool value, ISDNLayer2* layer2);
14858
14863 virtual void idleTimeout(ISDNLayer2* layer2);
14864
14871 virtual void receiveData(const DataBlock& data, u_int8_t tei, ISDNLayer2* layer2);
14872
14880 virtual ISDNQ921Passive* attach(ISDNQ921Passive* q921, bool net);
14881
14890
14896 inline ISDNQ921Passive* circuits(bool net) const
14897 { return net ? m_q921Net : m_q921Cpe; }
14898
14904 inline void setDebug(bool printMsg, bool extendedDebug)
14905 { m_parserData.m_extendedDebug = m_extendedDebug =
14906 ((m_printMsg = printMsg) && extendedDebug); }
14907
14913 virtual void cleanup(const char* reason = "offline")
14914 { terminateMonitor(0,reason); }
14915
14922 void terminateMonitor(ISDNQ931CallMonitor* mon, const char* reason);
14923
14924protected:
14928 virtual void destroyed()
14929 {
14930 TelEngine::destruct(SignallingCallControl::attach(0));
14931 TelEngine::destruct(attach((ISDNQ921Passive*)0,true));
14932 TelEngine::destruct(attach((ISDNQ921Passive*)0,false));
14934 attach((SignallingCircuitGroup*)0,false);
14936 }
14937
14943 virtual void timerTick(const Time& when);
14944
14956 bool reserveCircuit(unsigned int code, bool netInit,
14957 SignallingCircuit** caller, SignallingCircuit** called);
14958
14966
14973
14974private:
14975 // Find a call monitor by call reference or reserved circuit
14976 // @return Referenced call monitor pointer or 0 if not found
14977 ISDNQ931CallMonitor* findMonitor(unsigned int value, bool byCallRef);
14978 // Drop some messages. Return true if the message should be dropped
14979 bool dropMessage(const ISDNQ931Message* msg);
14980
14981 ISDNQ921Passive* m_q921Net; // Net side of the link
14982 ISDNQ921Passive* m_q921Cpe; // CPE side of the link
14983 SignallingCircuitGroup* m_cicNet; // Circuit group for the net side of the link
14984 SignallingCircuitGroup* m_cicCpe; // Circuit group for the cpe side of the link
14985 ISDNQ931ParserData m_parserData; // Parser settings
14986 ISDNQ931IEData m_data; // Process IEs
14987 // Debug
14988 bool m_printMsg; // True to print messages to output
14989 bool m_extendedDebug; // Extended debug flag
14990};
14991
14992}
14993
14994#endif /* __YATESIG_H */
14995
14996/* vi: set ts=8 sw=4 sts=4 noet: */
Abstract SS7 ASP user interface.
Definition yatesig.h:5158
A single analog line related event.
Definition yatesig.h:3328
AnalogLineEvent(AnalogLine *line, SignallingCircuitEvent *event)
Definition yatesig.h:3335
virtual ~AnalogLineEvent()
Definition yatesig.h:3342
virtual void destruct()
Definition yatesig.h:3365
SignallingCircuitEvent * event()
Definition yatesig.h:3359
AnalogLine * line()
Definition yatesig.h:3352
AnalogLineGroup(const char *name, AnalogLineGroup *fxo)
bool appendLine(AnalogLine *line, bool destructOnFail=true)
ObjList & lines()
Definition yatesig.h:3418
virtual void destroyed()
bool slave()
Definition yatesig.h:3432
virtual ~AnalogLineGroup()
virtual AnalogLineEvent * getEvent(const Time &when)
void removeLine(AnalogLine *line)
AnalogLine * findLine(unsigned int cic)
AnalogLineGroup(AnalogLine::Type type, const char *name, bool slave=false)
ObjList m_lines
Definition yatesig.h:3485
void removeLine(unsigned int cic)
AnalogLineGroup * fxo()
Definition yatesig.h:3425
AnalogLine::Type type() const
Definition yatesig.h:3411
AnalogLine * findLine(const String &address)
An analog line.
Definition yatesig.h:2982
u_int64_t delayDial() const
Definition yatesig.h:3143
void * userdata() const
Definition yatesig.h:3157
bool resetCircuit()
Definition yatesig.h:3190
virtual void checkTimeouts(const Time &when)
Definition yatesig.h:3258
u_int64_t noRingTimeout() const
Definition yatesig.h:3129
Type
Definition yatesig.h:2989
bool sendEvent(SignallingCircuitEvent::Type type, NamedList *params=0)
void resetEcho(bool train)
virtual ~AnalogLine()
bool answerOnPolarity() const
Definition yatesig.h:3094
virtual void destroyed()
bool changeState(State newState, bool sync=false)
bool sendEvent(SignallingCircuitEvent::Type type, State newState, NamedList *params=0)
Definition yatesig.h:3231
void userdata(void *data, bool sync=true)
Definition yatesig.h:3165
AnalogLine(AnalogLineGroup *grp, unsigned int cic, const NamedList &params)
void acceptPulseDigit(bool ok)
Definition yatesig.h:3150
bool setCircuitParam(const char *param, const char *value=0)
Definition yatesig.h:3199
AnalogLineGroup * group()
Definition yatesig.h:3052
virtual AnalogLineEvent * getEvent(const Time &when)
State
Definition yatesig.h:3000
SignallingCircuit * circuit()
Definition yatesig.h:3073
u_int64_t callSetupTimeout() const
Definition yatesig.h:3122
void setPeer(AnalogLine *line=0, bool sync=true)
bool disconnect(bool sync)
bool enable(bool ok, bool sync, bool connectNow=true)
bool connect(bool sync)
const char * address() const
Definition yatesig.h:3080
virtual AnalogLineEvent * getMonitorEvent(const Time &when)
virtual const String & toString() const
Definition yatesig.h:3177
bool polarityControl() const
Definition yatesig.h:3108
bool hangupOnPolarity() const
Definition yatesig.h:3101
State state() const
Definition yatesig.h:3045
CallSetupInfo
Definition yatesig.h:3014
u_int64_t alarmTimeout() const
Definition yatesig.h:3136
Type type() const
Definition yatesig.h:3038
static const TokenDict * typeNames()
static const TokenDict * csNames()
AnalogLine * getPeer()
Definition yatesig.h:3059
bool outbandDtmf() const
Definition yatesig.h:3087
CallSetupInfo callSetup() const
Definition yatesig.h:3115
static const TokenDict * stateNames()
A class that holds just a block of raw data.
Definition yateclass.h:4237
int at(unsigned int offs, int defvalue=-1) const
Definition yateclass.h:4307
bool null() const
Definition yateclass.h:4314
void * data() const
Definition yateclass.h:4289
DataBlock & operator=(const DataBlock &value)
unsigned int length() const
Definition yateclass.h:4321
DataBlock & assign(void *value, unsigned int len, bool copyData=true, unsigned int allocated=0)
DataBlock(unsigned int overAlloc=0)
A holder for a debug level.
Definition yateclass.h:312
DebugEnabler(int level=TelEngine::debugLevel(), bool enabled=true)
Definition yateclass.h:319
int debugLevel() const
Definition yateclass.h:330
Abstract SS7 SCCP GTT interface.
Definition yatesig.h:5166
SCCP * sccp() const
Definition yatesig.h:5210
virtual ~GTT()
virtual void destroyed()
virtual NamedList * routeGT(const NamedList &gt, const String &prefix, const String &nextPrefix)
virtual bool initialize(const NamedList *config)
virtual void updateTables(const NamedList &params)
Definition yatesig.h:5203
GTT(const NamedList &config)
virtual void attach(SCCP *sccp)
virtual void destruct()
MSU handling result codes (Q.704 15.17.5 and more)
Definition yatesig.h:4162
bool ok() const
Definition yatesig.h:4249
HandledMSU(const HandledMSU &original)
Definition yatesig.h:4193
HandledMSU & operator=(Result result)
Definition yatesig.h:4200
bool operator==(const HandledMSU &result)
Definition yatesig.h:4221
bool operator!=(const HandledMSU &result)
Definition yatesig.h:4235
HandledMSU(Result result=Rejected)
Definition yatesig.h:4179
bool operator==(Result result)
Definition yatesig.h:4214
unsigned char upu() const
Definition yatesig.h:4256
bool operator!=(Result result)
Definition yatesig.h:4228
HandledMSU(bool success)
Definition yatesig.h:4186
HandledMSU & operator=(const HandledMSU &original)
Definition yatesig.h:4207
An ISDN frame.
Definition yatesig.h:12549
void sent(bool value)
Definition yatesig.h:12703
Type
Definition yatesig.h:12556
static u_int8_t getType(const DataBlock &data)
Definition yatesig.h:12752
Type error() const
Definition yatesig.h:12620
static bool isCommand(u_int8_t cr, bool sentByNetwork)
Definition yatesig.h:12807
ISDNFrame(Type type, bool command, bool senderNetwork, u_int8_t sapi, u_int8_t tei, bool pf, u_int8_t nr=0)
bool checkTeiManagement() const
static ISDNFrame * parse(const DataBlock &data, ISDNLayer2 *receiver)
u_int8_t sapi() const
Definition yatesig.h:12641
bool sent() const
Definition yatesig.h:12697
ISDNFrame(Type type=Invalid)
const DataBlock & buffer() const
Definition yatesig.h:12690
u_int8_t tei() const
Definition yatesig.h:12648
TeiManagement
Definition yatesig.h:12584
ISDNFrame(bool ack, bool senderNetwork, u_int8_t sapi, u_int8_t tei, bool pf, const DataBlock &data)
u_int8_t ns() const
Definition yatesig.h:12662
virtual ~ISDNFrame()
static bool commandBit(bool network)
Definition yatesig.h:12789
static bool buildTeiManagement(DataBlock &data, u_int8_t type, u_int16_t ri, u_int8_t ai)
Category category() const
Definition yatesig.h:12627
static bool responseBit(bool network)
Definition yatesig.h:12798
static u_int8_t getAi(const DataBlock &data)
Definition yatesig.h:12760
const char * name() const
Definition yatesig.h:12710
bool command() const
Definition yatesig.h:12634
u_int8_t headerLength() const
Definition yatesig.h:12676
Category
Definition yatesig.h:12597
u_int32_t dataLength() const
Definition yatesig.h:12683
void getData(DataBlock &dest) const
Definition yatesig.h:12724
u_int8_t nr() const
Definition yatesig.h:12669
void update(u_int8_t *ns=0, u_int8_t *nr=0)
void toString(String &dest, bool extendedDebug) const
bool poll() const
Definition yatesig.h:12655
Type type() const
Definition yatesig.h:12613
static const char * typeName(Type type)
Definition yatesig.h:12815
static u_int16_t getRi(const DataBlock &data)
static const TokenDict s_types[]
Definition yatesig.h:12821
Client side of SIGTRAN ISDN Q.921 UA.
Definition yatesig.h:13424
virtual bool processMSG(unsigned char msgVersion, unsigned char msgClass, unsigned char msgType, const DataBlock &msg, int streamId)
ISDNIUAClient(const NamedList &params)
Definition yatesig.h:13430
virtual void cleanup()
virtual ~ISDNIUA()
virtual bool initialize(const NamedList *config)
virtual bool sendData(const DataBlock &data, u_int8_t tei, bool ack)
int32_t iid() const
Definition yatesig.h:13504
virtual bool multipleFrame(u_int8_t tei, bool establish, bool force)
ISDNIUA(const NamedList &params, const char *name=0, u_int8_t tei=0)
virtual void activeChange(bool active)
Abstract ISDN layer 2 (Q.921) message transport.
Definition yatesig.h:12194
bool detectType() const
Definition yatesig.h:12237
void teiAssigned(bool status)
u_int8_t localSapi() const
Definition yatesig.h:12244
static const char * stateName(State s)
Definition yatesig.h:12324
void changeState(State newState, const char *reason=0)
void setRi(u_int16_t ri)
Definition yatesig.h:12422
u_int32_t maxUserData() const
Definition yatesig.h:12258
bool network() const
Definition yatesig.h:12230
virtual ~ISDNLayer2()
bool changeType()
State
Definition yatesig.h:12201
ISDNLayer3 * layer3() const
Definition yatesig.h:12216
virtual void attach(ISDNLayer3 *layer3)
Mutex & l2Mutex()
Definition yatesig.h:12341
ISDNLayer2(const NamedList &params, const char *name=0, u_int8_t tei=0)
ISDNFrame * parsePacket(const DataBlock &packet)
bool autoRestart() const
Definition yatesig.h:12272
virtual void cleanup()=0
virtual bool sendData(const DataBlock &data, u_int8_t tei, bool ack)
Definition yatesig.h:12302
void dataLinkState(u_int8_t tei, bool cmd, bool value)
void multipleFrameEstablished(u_int8_t tei, bool confirm, bool timeout)
virtual bool multipleFrame(u_int8_t tei, bool establish, bool force)
Definition yatesig.h:12291
State state() const
Definition yatesig.h:12223
u_int8_t localTei() const
Definition yatesig.h:12251
void autoRestart(bool restart)
Definition yatesig.h:12415
unsigned int upTime() const
Definition yatesig.h:12279
void receiveData(const DataBlock &data, u_int8_t tei)
bool teiAssigned() const
Definition yatesig.h:12265
void multipleFrameReleased(u_int8_t tei, bool confirm, bool timeout)
void idleTimeout()
Abstract ISDN layer 3 (Q.931) message transport.
Definition yatesig.h:12456
virtual void multipleFrameEstablished(u_int8_t tei, bool confirm, bool timeout, ISDNLayer2 *layer2)
Definition yatesig.h:12468
ISDNLayer3(const char *name=0)
Definition yatesig.h:12528
virtual void dataLinkState(u_int8_t tei, bool cmd, bool value, ISDNLayer2 *layer2)
Definition yatesig.h:12494
virtual void multipleFrameReleased(u_int8_t tei, bool confirm, bool timeout, ISDNLayer2 *layer2)
Definition yatesig.h:12480
virtual void receiveData(const DataBlock &data, u_int8_t tei, ISDNLayer2 *layer2)=0
virtual void idleTimeout(ISDNLayer2 *layer2)
Definition yatesig.h:12502
Mutex & l3Mutex()
Definition yatesig.h:12537
virtual ISDNLayer2 * attach(ISDNLayer2 *layer2)
Definition yatesig.h:12519
ISDN Layer 2 BRI TEI management or PRI with D-channel(s) backup.
Definition yatesig.h:13103
virtual void multipleFrameEstablished(u_int8_t tei, bool confirm, bool timeout, ISDNLayer2 *layer2)
void processTeiCheckRequest(u_int8_t ai, bool pf)
virtual void cleanup()
virtual bool notify(SignallingInterface::Notification event)
bool processTeiManagement(ISDNFrame *frame)
void processTeiVerify(u_int8_t ai, bool pf)
void processTeiRequest(u_int16_t ri, u_int8_t ai, bool pf)
virtual ~ISDNQ921Management()
bool sendTeiManagement(ISDNFrame::TeiManagement type, u_int16_t ri, u_int8_t ai, u_int8_t tei=127, bool pf=false)
void processTeiAssigned(u_int16_t ri, u_int8_t ai)
virtual void dataLinkState(u_int8_t tei, bool cmd, bool value, ISDNLayer2 *layer2)
virtual void multipleFrameReleased(u_int8_t tei, bool confirm, bool timeout, ISDNLayer2 *layer2)
virtual void engine(SignallingEngine *eng)
void sendTeiReq(u_int8_t tei)
void processTeiRemove(u_int8_t ai)
virtual void receiveData(const DataBlock &data, u_int8_t tei, ISDNLayer2 *layer2)
bool sendFrame(const ISDNFrame *frame, const ISDNQ921 *q921=0)
virtual bool initialize(const NamedList *config)
virtual bool sendData(const DataBlock &data, u_int8_t tei, bool ack)
void processTeiDenied(u_int16_t ri)
virtual bool multipleFrame(u_int8_t tei, bool establish, bool force)
void processTeiCheckResponse(u_int16_t ri, u_int8_t ai)
virtual void timerTick(const Time &when)
ISDNQ921Management(const NamedList &params, const char *name=0, bool net=true)
virtual bool receivedPacket(const DataBlock &packet)
Stateless pasive ISDN Q.921 implementation on top of a hardware interface.
Definition yatesig.h:13326
virtual void cleanup()
virtual bool notify(SignallingInterface::Notification event)
virtual void destroyed()
Definition yatesig.h:13368
void setDebug(bool printFrames, bool extendedDebug)
Definition yatesig.h:13361
virtual ~ISDNQ921Passive()
ISDNQ921Passive(const NamedList &params, const char *name=0)
virtual bool initialize(const NamedList *config)
virtual void timerTick(const Time &when)
virtual bool receivedPacket(const DataBlock &packet)
ISDN Q.921 implementation on top of a hardware interface.
Definition yatesig.h:12888
virtual ~ISDNQ921()
virtual void cleanup()
bool receivedFrame(ISDNFrame *frame)
virtual bool notify(SignallingInterface::Notification event)
virtual void destroyed()
Definition yatesig.h:12970
void setDebug(bool printFrames, bool extendedDebug)
Definition yatesig.h:12963
virtual bool initialize(const NamedList *config)
virtual bool sendData(const DataBlock &data, u_int8_t tei, bool ack)
u_int64_t dataTimeout() const
Definition yatesig.h:12918
virtual bool multipleFrame(u_int8_t tei, bool establish, bool force)
virtual void timerTick(const Time &when)
void reset()
bool sendSabme()
Definition yatesig.h:12948
virtual bool receivedPacket(const DataBlock &packet)
ISDNQ921(const NamedList &params, const char *name=0, ISDNQ921Management *mgmt=0, u_int8_t tei=0)
SignallingEvent * releaseComplete(const char *reason=0)
virtual void * getObject(const String &name) const
virtual SignallingEvent * getEvent(const Time &when)
virtual ~ISDNQ931CallMonitor()
ISDNQ931CallMonitor(ISDNQ931Monitor *controller, u_int32_t callRef, bool netInit)
bool netInit() const
Definition yatesig.h:14215
void setTerminate(const char *reason)
A Q.931 ISDN call.
Definition yatesig.h:14017
virtual void * getObject(const String &name) const
void dataLinkState(bool up)
virtual SignallingEvent * getEvent(const Time &when)
ISDNQ931Call(ISDNQ931 *controller, bool outgoing, u_int32_t callRef, u_int8_t callRefLen, u_int8_t tei=0)
u_int8_t callTei() const
Definition yatesig.h:14043
void setTerminate(bool destroy, const char *reason)
SignallingCircuit * circuit()
Definition yatesig.h:14050
virtual ~ISDNQ931Call()
SignallingEvent * releaseComplete(const char *reason=0, const char *diag=0)
u_int32_t callRef() const
Definition yatesig.h:14029
u_int32_t callRefLen() const
Definition yatesig.h:14036
virtual bool sendEvent(SignallingEvent *event)
SignallingEvent * getCircuitEvent(const Time &when)
A Q.931 message IE data processor.
Definition yatesig.h:13878
A Q.931 ISDN Layer 3 message Information Element.
Definition yatesig.h:13520
static const TokenDict s_type[]
Definition yatesig.h:13609
Type
Definition yatesig.h:13526
DataBlock m_buffer
Definition yatesig.h:13614
void addParamPrefix(const char *name, const char *value)
Definition yatesig.h:13585
u_int8_t type() const
Definition yatesig.h:13577
ISDNQ931IE(u_int16_t type)
virtual ~ISDNQ931IE()
static const char * typeName(int type, const char *defVal=0)
Definition yatesig.h:13603
void toString(String &dest, bool extendedDebug, const char *before=0)
A Q.931 ISDN Layer 3 message.
Definition yatesig.h:13625
const char * getIEValue(ISDNQ931IE::Type type, const char *param, const char *defVal=0)
Definition yatesig.h:13766
bool append(ISDNQ931IE *ie)
Definition yatesig.h:13794
static const TokenDict s_type[]
Definition yatesig.h:13856
virtual void * getObject(const String &name) const
Type
Definition yatesig.h:13630
ISDNQ931Message(Type type)
bool initiator() const
Definition yatesig.h:13699
ISDNQ931Message(Type type, bool initiator, u_int32_t callRef, u_int8_t callRefLen)
DataBlock m_buffer
Definition yatesig.h:13861
bool dummyCallRef() const
Definition yatesig.h:13720
static ISDNQ931Message * parse(ISDNQ931ParserData &parserData, const DataBlock &buffer, DataBlock *segData)
void setUnknownMandatory()
Definition yatesig.h:13733
virtual ~ISDNQ931Message()
u_int8_t encode(ISDNQ931ParserData &parserData, ObjList &dest)
ISDNQ931IE * removeIE(ISDNQ931IE::Type type, ISDNQ931IE *base=0)
ISDNQ931IE * getIE(ISDNQ931IE::Type type, ISDNQ931IE *base=0)
ObjList * ieList()
Definition yatesig.h:13740
u_int8_t callRefLen() const
Definition yatesig.h:13713
void toString(String &dest, bool extendedDebug, const char *indent=0) const
ISDNQ931IE * appendIEValue(ISDNQ931IE::Type type, const char *param, const char *value)
Definition yatesig.h:13780
bool unknownMandatory() const
Definition yatesig.h:13727
ISDNQ931Message(Type type, ISDNQ931Call *call)
Type type() const
Definition yatesig.h:13692
static const char * typeName(int t)
Definition yatesig.h:13850
u_int32_t callRef() const
Definition yatesig.h:13706
bool appendSafe(ISDNQ931IE *ie)
virtual ~ISDNQ931Monitor()
bool reserveCircuit(unsigned int code, bool netInit, SignallingCircuit **caller, SignallingCircuit **called)
ISDNQ921Passive * circuits(bool net) const
Definition yatesig.h:14896
virtual void destroyed()
Definition yatesig.h:14928
virtual SignallingCircuitGroup * attach(SignallingCircuitGroup *circuits, bool net)
virtual void cleanup(const char *reason="offline")
Definition yatesig.h:14913
virtual void dataLinkState(u_int8_t tei, bool cmd, bool value, ISDNLayer2 *layer2)
virtual void receiveData(const DataBlock &data, u_int8_t tei, ISDNLayer2 *layer2)
virtual ISDNQ921Passive * attach(ISDNQ921Passive *q921, bool net)
virtual bool initialize(const NamedList *config)
void terminateMonitor(ISDNQ931CallMonitor *mon, const char *reason)
virtual void idleTimeout(ISDNLayer2 *layer2)
void processMsgRestart(ISDNQ931Message *msg)
void setDebug(bool printMsg, bool extendedDebug)
Definition yatesig.h:14904
virtual void timerTick(const Time &when)
bool releaseCircuit(SignallingCircuit *circuit)
ISDNQ931Monitor(const NamedList &params, const char *name=0)
virtual const char * statusName() const
Q.931 message parser data.
Definition yatesig.h:14297
ISDNQ931ParserData(const NamedList &params, DebugEnabler *dbg=0)
bool flag(int mask) const
Definition yatesig.h:14311
bool checkStateSend(int type)
ISDNQ931State()
Definition yatesig.h:13966
State
Definition yatesig.h:13938
bool checkStateRecv(int type, bool *retrans)
static const TokenDict s_states[]
Definition yatesig.h:13987
State m_state
Definition yatesig.h:14008
static const char * stateName(u_int8_t s)
Definition yatesig.h:13981
State state() const
Definition yatesig.h:13973
void processInvalidMsg(ISDNQ931Message *msg, u_int8_t tei=0)
virtual void multipleFrameEstablished(u_int8_t tei, bool confirm, bool timeout, ISDNLayer2 *layer2)
bool sendStatus(const char *cause, u_int8_t callRefLen, u_int32_t callRef=0, u_int8_t tei=0, bool initiator=false, ISDNQ931Call::State state=ISDNQ931Call::Null, const char *display=0, const char *diagnostic=0)
void sendRestart(u_int64_t time=Time::msecNow(), bool retrans=false)
ISDNQ931Message * endReceiveSegment(const char *reason=0)
virtual ~ISDNQ931()
virtual void destroyed()
Definition yatesig.h:14632
const String & numPlan() const
Definition yatesig.h:14464
void processMsgRestart(ISDNQ931Message *msg, u_int8_t tei=0)
ISDNQ931Call * findCall(unsigned int circuit)
bool transferModeCircuit() const
Definition yatesig.h:14450
static const TokenDict s_flags[]
Definition yatesig.h:14621
void manageTimeout()
bool network() const
Definition yatesig.h:14443
const String & numPresentation() const
Definition yatesig.h:14478
const ISDNLayer2 * layer2() const
Definition yatesig.h:14429
virtual void cleanup(const char *reason="offline")
ISDNQ931Call * findCall(u_int32_t callRef, bool outgoing, u_int8_t tei=0)
bool sendMessage(ISDNQ931Message *msg, u_int8_t tei, String *reason=0)
virtual void multipleFrameReleased(u_int8_t tei, bool confirm, bool timeout, ISDNLayer2 *layer2)
const String & numScreening() const
Definition yatesig.h:14485
virtual void receiveData(const DataBlock &data, u_int8_t tei, ISDNLayer2 *layer2)
BehaviourFlags
Definition yatesig.h:14337
bool restart(const char *circuits)
virtual bool initialize(const NamedList *config)
bool sendStatus(ISDNQ931Call *call, const char *cause, u_int8_t tei=0, const char *display=0, const char *diagnostic=0)
Definition yatesig.h:14564
SignallingCall * call(SignallingMessage *msg, String &reason)
bool primaryRate() const
Definition yatesig.h:14436
ISDNQ931(const NamedList &params, const char *name=0)
static const TokenDict s_swType[]
Definition yatesig.h:14626
void terminateCalls(ObjList *list, const char *reason)
void setDebug(bool printMsg, bool extendedDebug)
Definition yatesig.h:14614
void endRestart(bool restart, u_int64_t time, bool timeout=false)
bool acceptNewCall(bool outgoing, String &reason)
ISDNQ931ParserData & parserData()
Definition yatesig.h:14457
virtual void timerTick(const Time &when)
const String & numType() const
Definition yatesig.h:14471
ISDNQ931Message * getMsg(const DataBlock &data)
const String & format() const
Definition yatesig.h:14492
void setInterval(SignallingTimer &timer, int id)
void processGlobalMsg(ISDNQ931Message *msg, u_int8_t tei=0)
virtual ISDNLayer2 * attach(ISDNLayer2 *q921)
SwitchType
Definition yatesig.h:14380
bool sendRelease(bool release, u_int8_t callRefLen, u_int32_t callRef, u_int8_t tei, bool initiator, const char *cause=0, const char *diag=0, const char *display=0, const char *signal=0)
virtual const char * statusName() const
bool sendRelease(ISDNQ931Call *call, bool release, const char *cause, u_int8_t tei=0, const char *diag=0, const char *display=0, const char *signal=0)
Definition yatesig.h:14582
Ephemeral mutex or semaphore locking object.
Definition yateclass.h:5833
Mutex support.
Definition yateclass.h:5607
Mutex(bool recursive=false, const char *name=0)
virtual bool lock(long maxwait=-1)
A named string container class.
Definition yateclass.h:5016
NamedList(const char *name)
const char * getValue(const String &name, const char *defvalue=0) const
NamedList & addParam(NamedString *param)
An object list class.
Definition yateclass.h:1454
virtual void destroyed()
Templated smart pointer class.
Definition yateclass.h:1306
Definition yatesig.h:9956
RemoteBackupSubsystem(unsigned char ssn, int pointcode, bool wfg=false)
Definition yatesig.h:9966
bool equals(unsigned char ssn, int pointcode)
Definition yatesig.h:9979
void permisionGranted()
Definition yatesig.h:9985
bool waitingForGrant()
Definition yatesig.h:9992
Abstract SS7 SCCP Management.
Definition yatesig.h:9319
static const TokenDict * broadcastType()
void handleCoordinateChanged(unsigned char ssn, int smi, const NamedList &params)
virtual bool processMessage(SS7MsgSCCP *message)
virtual void startSst(SccpRemote *remoteSccp, SccpSubsystem *rSubsystem)
virtual void routeStatus(SS7PointCode::Type type, const SS7PointCode &node, SS7Route::State state)
virtual ~SCCPManagement()
virtual void stopSst(SccpRemote *remoteSccp, SccpSubsystem *rSubsystem=0, SccpSubsystem *less=0)
bool handleMessage(int msgType, unsigned char ssn, unsigned char smi, NamedList &params)
SCCPManagement(const NamedList &params, SS7PointCode::Type type)
SccpRemote * getRemoteSccp(int pointcode)
virtual void subsystemFailure(SS7MsgSCCP *msg, const SS7Label &label)
void routeStatus(String &dest, bool extended=false)
virtual void notify(SCCP::Type type, NamedList &params)
void mtpEndRestart()
u_int32_t getTestTimeout()
Definition yatesig.h:9497
virtual void notifyConcerned(MsgType msg, unsigned char ssn, int smi)
virtual void updateTables(SccpRemote *rsccp, SccpSubsystem *ssn=0)
void stopSSTs()
Definition yatesig.h:9541
bool sendSST(SccpRemote *remote, SccpSubsystem *sub)
void subsystemsStatus(String &dest, bool extended=true)
virtual bool sendMessage(SCCPManagement::MsgType msgType, const NamedList &params)=0
virtual void sccpUnavailable(const SS7PointCode &pointcode, unsigned char cause)
virtual void printMessage(String &dest, MsgType type, const NamedList &params)
virtual bool initialize(const NamedList *config)
u_int32_t getIgnoreTestsInterval()
Definition yatesig.h:9639
virtual void pointcodeStatus(SS7Layer3 *link, bool operational)
virtual void handleSubsystemStatus(SccpSubsystem *subsystem, bool allowed, SccpRemote *remote, int smi)
Definition yatesig.h:9625
void attach(SS7SCCP *sccp)
bool managementMessage(SCCP::Type type, NamedList &params)
void handleSog(unsigned char ssn, int pointcode)
static const char * stateName(SCCPManagement::SccpStates state)
Definition yatesig.h:9473
virtual void manageSccpRemoteStatus(SccpRemote *rsccp, SS7Route::State newState)
Definition yatesig.h:9592
virtual void timerTick(const Time &when)
virtual void routeFailure(SS7MsgSCCP *msg)
SccpLocalSubsystem * getLocalSubsystem(unsigned char ssn)
bool printMessagess()
Definition yatesig.h:9599
u_int32_t getCoordTimeout()
Definition yatesig.h:9632
void localBroadcast(SCCP::Type type, int pointcode, int sps, int rss=-1, int rl=-1, int ssn=-1, int ss=-1)
Abstract SS7 SCCP user interface.
Definition yatesig.h:5446
SCCP * sccp() const
Definition yatesig.h:5548
virtual ~SCCPUser()
virtual HandledMSU receivedData(DataBlock &data, NamedList &params)
virtual void destroyed()
virtual HandledMSU notifyData(DataBlock &data, NamedList &params)
virtual bool sccpNotify(SCCP::Type type, NamedList &params)
virtual bool sendData(DataBlock &data, NamedList &params)
SCCPUser(const NamedList &params)
virtual bool initialize(const NamedList *config)
virtual bool managementNotify(SCCP::Type type, NamedList &params)
virtual void attach(SCCP *sccp)
Abstract SS7 SCCP interface.
Definition yatesig.h:5226
static const TokenDict * notifTypes()
virtual void attachGTT(GTT *gtt)
HandledMSU notifyMessage(DataBlock &data, NamedList &params, int ssn)
virtual int sendMessage(DataBlock &data, const NamedList &params)
NamedList * translateGT(const NamedList &params, const String &prefix, const String &nextPrefix)
HandledMSU pushMessage(DataBlock &data, NamedList &params, int ssn)
bool managementMessage(Type type, NamedList &params)
virtual bool isEndpoint()
Definition yatesig.h:5354
void resolveGTParams(SS7MsgSCCP *msg, const NamedList *gtParams)
virtual bool managementStatus(Type type, NamedList &params)
virtual void attach(SCCPUser *user)
virtual ~SCCP()
virtual void detach(SCCPUser *user)
ObjList & users()
Definition yatesig.h:4996
TrafficMode m_traffic
Definition yatesig.h:5007
AspState
Definition yatesig.h:4907
bool aspActive() const
Definition yatesig.h:4976
virtual bool processAspsmMSG(unsigned char msgType, const DataBlock &msg, int streamId)
int32_t m_aspId
Definition yatesig.h:5002
void setState(AspState state, bool notify=true)
virtual bool processAsptmMSG(unsigned char msgType, const DataBlock &msg, int streamId)
virtual bool processMgmtMSG(unsigned char msgType, const DataBlock &msg, int streamId)
SIGAdaptClient(const char *name=0, const NamedList *params=0, u_int32_t payload=0, u_int16_t port=0)
virtual void notifyLayer(SignallingInterface::Notification status)
bool aspUp() const
Definition yatesig.h:4969
virtual void activeChange(bool active)
SIGAdaptServer(const char *name=0, const NamedList *params=0, u_int32_t payload=0, u_int16_t port=0)
Definition yatesig.h:5031
virtual bool processAspsmMSG(unsigned char msgType, const DataBlock &msg, int streamId)
virtual bool processAsptmMSG(unsigned char msgType, const DataBlock &msg, int streamId)
virtual bool processMgmtMSG(unsigned char msgType, const DataBlock &msg, int streamId)
bool activate()
Definition yatesig.h:5115
bool aspActive() const
Definition yatesig.h:5129
unsigned char m_streamId
Definition yatesig.h:5147
SIGAdaptUser()
Definition yatesig.h:5081
unsigned char getStreamId()
Definition yatesig.h:5136
virtual void activeChange(bool active)=0
virtual ~SIGAdaptUser()
SIGTransport * transport() const
Definition yatesig.h:5096
SIGAdaptClient * adaptation() const
Definition yatesig.h:5089
void adaptation(SIGAdaptClient *adapt)
bool m_autostart
Definition yatesig.h:5142
bool aspUp() const
Definition yatesig.h:5122
static void addTag(DataBlock &data, uint16_t tag, const String &value)
SIGAdaptation(const char *name=0, const NamedList *params=0, u_int32_t payload=0, u_int16_t port=0)
virtual ~SIGAdaptation()
void enableHeartbeat(unsigned char streamId)
Definition yatesig.h:4883
static bool findTag(const DataBlock &data, int &offset, uint16_t tag, uint16_t &length)
void resetHeartbeat()
Definition yatesig.h:4872
static bool getTag(const DataBlock &data, uint16_t tag, DataBlock &value)
static bool getTag(const DataBlock &data, uint16_t tag, String &value)
static void addTag(DataBlock &data, uint16_t tag, uint32_t value)
virtual bool processMgmtMSG(unsigned char msgType, const DataBlock &msg, int streamId)=0
static bool nextTag(const DataBlock &data, int &offset, uint16_t &tag, uint16_t &length)
bool processHeartbeat(unsigned char msgType, const DataBlock &msg, int streamId)
static bool getTag(const DataBlock &data, uint16_t tag, uint32_t &value)
virtual bool processCommonMSG(unsigned char msgClass, unsigned char msgType, const DataBlock &msg, int streamId)
virtual bool initialize(const NamedList *config)
static void addTag(DataBlock &data, uint16_t tag, const DataBlock &value)
virtual bool processAspsmMSG(unsigned char msgType, const DataBlock &msg, int streamId)=0
virtual void timerTick(const Time &when)
void notifyLayer(SignallingInterface::Notification status)
TrafficMode
Definition yatesig.h:4674
virtual bool processAsptmMSG(unsigned char msgType, const DataBlock &msg, int streamId)=0
virtual void attach(SIGTransport *trans)
MsgMGMT
Definition yatesig.h:4460
bool restart(bool force)
SIGTRAN(u_int32_t payload=0, u_int16_t port=0)
bool transmitMSG(unsigned char msgVersion, unsigned char msgClass, unsigned char msgType, const DataBlock &msg, int streamId=0) const
static const TokenDict * classNames()
bool transmitMSG(unsigned char msgClass, unsigned char msgType, const DataBlock &msg, int streamId=0) const
Definition yatesig.h:4604
static const char * typeName(unsigned char msgClass, unsigned char msgType, const char *defValue=0)
bool hasTransportThread()
virtual ~SIGTRAN()
MsgSSNM
Definition yatesig.h:4468
MsgRKM
Definition yatesig.h:4502
bool getSocketParams(const String &params, NamedList &result)
MsgASPSM
Definition yatesig.h:4480
u_int32_t payload() const
Definition yatesig.h:4548
bool connected(int streamId=0) const
virtual bool processMSG(unsigned char msgVersion, unsigned char msgClass, unsigned char msgType, const DataBlock &msg, int streamId)=0
SIGTransport * transport() const
Definition yatesig.h:4541
void stopTransportThread()
MsgClass
Definition yatesig.h:4430
MsgASPTM
Definition yatesig.h:4492
u_int16_t defPort() const
Definition yatesig.h:4555
virtual bool transportNotify(SIGTransport *newTransport, const SocketAddr &addr)
Definition yatesig.h:4629
MsgIIM
Definition yatesig.h:4512
An abstract SIGTRAN transport layer.
Definition yatesig.h:4268
virtual bool reliable() const =0
virtual void stopThread()
Definition yatesig.h:4377
u_int32_t defPort() const
SIGTransport(const char *name=0)
Definition yatesig.h:4384
virtual bool getSocketParams(const String &params, NamedList &result)
Definition yatesig.h:4355
virtual void attached(bool hasUAL)=0
virtual bool transmitMSG(const DataBlock &header, const DataBlock &msg, int streamId=0)=0
SIGTRAN * sigtran() const
Definition yatesig.h:4288
virtual bool connected(int streamId) const =0
virtual bool initialize(const NamedList *config)
Definition yatesig.h:4314
virtual bool transmitMSG(unsigned char msgVersion, unsigned char msgClass, unsigned char msgType, const DataBlock &msg, int streamId=0)
Transport
Definition yatesig.h:4275
virtual bool transportNotify(SIGTransport *newTransport, const SocketAddr &addr)
virtual bool hasThread()
Definition yatesig.h:4371
void attach(SIGTRAN *sigtran)
virtual void reconnect(bool force=false)
Definition yatesig.h:4346
bool processMSG(unsigned char msgVersion, unsigned char msgClass, unsigned char msgType, const DataBlock &msg, int streamId) const
void notifyLayer(SignallingInterface::Notification status)
Definition yatesig.h:10255
virtual bool sendMessage(SCCPManagement::MsgType msgType, const NamedList &params)
virtual bool processMessage(SS7MsgSCCP *message)
virtual void handleSubsystemStatus(SccpSubsystem *subsystem, bool allowed, SccpRemote *remote, int smi)
virtual void manageSccpRemoteStatus(SccpRemote *rsccp, SS7Route::State newState)
SS7AnsiSccpManagement(const NamedList &params)
Definition yatesig.h:10262
bool handleMessage(int msgType, NamedList &params)
virtual HandledMSU receivedMSU(const SS7MSU &msu, const SS7Label &label, SS7Layer3 *network, int sls)
SS7BICC(const NamedList &params, unsigned char sio=SS7MSU::BICC|SS7MSU::National)
virtual ~SS7BICC()
void setTerminate(bool gracefully, const char *reason=0, const char *diagnostic=0, const char *location=0)
Definition yatesig.h:8681
virtual void * getObject(const String &name) const
bool earlyState() const
Definition yatesig.h:8642
virtual SignallingEvent * getEvent(const Time &when)
virtual ~SS7ISUPCall()
const String & cicRange() const
Definition yatesig.h:8649
SS7ISUPCall(SS7ISUP *controller, SignallingCircuit *cic, const SS7PointCode &local, const SS7PointCode &remote, bool outgoing, int sls=-1, const char *range=0, bool testCall=false)
bool canReplaceCircuit()
State
Definition yatesig.h:8613
void stopWaitSegment(bool discard)
SignallingEvent * releaseComplete(bool final, SS7MsgISUP *msg=0, const char *reason=0, bool timeout=false)
bool replaceCircuit(SignallingCircuit *circuit, SS7MsgISUP *msg=0)
State state() const
Definition yatesig.h:8635
unsigned int id() const
Definition yatesig.h:8656
virtual bool sendEvent(SignallingEvent *event)
bool startCircuitReset(SignallingCircuit *&cic, const String &timer)
bool processParamCompat(const NamedList &list, unsigned int cic, bool *callReleased=0)
void setLabel(SS7Label &label, const SS7PointCode &opc, const SS7PointCode &dpc, unsigned char sls=255)
Definition yatesig.h:8938
virtual SignallingCall * call(SignallingMessage *msg, String &reason)
virtual void destroyed()
virtual SS7MSU * createMSU(SS7MsgISUP::Type type, unsigned char ssf, const SS7Label &label, unsigned int cic, const NamedList *params=0) const
virtual HandledMSU receivedMSU(const SS7MSU &msu, const SS7Label &label, SS7Layer3 *network, int sls)
virtual void notify(SS7Layer3 *link, int sls)
int transmitMessage(SS7MsgISUP *msg, const SS7Label &label, bool recvLbl, int sls=SlsDefault)
bool setPointCode(SS7PointCode *pc, bool def)
SS7MSU * buildMSU(SS7MsgISUP::Type type, unsigned char sio, const SS7Label &label, unsigned int cic, const NamedList *params) const
unsigned int setPointCode(const NamedList &params)
ChargeProcess getChargeProcessType() const
Definition yatesig.h:9037
bool encodeMessage(DataBlock &buf, SS7MsgISUP::Type msgType, SS7PointCode::Type pcType, const NamedList &params, unsigned int *cic=0)
virtual void cleanup(const char *reason="net-out-of-order")
SS7ISUP(const NamedList &params, unsigned char sio=SS7MSU::ISUP|SS7MSU::National)
virtual bool initialize(const NamedList *config)
SS7PointCode * hasPointCode(const SS7PointCode &pc)
bool decodeMessage(NamedList &msg, SS7MsgISUP::Type msgType, SS7PointCode::Type pcType, const unsigned char *paramPtr, unsigned int paramLen)
bool handlesRemotePC(const SS7PointCode &pc) const
Definition yatesig.h:8928
void setDebug(bool printMsg, bool extendedDebug)
Definition yatesig.h:8947
virtual bool processMSU(SS7MsgISUP::Type type, unsigned int cic, const unsigned char *paramPtr, unsigned int paramLen, const SS7Label &label, SS7Layer3 *network, int sls)
virtual ~SS7ISUP()
virtual void attach(SS7Layer3 *network)
virtual SignallingEvent * processCircuitEvent(SignallingCircuitEvent *&event, SignallingCall *call=0)
bool ignoreUnknownAddrSignals() const
Definition yatesig.h:8895
virtual void timerTick(const Time &when)
const String & format() const
Definition yatesig.h:8888
virtual void receivedUPU(SS7PointCode::Type type, const SS7PointCode node, SS7MSU::Services part, unsigned char cause, const SS7Label &label, int sls)
unsigned int cicLen() const
Definition yatesig.h:8881
unsigned int m_cicLen
Definition yatesig.h:9130
virtual const char * statusName() const
virtual bool control(NamedList &params)
virtual bool processMessage(SS7MsgSCCP *message)
SS7ItuSccpManagement(const NamedList &params)
virtual ~SS7ItuSccpManagement()
Definition yatesig.h:10321
virtual void handleSubsystemStatus(SccpSubsystem *subsystem, bool allowed, SccpRemote *remote, int smi)
virtual bool sendMessage(MsgType msgType, const NamedList &params)
virtual void manageSccpRemoteStatus(SccpRemote *rsccp, SS7Route::State newState)
bool handleMessage(int msgType, NamedList &params)
Abstract user of SS7 layer 2 (data link) message transfer part.
Definition yatesig.h:5636
virtual void attach(SS7Layer2 *link)=0
virtual bool recoveredMSU(const SS7MSU &msu, SS7Layer2 *link, int sls)=0
virtual void notify(SS7Layer2 *link)=0
virtual bool receivedMSU(const SS7MSU &msu, SS7Layer2 *link, int sls)=0
virtual void detach(SS7Layer2 *link)=0
Abstract user of SS7 layer 3 (network) message transfer part.
Definition yatesig.h:6151
static ObjList * getNetRoutes(SS7Layer3 *network, SS7PointCode::Type type)
static const ObjList * getNetRoutes(const SS7Layer3 *network, SS7PointCode::Type type)
virtual void attach(SS7Layer3 *network)=0
virtual HandledMSU receivedMSU(const SS7MSU &msu, const SS7Label &label, SS7Layer3 *network, int sls)=0
virtual void notify(SS7Layer3 *link, int sls)
virtual void routeStatusChanged(SS7PointCode::Type type, const SS7PointCode &node, SS7Route::State state)
Definition yatesig.h:6209
virtual void receivedUPU(SS7PointCode::Type type, const SS7PointCode node, SS7MSU::Services part, unsigned char cause, const SS7Label &label, int sls)
Definition yatesig.h:6192
virtual bool recoveredMSU(const SS7MSU &msu, const SS7Label &label, SS7Layer3 *network, int sls)
Definition yatesig.h:6180
SS7 Routing Label.
Definition yatesig.h:3700
bool compatible(SS7PointCode::Type type) const
unsigned char size() const
Definition yatesig.h:3883
unsigned char spare() const
Definition yatesig.h:3855
bool store(unsigned char *dest) const
SS7Label(SS7PointCode::Type type, const SS7PointCode &dpc, const SS7PointCode &opc, unsigned char sls, unsigned char spare=0)
const SS7PointCode & opc() const
Definition yatesig.h:3827
bool assign(SS7PointCode::Type type, const unsigned char *src, int len=-1)
SS7Label(SS7PointCode::Type type, unsigned int dpc, unsigned int opc, unsigned char sls, unsigned char spare=0)
static unsigned int length(SS7PointCode::Type type)
void setSls(unsigned char sls)
Definition yatesig.h:3848
static unsigned char size(SS7PointCode::Type type)
SS7Label(SS7PointCode::Type type, const SS7MSU &msu)
void setSpare(unsigned char spare)
Definition yatesig.h:3862
bool assign(SS7PointCode::Type type, const SS7MSU &msu)
const SS7PointCode & dpc() const
Definition yatesig.h:3813
unsigned char sls() const
Definition yatesig.h:3841
SS7PointCode::Type type() const
Definition yatesig.h:3806
SS7Label(const SS7Label &original)
SS7PointCode & opc()
Definition yatesig.h:3834
void assign(SS7PointCode::Type type, const SS7PointCode &dpc, const SS7PointCode &opc, unsigned char sls, unsigned char spare=0)
unsigned int length() const
Definition yatesig.h:3869
void assign(SS7PointCode::Type type, unsigned int dpc, unsigned int opc, unsigned char sls, unsigned char spare=0)
SS7Label(const SS7Label &original, unsigned char sls, unsigned char spare=0)
SS7PointCode & dpc()
Definition yatesig.h:3820
bool recoveredMSU(const SS7MSU &msu)
Definition yatesig.h:5891
SS7Layer2()
Definition yatesig.h:5860
bool m_autoEmergency
Definition yatesig.h:5924
SS7L2User * user() const
Definition yatesig.h:5793
virtual bool transmitMSU(const SS7MSU &msu)=0
virtual bool control(Operation oper, NamedList *params=0)
virtual unsigned int congestion()
Definition yatesig.h:5829
bool inhibit(int setFlags, int clrFlags=0)
bool inhibited(int flags) const
Definition yatesig.h:5822
unsigned int m_congestion
Definition yatesig.h:5934
void notify()
Inhibitions
Definition yatesig.h:5723
virtual unsigned int status() const
virtual bool operational() const =0
const char * statusName(bool brief=false) const
Definition yatesig.h:5767
LinkStatus
Definition yatesig.h:5690
virtual const char * statusName(unsigned int status, bool brief) const
Operation
Definition yatesig.h:5709
int inhibited() const
Definition yatesig.h:5814
virtual int getSequence()
Definition yatesig.h:5836
void sls(int linkSel)
Definition yatesig.h:5807
virtual void timerTick(const Time &when)
void attach(SS7L2User *l2user)
unsigned int upTime() const
Definition yatesig.h:5780
bool receivedMSU(const SS7MSU &msu)
Definition yatesig.h:5878
virtual void recoverMSU(int sequence)
Definition yatesig.h:5745
bool getEmergency(NamedList *params=0, bool emg=false) const
int m_lastSeqRx
Definition yatesig.h:5929
virtual bool control(NamedList &params)
int sls() const
Definition yatesig.h:5800
Abstract SS7 layer 3 (network) message transfer part.
Definition yatesig.h:6234
void printRoutes()
virtual void linkChecked(int sls, bool remote)
Definition yatesig.h:6548
unsigned int getRoutePriority(SS7PointCode::Type type, unsigned int packedPC)
virtual ~SS7Layer3()
Definition yatesig.h:6243
unsigned int getLocal(SS7PointCode::Type type) const
Definition yatesig.h:6482
bool inService(int sls, int ignore=0)
Definition yatesig.h:6302
void setType(SS7PointCode::Type type, unsigned char netType)
virtual bool allowedTo(SS7PointCode::Type type, unsigned int packedPC) const
Definition yatesig.h:6469
bool buildRoutes(const NamedList &params)
virtual bool management(const SS7MSU &msu, const SS7Label &label, int sls)
bool hasType(SS7PointCode::Type pcType) const
virtual bool responder() const
Definition yatesig.h:6592
virtual void recoverMSU(int sls, int sequence)
Definition yatesig.h:6326
SS7PointCode::Type type(unsigned char netType) const
void setType(SS7PointCode::Type type)
virtual int inhibited(int sls) const
Definition yatesig.h:6274
void attach(SS7L3User *l3user)
virtual int getSequence(int sls) const
Definition yatesig.h:6318
void setNI(unsigned char defNI)
bool recoveredMSU(const SS7MSU &msu, const SS7Label &label, int sls)
Definition yatesig.h:6522
ObjList * getRoutes(SS7PointCode::Type type)
Definition yatesig.h:6609
HandledMSU receivedMSU(const SS7MSU &msu, const SS7Label &label, int sls)
Definition yatesig.h:6507
void notify(int sls=-1)
Definition yatesig.h:6534
unsigned int getRouteMaxLength(SS7PointCode::Type type, unsigned int packedPC)
virtual bool initialize(const NamedList *config)
virtual int transmitMSU(const SS7MSU &msu, const SS7Label &label, int sls=-1)=0
bool inhibited(int sls, int flags) const
Definition yatesig.h:6283
virtual bool unavailable(const SS7MSU &msu, const SS7Label &label, int sls, unsigned char cause=0)
virtual unsigned int getDefaultLocal(SS7PointCode::Type type) const
Definition yatesig.h:6490
ObjList m_route[YSS7_PCTYPE_COUNT]
Definition yatesig.h:6624
virtual bool prohibited(unsigned char ssf, const SS7Label &label, int sls)
virtual bool inhibit(int sls, int setFlags, int clrFlags=0)
Definition yatesig.h:6293
unsigned int getRoutePriority(SS7PointCode::Type type, const SS7PointCode &dest)
Definition yatesig.h:6439
SS7L3User * user() const
Definition yatesig.h:6347
virtual bool restart()
Definition yatesig.h:6333
unsigned char getNI() const
Definition yatesig.h:6397
virtual bool maintenance(const SS7MSU &msu, const SS7Label &label, int sls)
SS7Layer3(SS7PointCode::Type type=SS7PointCode::Other)
SS7Route::State getRouteState(SS7PointCode::Type type, const SS7PointCode &dest, bool checkAdjacent=false)
Definition yatesig.h:6460
const ObjList * getRoutes(SS7PointCode::Type type) const
Definition yatesig.h:6617
virtual bool operational(int sls=-1) const =0
Mutex m_routeMutex
Definition yatesig.h:6621
virtual unsigned int congestion(int sls)
Definition yatesig.h:6310
virtual unsigned char getNI(SS7PointCode::Type pcType, unsigned char defNI) const
SS7Route * findRoute(SS7PointCode::Type type, unsigned int packed)
SS7Route::State getRouteState(SS7PointCode::Type type, unsigned int packedPC, bool checkAdjacent=false)
unsigned char getNI(SS7PointCode::Type pcType) const
Definition yatesig.h:6390
Abstract SS7 layer 4 (application) protocol.
Definition yatesig.h:6640
unsigned char sio() const
Definition yatesig.h:6672
unsigned char ssf() const
Definition yatesig.h:6686
unsigned char prio() const
Definition yatesig.h:6693
virtual void destroyed()
SS7Layer4(unsigned char sio=SS7MSU::National, const NamedList *params=0)
static unsigned char getSIO(const NamedList &params, unsigned char sif, unsigned char ssf)
Definition yatesig.h:6720
unsigned char getSIO(const NamedList &params) const
Definition yatesig.h:6737
unsigned char sif() const
Definition yatesig.h:6679
virtual bool initialize(const NamedList *config)
static unsigned char getSIO(const NamedList &params, unsigned char sif, unsigned char prio, unsigned char ni)
SS7Layer3 * network() const
Definition yatesig.h:6665
unsigned char m_sio
Definition yatesig.h:6766
static unsigned char getSIO(const NamedList &params, unsigned char sio)
Definition yatesig.h:6729
virtual void attach(SS7Layer3 *network)
unsigned char ni() const
Definition yatesig.h:6700
int transmitMSU(const SS7MSU &msu, const SS7Label &label, int sls=-1)
Definition yatesig.h:6755
bool processLinkStatus(DataBlock &data, int streamId)
static u_int32_t increment(u_int32_t &nr)
Definition yatesig.h:7329
void retransData()
virtual bool transmitMSU(const SS7MSU &msu)
virtual void destroyed()
virtual bool operational() const
virtual bool aligned() const
void transmitLS(int streamId=0)
bool decodeSeq(const DataBlock &data, u_int8_t msgType)
void setHeader(DataBlock &data)
void sendAck()
SS7M2PA(const NamedList &params)
virtual bool control(SS7Layer2::Operation oper, NamedList *params=0)
Definition yatesig.h:7233
bool removeFrame(u_int32_t bsn)
virtual unsigned int status() const
virtual bool initialize(const NamedList *config)
bool processSLinkStatus(DataBlock &data, int streamId)
virtual bool processMSG(unsigned char msgVersion, unsigned char msgClass, unsigned char msgType, const DataBlock &msg, int streamId)
static u_int32_t getNext(u_int32_t nr)
Definition yatesig.h:7337
virtual bool control(M2PAOperations oper, NamedList *params=0)
void abortAlignment(const char *info=0)
bool nextBsn(u_int32_t bsn) const
virtual void timerTick(const Time &when)
virtual void notifyLayer(SignallingInterface::Notification status)
virtual void recoverMSU(int sequence)
void startAlignment(bool emergency=false)
virtual bool control(NamedList &params)
SS7M2UAClient(const NamedList &params)
Definition yatesig.h:7429
virtual bool processMSG(unsigned char msgVersion, unsigned char msgClass, unsigned char msgType, const DataBlock &msg, int streamId)
virtual bool transmitMSU(const SS7MSU &msu)
virtual bool operational() const
virtual bool control(Operation oper, NamedList *params=0)
virtual unsigned int status() const
virtual bool initialize(const NamedList *config)
int32_t iid() const
Definition yatesig.h:7511
virtual int getSequence()
virtual void timerTick(const Time &when)
SS7M2UA(const NamedList &params)
virtual void recoverMSU(int sequence)
virtual void activeChange(bool active)
SIGTRAN MTP3 User Adaptation Layer.
Definition yatesig.h:7548
A block of data that holds a Message Signal Unit.
Definition yatesig.h:3916
const char * getIndicatorName() const
int getSSF() const
Definition yatesig.h:4105
const char * getServiceName() const
bool valid() const
Priority
Definition yatesig.h:3956
SS7MSU(void *value, unsigned int len, bool copyData=true)
Definition yatesig.h:4001
SS7MSU(const SS7MSU &value)
Definition yatesig.h:3983
SS7MSU(unsigned char sio, const SS7Label label, void *value=0, unsigned int len=0)
SS7MSU()
Definition yatesig.h:3976
int getSIO() const
Definition yatesig.h:4091
unsigned char * getData(unsigned int offs, unsigned int len=1)
Definition yatesig.h:4057
static unsigned char getPriority(const char *name, unsigned char defVal=Regular)
static unsigned char getNetIndicator(const char *name, unsigned char defVal=National)
int getNI() const
Definition yatesig.h:4119
SS7MSU & operator=(const SS7MSU &value)
Definition yatesig.h:4034
SS7MSU(const DataBlock &value)
Definition yatesig.h:3991
int getPrio() const
Definition yatesig.h:4112
int getSIF() const
Definition yatesig.h:4098
const unsigned char * getData(unsigned int offs, unsigned int len=1) const
Definition yatesig.h:4066
unsigned char * getData(const SS7Label &label, unsigned int len=1)
Definition yatesig.h:4075
NetIndicator
Definition yatesig.h:3966
SS7MSU(unsigned char sif, unsigned char ssf, const SS7Label label, void *value=0, unsigned int len=0)
SS7MSU & operator=(const DataBlock &value)
Definition yatesig.h:4042
const unsigned char * getData(const SS7Label &label, unsigned int len=1) const
Definition yatesig.h:4084
Services
Definition yatesig.h:3922
virtual ~SS7MSU()
const char * getPriorityName() const
bool transmitLSSU()
Definition yatesig.h:7682
virtual bool notify(SignallingInterface::Notification event)
virtual void processFISU()
virtual void processLSSU(unsigned int status)
virtual bool transmitMSU(const SS7MSU &msu)
virtual void destroyed()
Definition yatesig.h:7641
virtual bool operational() const
ErrorCorrection
Definition yatesig.h:7563
virtual bool aligned() const
virtual bool control(Operation oper, NamedList *params=0)
void abortAlignment(bool retry=true)
bool transmitFISU()
virtual unsigned int status() const
virtual bool initialize(const NamedList *config)
bool transmitLSSU(unsigned int status)
virtual ~SS7MTP2()
bool startProving()
virtual void timerTick(const Time &when)
virtual void recoverMSU(int sequence)
void startAlignment(bool emergency=false)
virtual bool receivedPacket(const DataBlock &packet)
SS7MTP2(const NamedList &params, unsigned int status=OutOfService)
virtual void detach(SS7Layer2 *link)
virtual ~SS7MTP3()
virtual void linkChecked(int sls, bool remote)
virtual void attach(SS7Layer2 *link)
virtual void destroyed()
virtual bool allowedTo(SS7PointCode::Type type, unsigned int packedPC) const
virtual bool responder() const
Definition yatesig.h:7938
virtual void recoverMSU(int sls, int sequence)
virtual bool control(Operation oper, NamedList *params=0)
virtual int inhibited(int sls) const
virtual void notify(SS7Layer2 *link)
unsigned int countLinks()
virtual int getSequence(int sls) const
virtual bool receivedMSU(const SS7MSU &msu, SS7Layer2 *link, int sls)
virtual bool operational(int sls=-1) const
unsigned int linksTotal() const
Definition yatesig.h:7891
SS7MTP3(const NamedList &params)
virtual bool initialize(const NamedList *config)
virtual bool recoveredMSU(const SS7MSU &msu, SS7Layer2 *link, int sls)
const ObjList * links() const
Definition yatesig.h:7912
virtual int transmitMSU(const SS7MSU &msu, const SS7Label &label, int sls=-1)
Operation
Definition yatesig.h:7769
virtual bool inhibit(int sls, int setFlags, int clrFlags=0)
virtual void timerTick(const Time &when)
virtual unsigned int congestion(int sls)
unsigned int linksActive() const
Definition yatesig.h:7905
virtual bool control(NamedList &params)
unsigned int linksChecked() const
Definition yatesig.h:7898
SS7 SNM implementation.
Definition yatesig.h:8459
void recover(const SS7Label &link, int sequence)
virtual HandledMSU receivedMSU(const SS7MSU &msu, const SS7Label &label, SS7Layer3 *network, int sls)
virtual void notify(SS7Layer3 *link, int sls)
bool inhibit(const SS7Label &link, int setFlags, int clrFlags=0)
bool inhibited(const SS7Label &link, int flags)
SS7Management(const NamedList &params, unsigned char sio=SS7MSU::SNM|SS7MSU::National)
virtual void timerTick(const Time &when)
virtual bool control(NamedList &params)
ISUP signalling message.
Definition yatesig.h:8176
static Type lookup(const char *name, Type defvalue=Unknown)
Definition yatesig.h:8446
void toString(String &dest, const SS7Label &label, bool params, const void *raw=0, unsigned int rawLen=0) const
Type
Definition yatesig.h:8183
static const TokenDict * names()
unsigned int cic() const
Definition yatesig.h:8411
virtual ~SS7MsgISUP()
Definition yatesig.h:8397
Parameters
Definition yatesig.h:8258
static const char * lookup(Type type, const char *defvalue=0)
Definition yatesig.h:8437
Type type() const
Definition yatesig.h:8404
SS7MsgISUP(Type type, unsigned int cic)
Definition yatesig.h:8390
MTN signalling message.
Definition yatesig.h:8139
static Type lookup(const char *name, Type defvalue=Unknown)
Definition yatesig.h:8167
Type
Definition yatesig.h:8144
static const char * lookup(Type type, const char *defvalue=0)
Definition yatesig.h:8158
Definition yatesig.h:9659
static Type lookup(const char *name, Type defvalue=Unknown)
Definition yatesig.h:9795
void setData(DataBlock *data)
Definition yatesig.h:9802
void toString(String &dest, const SS7Label &label, bool params, const void *raw=0, unsigned int rawLen=0) const
virtual ~SS7MsgSCCP()
Type
Definition yatesig.h:9665
bool canBeUDT() const
Definition yatesig.h:9759
static const TokenDict * names()
SS7MsgSCCP(Type type)
Definition yatesig.h:9719
DataBlock * extractData()
Definition yatesig.h:9822
DataBlock * getData()
Definition yatesig.h:9815
void removeData()
Definition yatesig.h:9808
bool isLongDataMessage() const
Definition yatesig.h:9750
void updateType(Type type)
Definition yatesig.h:9743
static const char * lookup(Type type, const char *defvalue=0)
Definition yatesig.h:9786
Type type() const
Definition yatesig.h:9736
static Type lookup(const char *name, Type defvalue=Unknown)
Definition yatesig.h:8127
Type
Definition yatesig.h:8007
static const TokenDict * names()
static SS7MsgSNM * parse(SS7Management *receiver, unsigned char type, SS7PointCode::Type pcType, const unsigned char *buf, unsigned int len)
unsigned char type() const
Definition yatesig.h:8076
unsigned char group() const
Definition yatesig.h:8083
Group
Definition yatesig.h:8054
static const char * lookup(Type type, const char *defvalue=0)
Definition yatesig.h:8118
void toString(String &dest, const SS7Label &label, bool params) const
SS7MsgSNM(unsigned char type)
bool haveAllSegments()
Definition yatesig.h:9884
virtual ~SS7MsgSccpReassemble()
bool timeout()
Definition yatesig.h:9877
Return appendSegment(SS7MsgSCCP *msg, const SS7Label &label)
SS7MsgSccpReassemble(SS7MsgSCCP *msg, const SS7Label &label, unsigned int timeToLive)
bool canProcess(const SS7MsgSCCP *msg, const SS7Label &label)
SS7 Code Point.
Definition yatesig.h:3498
bool compatible(Type type) const
Type
Definition yatesig.h:3504
bool assign(Type type, const unsigned char *src, int len=-1, unsigned char *spare=0)
unsigned char network() const
Definition yatesig.h:3553
bool assign(const String &src, Type type=Other)
static unsigned char length(Type type)
static unsigned char size(Type type)
bool operator==(const SS7PointCode &original) const
Definition yatesig.h:3608
void assign(unsigned char network, unsigned char cluster, unsigned char member)
Definition yatesig.h:3576
SS7PointCode(const SS7PointCode &original)
Definition yatesig.h:3539
SS7PointCode(Type type, unsigned int packed)
Definition yatesig.h:3531
unsigned char cluster() const
Definition yatesig.h:3560
SS7PointCode & operator=(const SS7PointCode &original)
Definition yatesig.h:3601
static Type lookup(const char *text)
Definition yatesig.h:3667
static const char * lookup(Type type)
Definition yatesig.h:3675
SS7PointCode(unsigned char network=0, unsigned char cluster=0, unsigned char member=0)
Definition yatesig.h:3522
bool store(Type type, unsigned char *dest, unsigned char spare=0) const
unsigned char member() const
Definition yatesig.h:3567
~SS7PointCode()
Definition yatesig.h:3546
bool unpack(Type type, unsigned int packed)
bool operator!=(const SS7PointCode &original) const
Definition yatesig.h:3615
unsigned int pack(Type type) const
void attach(SS7Layer3 *network, SS7PointCode::Type type)
bool hasNetwork(const SS7Layer3 *network)
unsigned int packed() const
Definition yatesig.h:6056
const char * stateName() const
Definition yatesig.h:6027
State
Definition yatesig.h:5960
bool hasNetwork(const SS7Layer3 *network) const
bool operational(int sls=-1)
int transmitMSU(const SS7Router *router, const SS7MSU &msu, const SS7Label &label, int sls, State states, const SS7Layer3 *source=0)
bool congested()
unsigned int priority() const
Definition yatesig.h:6042
static const char * stateName(State state)
Definition yatesig.h:6035
void reroute()
bool detach(SS7Layer3 *network)
virtual ~SS7Route()
Definition yatesig.h:6007
State state() const
Definition yatesig.h:6014
SS7Route(const SS7Route &original)
Definition yatesig.h:5997
SS7Route(unsigned int packed, SS7PointCode::Type type, unsigned int priority=0, unsigned int shift=0, unsigned int maxDataLength=MAX_TDM_MSU_SIZE)
Definition yatesig.h:5985
unsigned int getMaxDataLength() const
Definition yatesig.h:6049
unsigned int shift() const
Definition yatesig.h:6063
static const TokenDict * stateNames()
void recoverMSU(const SS7Label &link, int sequence)
bool transferring() const
Definition yatesig.h:6928
bool m_started
Definition yatesig.h:7100
virtual void destroyed()
void loadLocalPC(const NamedList &params)
int getSequence(const SS7Label &link)
bool transfer() const
Definition yatesig.h:6921
bool uninhibit(SS7Layer3 *network, int sls, bool remote)
SignallingTimer m_restart
Definition yatesig.h:7102
virtual void detach(SS7Layer3 *network)
virtual HandledMSU receivedMSU(const SS7MSU &msu, const SS7Label &label, SS7Layer3 *network, int sls)
bool starting() const
Definition yatesig.h:6935
void updateRoutes(SS7Layer3 *network)
SS7Router(const NamedList &params)
virtual bool operational(int sls=-1) const
void clearView(const SS7Layer3 *network)
ObjList m_layer3
Definition yatesig.h:7090
void detach(SS7Layer4 *service)
void notifyRoutes(SS7Route::State states=SS7Route::AnyState, unsigned int onlyPC=0)
virtual bool initialize(const NamedList *config)
bool inhibited(const SS7Label &link, int flags)
virtual ~SS7Router()
bool setRouteState(SS7PointCode::Type type, unsigned int packedPC, SS7Route::State state, unsigned int remotePC=0, const SS7Layer3 *network=0)
ObjList m_layer4
Definition yatesig.h:7092
virtual int transmitMSU(const SS7MSU &msu, const SS7Label &label, int sls=-1)
Operation
Definition yatesig.h:6785
bool m_phase2
Definition yatesig.h:7098
virtual unsigned int getDefaultLocal(SS7PointCode::Type type) const
virtual void notify(SS7Layer3 *network, int sls)
bool inhibit(const SS7Label &link, int setFlags, int clrFlags=0, bool notLast=false)
virtual void attach(SS7Layer3 *network)
void attach(SS7Layer4 *service)
virtual bool restart()
virtual void timerTick(const Time &when)
virtual void receivedUPU(SS7PointCode::Type type, const SS7PointCode node, SS7MSU::Services part, unsigned char cause, const SS7Label &label, int sls)
SS7Route::State getRouteView(SS7PointCode::Type type, unsigned int packedPC, unsigned int remotePC=0, const SS7Layer3 *network=0)
int m_changes
Definition yatesig.h:7094
void removeRoutes(SS7Layer3 *network)
SignallingTimer m_isolate
Definition yatesig.h:7104
void notifyRoutes(SS7Route::State states, const SS7Layer3 *network)
bool setRouteState(SS7PointCode::Type type, const SS7PointCode &dest, SS7Route::State state, unsigned int remotePC=0, const SS7Layer3 *network=0)
Definition yatesig.h:7000
virtual unsigned char getNI(SS7PointCode::Type pcType, unsigned char defNI) const
virtual void routeChanged(const SS7Route *route, SS7PointCode::Type type, unsigned int remotePC=0, const SS7Layer3 *network=0, unsigned int onlyPC=0, bool forced=false)
SS7Management * getManagement() const
Definition yatesig.h:6942
virtual bool control(NamedList &params)
bool m_transfer
Definition yatesig.h:7096
SS7SCCPDataSegment(unsigned int index, unsigned int length)
Definition yatesig.h:10377
void fillSegment(DataBlock &temp, const DataBlock &orig)
Definition yatesig.h:10392
virtual ~SS7SCCPDataSegment()
Definition yatesig.h:10384
SS7 SCCP implementation.
Definition yatesig.h:10405
SS7MsgSccpReassemble::Return reassembleSegment(SS7MsgSCCP *segment, const SS7Label &label, SS7MsgSCCP *&msg)
virtual int sendMessage(DataBlock &data, const NamedList &params)
virtual void destroyed()
int routeLocal(SS7MsgSCCP *msg)
bool isLayer3Up()
Definition yatesig.h:10605
unsigned int errors()
Definition yatesig.h:10570
virtual HandledMSU receivedMSU(const SS7MSU &msu, const SS7Label &label, SS7Layer3 *network, int sls)
virtual void notify(SS7Layer3 *link, int sls)
unsigned int messagesReceived()
Definition yatesig.h:10563
virtual bool isEndpoint()
Definition yatesig.h:10641
int transmitMessage(SS7MsgSCCP *msg, bool local=false)
virtual bool initialize(const NamedList *config)
int segmentMessage(SS7MsgSCCP *origMsg, const SS7Label &label, bool local)
virtual bool managementStatus(Type type, NamedList &params)
SS7SCCP(const NamedList &config)
unsigned int messagesSend()
Definition yatesig.h:10556
const SS7PointCode * getLocalPointCode() const
Definition yatesig.h:10584
virtual void routeStatusChanged(SS7PointCode::Type type, const SS7PointCode &node, SS7Route::State state)
unsigned int translations()
Definition yatesig.h:10577
int getPackedPointCode()
Definition yatesig.h:10598
virtual void attach(SS7Layer3 *network)
const bool ITU() const
Definition yatesig.h:10528
bool ignoreUnknownAddrSignals() const
Definition yatesig.h:10535
virtual void timerTick(const Time &when)
virtual void receivedUPU(SS7PointCode::Type type, const SS7PointCode node, SS7MSU::Services part, unsigned char cause, const SS7Label &label, int sls)
bool extendedMonitoring()
Definition yatesig.h:10619
SS7PointCode::Type getLocalPointCodeType()
Definition yatesig.h:10591
virtual bool control(NamedList &params)
SIGTRAN SCCP User Adaptation Layer.
Definition yatesig.h:10734
SS7TCAPANSI(const NamedList &params)
virtual SS7TCAPTransaction * buildTransaction(SS7TCAP::TCAPUserTransActions type, const String &transactID, NamedList &params, bool initLocal=true)
SS7 TCAP component implementation.
Definition yatesig.h:11595
virtual const String & correlationID() const
Definition yatesig.h:11687
bool timedOut()
Definition yatesig.h:11694
SS7TCAP::TCAPUserCompActions type()
Definition yatesig.h:11666
void setState(TCAPComponentState state)
void setType(SS7TCAP::TCAPUserCompActions type)
Definition yatesig.h:11660
TCAPComponentState state()
Definition yatesig.h:11707
void setTransaction(SS7TCAPTransaction *transact)
TCAPComponentState
Definition yatesig.h:11600
virtual void setInvokeID(String invokeID)
Definition yatesig.h:11673
static SS7TCAPComponent * componentFromNamedList(SS7TCAP::TCAPType type, SS7TCAPTransaction *tr, NamedList &params, unsigned int index)
virtual const String & toString() const
Definition yatesig.h:11680
SS7TCAP::TCAPComponentOperationClass operationClass()
Definition yatesig.h:11721
SS7TCAPComponent(SS7TCAP::TCAPType type, SS7TCAPTransaction *trans, NamedList &params, unsigned int index)
virtual void update(NamedList &params, unsigned int index)
void resetTimer(NamedList &params, unsigned int index)
virtual void fill(unsigned int index, NamedList &fillIn)
static const TokenDict s_compStates[]
Definition yatesig.h:11727
virtual ~SS7TCAPComponent()
SS7TCAPTransaction * transaction()
Definition yatesig.h:11184
void setError(ErrorType error)
Definition yatesig.h:11265
SS7TCAPError(SS7TCAP::TCAPType tcapType, ErrorType error)
SS7TCAPError(SS7TCAP::TCAPType tcapType)
static u_int16_t codeFromError(SS7TCAP::TCAPType tcapType, int err)
static int errorFromCode(SS7TCAP::TCAPType tcapType, u_int16_t code)
u_int16_t errorCode()
ErrorType error()
Definition yatesig.h:11258
static const TokenDict s_errorTypes[]
Definition yatesig.h:11299
const String errorName()
virtual SS7TCAPTransaction * buildTransaction(SS7TCAP::TCAPUserTransActions type, const String &transactID, NamedList &params, bool initLocal=true)
SS7TCAPITU(const NamedList &params)
TCAP message wrapper.
Definition yatesig.h:10742
DataBlock & msgData()
Definition yatesig.h:10765
NamedList & msgParams()
Definition yatesig.h:10758
SS7TCAPMessage(NamedList &params, DataBlock &data, bool notice=false)
Definition yatesig.h:10750
bool & isNotice()
Definition yatesig.h:10772
virtual SS7TCAPError handleData(NamedList &params, DataBlock &data)
static void encodePAbort(SS7TCAPTransaction *tr, NamedList &params, DataBlock &data)
virtual void updateState(bool byUser)
static SS7TCAPError decodePAbort(SS7TCAPTransaction *tr, NamedList &params, DataBlock &data)
SS7TCAPTransactionANSI(SS7TCAP *tcap, SS7TCAP::TCAPUserTransActions type, const String &transactID, NamedList &params, u_int64_t timeout, bool initLocal=true)
virtual void requestContent(NamedList &params, DataBlock &data)
virtual SS7TCAPError update(SS7TCAP::TCAPUserTransActions type, NamedList &params, bool updateByUser=true)
virtual void updateToEnd()
virtual SS7TCAPError handleDialogPortion(NamedList &params, bool byUser=true)
static const TokenDict s_ansiTransactTypes[]
Definition yatesig.h:11930
virtual SS7TCAPError handleData(NamedList &params, DataBlock &data)
void encodeDialogPortion(NamedList &params, DataBlock &data)
static void encodePAbort(SS7TCAPTransaction *tr, NamedList &params, DataBlock &data)
static const TokenDict s_dialogPDUs[]
Definition yatesig.h:12172
SS7TCAPError decodeDialogPortion(NamedList &params, DataBlock &data)
SS7TCAPTransactionITU(SS7TCAP *tcap, SS7TCAP::TCAPUserTransActions type, const String &transactID, NamedList &params, u_int64_t timeout, bool initLocal=true)
static SS7TCAPError decodePAbort(SS7TCAPTransaction *tr, NamedList &params, DataBlock &data)
void updateState(bool byUser=false)
virtual void abnormalDialogInfo(NamedList &params)
bool dialogPresent()
Definition yatesig.h:12125
virtual void requestContent(NamedList &params, DataBlock &data)
virtual SS7TCAPError update(SS7TCAP::TCAPUserTransActions type, NamedList &params, bool updateByUser=true)
bool testForDialog(DataBlock &data)
virtual void updateToEnd()
static const TokenDict s_resultPDUValues[]
Definition yatesig.h:12177
virtual SS7TCAPError handleDialogPortion(NamedList &params, bool byUser=true)
SS7 TCAP transaction implementation.
Definition yatesig.h:11311
virtual SS7TCAPError decodeComponents(NamedList &params, DataBlock &data)=0
const String & userName()
Definition yatesig.h:11482
virtual SS7TCAPError handleComponents(NamedList &params, bool updateByUser=true)
bool timedOut()
Definition yatesig.h:11517
virtual SS7TCAPError buildComponentError(SS7TCAPError &error, NamedList &params, DataBlock &data)
const String & toString() const
Definition yatesig.h:11468
TransactionState transactionState()
Definition yatesig.h:11441
void setState(TransactionState state)
Definition yatesig.h:11428
virtual void requestContent(NamedList &params, DataBlock &data)=0
virtual SS7TCAPError decodeDialogPortion(NamedList &params, DataBlock &data)=0
virtual void encodeComponents(NamedList &params, DataBlock &data)=0
void setTransactionType(SS7TCAP::TCAPUserTransActions type)
Definition yatesig.h:11414
bool endNow()
Definition yatesig.h:11503
virtual void requestComponents(NamedList &params, DataBlock &data)
SS7TCAP::TCAPUserTransActions transactionType()
Definition yatesig.h:11421
virtual SS7TCAPError update(SS7TCAP::TCAPUserTransActions type, NamedList &params, bool updateByUser=true)=0
SS7TCAPComponent * findComponent(const String &id)
virtual void transactionData(NamedList &params)
virtual void updateState(bool byUser=true)=0
virtual void encodeDialogPortion(NamedList &params, DataBlock &data)=0
TransactionTransmit transmitState()
Definition yatesig.h:11454
void addSCCPAddressing(NamedList &fillParams, bool local)
virtual SS7TCAPError handleDialogPortion(NamedList &params, bool byUser=true)=0
virtual void checkComponents()
virtual void abnormalDialogInfo(NamedList &params)
SS7TCAP * tcap()
Definition yatesig.h:11461
void endNow(bool endNow)
Definition yatesig.h:11510
bool basicEnd()
Definition yatesig.h:11489
SS7TCAPTransaction(SS7TCAP *tcap, SS7TCAP::TCAPUserTransActions type, const String &transactID, NamedList &params, u_int64_t timeout, bool initLocal=true)
void setUserName(const String &name)
Definition yatesig.h:11475
void setTransmitState(TransactionTransmit state)
virtual SS7TCAPError handleData(NamedList &params, DataBlock &data)=0
virtual void updateToEnd()
SS7 TCAP implementation.
Definition yatesig.h:10786
SS7TCAPTransaction * getTransaction(const String &tid)
virtual void buildSCCPData(NamedList &params, SS7TCAPTransaction *tr)
virtual const String allocTransactionID()
virtual HandledMSU receivedData(DataBlock &data, NamedList &params)
virtual void userStatus(NamedList &status)
virtual ~SS7TCAP()
TCAPCounter
Definition yatesig.h:10847
static const char * lookupComponent(int comp)
Definition yatesig.h:11133
virtual HandledMSU notifyData(DataBlock &data, NamedList &params)
virtual void updateUserStatus(TCAPUser *user, SCCPManagement::LocalBroadcast status, NamedList &params)
TCAPUserTransActions
Definition yatesig.h:10818
void allocTransactionID(String &str)
virtual void status(NamedList &status)
TCAPType
Definition yatesig.h:10792
virtual HandledMSU handleError(SS7TCAPError &error, NamedList &params, DataBlock &data, SS7TCAPTransaction *tr=0)
static int lookupComponent(const char *comp)
Definition yatesig.h:11141
static const char * lookupTransaction(int tr)
Definition yatesig.h:11117
static int lookupTransaction(const char *tr)
Definition yatesig.h:11125
TCAPUserCompActions
Definition yatesig.h:10801
void attach(TCAPUser *user)
virtual bool sendData(DataBlock &data, NamedList &params)
void detach(TCAPUser *user)
SS7TCAP(const NamedList &params)
virtual bool sendToUser(NamedList &params)
TCAPType tcapType()
Definition yatesig.h:10933
virtual bool initialize(const NamedList *config)
virtual SS7TCAPTransaction * buildTransaction(SS7TCAP::TCAPUserTransActions type, const String &transactID, NamedList &params, bool initLocal=true)=0
void incCounter(TCAPCounter counterType)
Definition yatesig.h:11065
TCAPComponentOperationClass
Definition yatesig.h:10837
void removeTransaction(SS7TCAPTransaction *tr)
void setTCAPType(TCAPType type)
Definition yatesig.h:10940
static const TokenDict s_transPrimitives[]
Definition yatesig.h:10980
static const TokenDict s_tcapVersion[]
Definition yatesig.h:10970
virtual HandledMSU processSCCPData(SS7TCAPMessage *sccpData)
static const TokenDict s_compPrimitives[]
Definition yatesig.h:10975
virtual void enqueue(SS7TCAPMessage *msg)
virtual SS7TCAPMessage * dequeue()
static const TokenDict s_compOperClasses[]
Definition yatesig.h:10985
virtual void timerTick(const Time &when)
unsigned int count(TCAPCounter counterType)
Definition yatesig.h:11093
bool managementNotify(SCCP::Type type, NamedList &params)
virtual SS7TCAPError userRequest(NamedList &requestParams)
virtual ~SS7TUP()
SS7TUP(const NamedList &params, unsigned char sif=SS7MSU::TUP)
virtual HandledMSU receivedMSU(const SS7MSU &msu, const SS7Label &label, SS7Layer3 *network, int sls)
virtual void notify(SS7Layer3 *link, int sls)
SS7Testing(const NamedList &params, unsigned char sio=SS7MSU::MTP_T|SS7MSU::National)
Definition yatesig.h:8545
virtual bool initialize(const NamedList *config)
virtual void timerTick(const Time &when)
virtual bool control(NamedList &params)
SCCPManagement::SccpStates getState()
Definition yatesig.h:10037
void appendBackup(RemoteBackupSubsystem *backup)
Definition yatesig.h:10115
void setState(SCCPManagement::SccpStates newState)
Definition yatesig.h:10030
unsigned char getSmi()
Definition yatesig.h:10080
void stopCoordTimer()
Definition yatesig.h:10073
unsigned char getSSN()
Definition yatesig.h:10023
void dump(String &dest)
void manageTimeout(SCCPManagement *mgm)
bool receivedSOG(unsigned char ssn, int pointcode)
void clearBackups()
Definition yatesig.h:10105
virtual ~SccpLocalSubsystem()
void resetTimers()
Definition yatesig.h:10100
bool ignoreTests()
Definition yatesig.h:10049
SccpLocalSubsystem(unsigned char ssn, u_int64_t coordInterval, u_int64_t istInterval, unsigned char smi=0)
void setIgnoreTests(bool ignore)
void startCoord()
Definition yatesig.h:10043
Definition yatesig.h:10134
ObjList & getSubsystems()
Definition yatesig.h:10224
unsigned int getCongestion()
Definition yatesig.h:10244
SCCPManagement::SccpStates getState()
Definition yatesig.h:10168
bool initialize(const String &params)
void setState(SCCPManagement::SccpStates state)
SccpRemote(unsigned int pointcode, SS7PointCode::Type pcType)
void setCongestion(unsigned int cl)
Definition yatesig.h:10231
const char * getPointCodeType()
Definition yatesig.h:10202
void resetCongestion()
Definition yatesig.h:10237
SccpSubsystem * getSubsystem(int ssn)
const SS7PointCode & getPointCode()
Definition yatesig.h:10188
int getPackedPointcode()
Definition yatesig.h:10195
virtual ~SccpRemote()
SccpRemote(SS7PointCode::Type pcType)
bool changeSubsystemState(int ssn, SCCPManagement::SccpStates newState)
void dump(String &dest, bool extended=false)
Definition yatesig.h:9896
SCCPManagement::SccpStates getState()
Definition yatesig.h:9923
void setState(SCCPManagement::SccpStates state)
Definition yatesig.h:9930
unsigned char getSmi()
Definition yatesig.h:9937
SccpSubsystem(int ssn, SCCPManagement::SccpStates state=SCCPManagement::Allowed, unsigned char smi=0)
Definition yatesig.h:9905
unsigned char getSSN()
Definition yatesig.h:9916
void dump(String &dest)
Definition yatesig.h:9944
Abstract phone call signalling.
Definition yatesig.h:1022
SignallingCircuitGroup * circuits() const
Definition yatesig.h:1104
virtual SignallingEvent * getEvent(const Time &when)
virtual SignallingCall * call(SignallingMessage *msg, String &reason)
Definition yatesig.h:1187
const ObjList & calls() const
Definition yatesig.h:1111
virtual void buildVerifyEvent(NamedList &params)
Definition yatesig.h:1194
String m_msgPrefix
Definition yatesig.h:1254
bool reserveCircuit(SignallingCircuit *&cic, const char *range=0, int checkLock=-1, const String *list=0, bool mandatory=true, bool reverseRestrict=false)
virtual ~SignallingCallControl()
bool exiting() const
Definition yatesig.h:1069
const String & location() const
Definition yatesig.h:1056
MediaRequired mediaRequired() const
Definition yatesig.h:1089
virtual void cleanup(const char *reason="net-out-of-order")
Definition yatesig.h:1171
const String & msgPrefix() const
Definition yatesig.h:1097
void setExiting()
Definition yatesig.h:1062
String m_location
Definition yatesig.h:1275
bool verify()
Definition yatesig.h:1076
virtual bool processEvent(SignallingEvent *event)
Definition yatesig.h:1212
int strategy() const
Definition yatesig.h:1202
void setVerify(bool restartTimer=false, bool fireNow=false, const Time *time=0)
bool releaseCircuit(unsigned int code, bool sync=false)
static const TokenDict s_mediaRequired[]
Definition yatesig.h:1280
SignallingCallControl(const NamedList &params, const char *msgPrefix=0)
MediaRequired
Definition yatesig.h:1032
SignallingTimer m_verifyTimer
Definition yatesig.h:1270
bool releaseCircuit(SignallingCircuit *&cic, bool sync=false)
virtual const char * statusName() const =0
virtual SignallingEvent * processCircuitEvent(SignallingCircuitEvent *&event, SignallingCall *call=0)
Definition yatesig.h:1221
bool m_verifyEvent
Definition yatesig.h:1265
MediaRequired m_mediaRequired
Definition yatesig.h:1259
SignallingCircuitGroup * attach(SignallingCircuitGroup *circuits)
void removeCall(SignallingCall *call, bool del=false)
ObjList m_calls
Definition yatesig.h:1248
Abstract single phone call.
Definition yatesig.h:1293
void * userdata() const
Definition yatesig.h:1332
SignallingMessage * dequeue(bool remove=true)
SignallingEvent * m_lastEvent
Definition yatesig.h:1401
void clearQueue()
Definition yatesig.h:1392
void enqueue(SignallingMessage *msg)
bool m_overlap
Definition yatesig.h:1406
void userdata(void *data)
Definition yatesig.h:1325
SignallingCall(SignallingCallControl *controller, bool outgoing, bool signalOnly=false)
virtual SignallingEvent * getEvent(const Time &when)=0
virtual void eventTerminated(SignallingEvent *event)
bool signalOnly() const
Definition yatesig.h:1339
SignallingCallControl * controller() const
Definition yatesig.h:1318
bool overlapDialing() const
Definition yatesig.h:1346
bool outgoing() const
Definition yatesig.h:1312
virtual ~SignallingCall()
virtual bool sendEvent(SignallingEvent *event)
Definition yatesig.h:1354
A single signalling circuit related event.
Definition yatesig.h:1549
Type
Definition yatesig.h:1554
SignallingCircuit * circuit()
Definition yatesig.h:1608
virtual ~SignallingCircuitEvent()
SignallingCircuitEvent(SignallingCircuit *cic, Type type, const char *name=0)
Type type() const
Definition yatesig.h:1601
Group of data circuits used by signalling.
Definition yatesig.h:2116
void removeSpan(SignallingCircuitSpan *span, bool delCics=true, bool delSpan=false)
void removeSpanCircuits(SignallingCircuitSpan *span)
void remove(SignallingCircuit *circuit)
virtual void destroyed()
Definition yatesig.h:2348
void getCicList(String &dest)
SignallingCircuitSpan * buildSpan(const String &name, unsigned int start=0, NamedList *params=0)
SignallingCircuitRange * findRange(const char *name)
bool status(unsigned int cic, SignallingCircuit::Status newStat, bool sync=false)
void insertRange(SignallingCircuitSpan *span, const char *name, int strategy=-1)
bool insert(SignallingCircuit *circuit)
SignallingCircuit * reserve(int checkLock=-1, int strategy=-1, SignallingCircuitRange *range=0)
virtual ~SignallingCircuitGroup()
unsigned int base() const
Definition yatesig.h:2166
SignallingCircuit::Status status(unsigned int cic)
int strategy() const
Definition yatesig.h:2180
unsigned int last() const
Definition yatesig.h:2173
static const TokenDict s_strategy[]
Definition yatesig.h:2342
SignallingCircuitGroup(unsigned int base=0, int strategy=Increment, const char *name="circgroup")
SignallingCircuit * reserve(const String &list, bool mandatory, int checkLock=-1, int strategy=-1, SignallingCircuitRange *range=0)
unsigned int count() const
Definition yatesig.h:2159
Strategy
Definition yatesig.h:2126
bool insertSpan(SignallingCircuitSpan *span)
static int str2strategy(const char *name, int def=Increment)
Definition yatesig.h:2336
ObjList & circuits()
Definition yatesig.h:2193
SignallingCircuit * find(unsigned int cic, bool local=false)
void setStrategy(int strategy)
Definition yatesig.h:2187
bool release(SignallingCircuit *cic, bool sync=false)
Definition yatesig.h:2327
void insertRange(const String &range, const char *name, int strategy=-1)
A circuit range (set of circuits)
Definition yatesig.h:1984
virtual ~SignallingCircuitRange()
Definition yatesig.h:2000
void remove(unsigned int code)
void add(unsigned int first, unsigned int last)
virtual void destruct()
Definition yatesig.h:2095
SignallingCircuitRange(const String &rangeStr, const char *name=0, int strategy=-1)
unsigned int operator[](unsigned int index)
Definition yatesig.h:2037
bool find(unsigned int code)
bool set(const String &rangeStr)
Definition yatesig.h:2045
void add(unsigned int *codes, unsigned int len)
const unsigned int * range() const
Definition yatesig.h:2014
void clear()
Definition yatesig.h:2029
void add(unsigned int code)
Definition yatesig.h:2069
unsigned int count() const
Definition yatesig.h:2007
unsigned int * copyRange(unsigned int &count) const
bool add(const String &rangeStr)
A span in a circuit group.
Definition yatesig.h:2370
SignallingCircuitGroup * group() const
Definition yatesig.h:2382
unsigned int m_increment
Definition yatesig.h:2415
unsigned int increment() const
Definition yatesig.h:2396
const String & id() const
Definition yatesig.h:2389
virtual ~SignallingCircuitSpan()
SignallingCircuitSpan(const char *id=0, SignallingCircuitGroup *group=0)
SignallingCircuitGroup * m_group
Definition yatesig.h:2410
Abstract data circuit used by signalling.
Definition yatesig.h:1627
virtual bool getParam(const String &param, String &value) const
Definition yatesig.h:1764
virtual bool updateFormat(const char *format, int direction)
Definition yatesig.h:1739
bool hwLock(bool set, bool remote, bool changed=false, bool setChanged=false)
bool disconnect()
Definition yatesig.h:1862
Type
Definition yatesig.h:1635
virtual bool setParam(const String &param, const String &value)
Definition yatesig.h:1748
const SignallingCircuitGroup * group() const
Definition yatesig.h:1812
virtual void clearEvents()
virtual bool getBoolParam(const String &param, bool defValue=false) const
Definition yatesig.h:1773
SignallingCircuitSpan * span()
Definition yatesig.h:1805
bool reserve()
Definition yatesig.h:1847
virtual bool getParams(NamedList &params, const String &category=String::empty())
Definition yatesig.h:1791
SignallingCircuitEvent * getEvent(const Time &when)
Status
Definition yatesig.h:1646
virtual int getIntParam(const String &param, int defValue=0) const
Definition yatesig.h:1782
void resetLock(int flags)
Definition yatesig.h:1730
Mutex m_mutex
Definition yatesig.h:1962
bool maintLock(bool set, bool remote, bool changed=false, bool setChanged=false)
static const TokenDict s_lockNames[]
Definition yatesig.h:1932
static const char * lookupType(int type)
bool connect(const char *format=0)
Definition yatesig.h:1855
virtual bool status(Status newStat, bool sync=false)
Definition yatesig.h:1694
void setLock(int flags)
Definition yatesig.h:1723
SignallingCircuit(Type type, unsigned int code, SignallingCircuitGroup *group=0, SignallingCircuitSpan *span=0)
bool available() const
Definition yatesig.h:1833
bool connected() const
Definition yatesig.h:1840
SignallingCircuitGroup * group()
Definition yatesig.h:1798
LockFlags
Definition yatesig.h:1660
const SignallingCircuitSpan * span() const
Definition yatesig.h:1819
virtual bool sendEvent(SignallingCircuitEvent::Type type, NamedList *params=0)
int locked(int flags=-1) const
Definition yatesig.h:1716
virtual ~SignallingCircuit()
virtual bool setParams(const NamedList &params)
void addEvent(SignallingCircuitEvent *event)
Status status() const
Definition yatesig.h:1708
Type type() const
Definition yatesig.h:1701
unsigned int code() const
Definition yatesig.h:1826
bool disable()
Definition yatesig.h:1869
static const char * lookupStatus(int status)
SignallingCircuit(Type type, unsigned int code, Status status, SignallingCircuitGroup *group=0, SignallingCircuitSpan *span=0)
void eventTerminated(SignallingCircuitEvent *event)
Abstract signalling component that can be managed by the engine.
Definition yatesig.h:635
const String & componentType() const
Definition yatesig.h:713
virtual void destroyed()
static bool resolveConfig(const String &cmpName, NamedList &params, const NamedList *config)
virtual bool controlExecute(NamedList *params)
virtual NamedList * controlCreate(const char *oper=0)
void insert(SignallingComponent *component)
SignallingComponent(const char *name=0, const NamedList *params=0, const char *type="unknown")
void setCompType(const char *type)
Definition yatesig.h:762
virtual void engine(SignallingEngine *eng)
virtual void detach()
virtual bool initialize(const NamedList *config)
virtual const String & toString() const
SignallingEngine * engine() const
Definition yatesig.h:698
virtual ~SignallingComponent()
void setName(const char *name)
unsigned long tickSleep(unsigned long usec=1000000) const
virtual void timerTick(const Time &when)
int debugLevel(int level)
Definition yatesig.h:706
virtual bool control(NamedList &params)
A counter class.
Definition yatesig.h:504
bool empty() const
Definition yatesig.h:570
SignallingCounter(u_int32_t maxVal)
Definition yatesig.h:510
bool full() const
Definition yatesig.h:577
bool inc()
Definition yatesig.h:546
u_int32_t count() const
Definition yatesig.h:532
void maxVal(u_int32_t value)
Definition yatesig.h:518
bool dec()
Definition yatesig.h:558
void reset(bool down=true)
Definition yatesig.h:539
u_int32_t maxVal() const
Definition yatesig.h:525
~SignallingDumpable()
Definition yatesig.h:297
bool dump(void *buf, unsigned int len, bool sent=false, int link=0)
Definition yatesig.h:318
bool control(NamedList &params, SignallingComponent *owner=0)
void setDumpNetwork(bool network)
Definition yatesig.h:335
bool setDumper(const String &name, bool create=true, bool append=false)
bool dump(const DataBlock &data, bool sent=false, int link=0)
Definition yatesig.h:328
void setDumper(SignallingDumper *dumper=0)
SignallingDumpable(SignallingDumper::Type type, bool network=false)
Definition yatesig.h:306
A generic data dumper.
Definition yatesig.h:177
Type
Definition yatesig.h:182
bool network() const
Definition yatesig.h:216
bool dump(void *buf, unsigned int len, bool sent=false, int link=0)
static SignallingDumper * create(Stream *stream, Type type, bool network=false, bool writeHeader=true)
bool dump(const DataBlock &data, bool sent=false, int link=0)
Definition yatesig.h:254
void setStream(Stream *stream=0, bool writeHeader=true)
SignallingDumper(Type type=Hexa, bool network=false)
bool active() const
static SignallingDumper * create(DebugEnabler *dbg, const char *filename, Type type, bool network=false, bool create=true, bool append=false)
Type type() const
Definition yatesig.h:209
Main signalling component holder.
Definition yatesig.h:785
static void destruct(Obj *&obj)
Definition yatesig.h:943
SignallingComponent * find(const String &name)
void removeNotifier(SignallingNotifier *notifier)
Definition yatesig.h:898
bool start(const char *name="Sig Engine", Thread::Priority prio=Thread::Normal, unsigned long usec=0)
SignallingEngine(const char *name="signalling")
ObjList m_components
Definition yatesig.h:963
void remove(SignallingComponent *component)
void insert(SignallingComponent *component)
virtual unsigned long timerTick(const Time &when)
SignallingComponent * find(const String &name, const String &type, const SignallingComponent *start=0)
void setNotifier(SignallingNotifier *notifier)
Definition yatesig.h:891
bool remove(const String &name)
virtual ~SignallingEngine()
bool control(NamedList &params)
static SignallingEngine * self(bool create=false)
bool find(const SignallingComponent *component)
SignallingComponent * build(const String &type, NamedList &params, bool init=false, bool ref=true)
unsigned long tickDefault() const
Definition yatesig.h:922
static void maxLockWait(long maxWait)
unsigned long tickSleep(unsigned long usec=1000000)
Thread * thread() const
static long maxLockWait()
Definition yatesig.h:929
void notify(SignallingComponent *component, NamedList notifs)
A single signalling related event.
Definition yatesig.h:1422
SignallingCall * call() const
Definition yatesig.h:1500
Type
Definition yatesig.h:1427
SignallingMessage * message() const
Definition yatesig.h:1506
SignallingEvent(Type type, SignallingMessage *message, SignallingCallControl *controller=0)
const char * name() const
Definition yatesig.h:1487
virtual ~SignallingEvent()
SignallingEvent(Type type, SignallingMessage *message, SignallingCall *call)
SignallingEvent(SignallingCircuitEvent *&event, SignallingCall *call)
Type type() const
Definition yatesig.h:1494
SignallingCallControl * controller() const
Definition yatesig.h:1512
static const char * typeName(Type t)
Definition yatesig.h:1526
SignallingCircuitEvent * cicEvent() const
Definition yatesig.h:1518
static SignallingComponent * build(const String &type, NamedList *name=0)
SignallingFactory(bool fallback=false)
virtual SignallingComponent * create(const String &type, NamedList &name)=0
virtual ~SignallingFactory()
static void * buildInternal(const String &type, NamedList *name)
PacketType
Definition yatesig.h:2471
virtual bool transmitPacket(const DataBlock &packet, bool repeat, PacketType type)=0
static const TokenDict s_notifName[]
Definition yatesig.h:2518
bool notify(Notification event)
virtual bool control(Operation oper, NamedList *params=0)
virtual ~SignallingInterface()
virtual void attach(SignallingReceiver *receiver)
SignallingReceiver * receiver() const
Definition yatesig.h:2501
Notification
Definition yatesig.h:2452
Operation
Definition yatesig.h:2433
SignallingInterface()
Definition yatesig.h:2482
bool receivedPacket(const DataBlock &packet)
A pending signalling message list.
Definition yatesig.h:2943
SignallingMessageTimer * add(SignallingMessageTimer *m, const Time &when=Time())
SignallingMessageTimerList()
Definition yatesig.h:2948
SignallingMessageTimer * add(u_int64_t interval, const Time &when=Time())
Definition yatesig.h:2957
SignallingMessageTimer * timeout(const Time &when=Time())
A pending signalling message.
Definition yatesig.h:2875
const SignallingTimer & global() const
Definition yatesig.h:2919
SignallingMessageTimer(u_int64_t interval, u_int64_t global=0)
Definition yatesig.h:2882
SignallingMessage * message() const
Definition yatesig.h:2897
SignallingTimer & global()
Definition yatesig.h:2912
u_int64_t fireTime() const
Definition yatesig.h:2926
void message(SignallingMessage *msg)
Definition yatesig.h:2904
virtual ~SignallingMessageTimer()
Definition yatesig.h:2890
Abstract signalling message.
Definition yatesig.h:978
SignallingMessage(const char *name=0)
Definition yatesig.h:985
const char * name() const
Definition yatesig.h:993
NamedList m_params
Definition yatesig.h:1014
const NamedList & params() const
Definition yatesig.h:1007
NamedList & params()
Definition yatesig.h:1000
Notifier class.
Definition yatesig.h:373
virtual void cleanup()
virtual ~SignallingNotifier()
Definition yatesig.h:378
virtual void notify(NamedList &notifs)
virtual bool notify(SignallingInterface::Notification event)
bool transmitPacket(const DataBlock &packet, bool repeat, SignallingInterface::PacketType type=SignallingInterface::Unknown)
bool control(SignallingInterface::Operation oper, NamedList *params=0)
virtual ~SignallingReceiver()
SignallingReceiver(const char *name=0)
virtual bool receivedPacket(const DataBlock &packet)=0
SignallingInterface * iface() const
Definition yatesig.h:2581
virtual SignallingInterface * attach(SignallingInterface *iface)
A signalling timer.
Definition yatesig.h:396
void interval(const NamedList &params, const char *param, unsigned int minVal, unsigned int defVal, bool allowDisable, bool sec=false)
Definition yatesig.h:424
SignallingTimer(u_int64_t interval, u_int64_t time=0)
Definition yatesig.h:403
u_int64_t fireTime() const
Definition yatesig.h:442
void stop()
Definition yatesig.h:462
bool timeout(u_int64_t time=Time::msecNow()) const
Definition yatesig.h:477
void fire(u_int64_t time=Time::msecNow())
Definition yatesig.h:456
static unsigned int getInterval(const NamedList &params, const char *param, unsigned int minVal, unsigned int defVal, unsigned int maxVal=0, bool allowDisable=false)
u_int64_t interval() const
Definition yatesig.h:435
bool started() const
Definition yatesig.h:469
void start(u_int64_t time=Time::msecNow())
Definition yatesig.h:449
void interval(u_int64_t value)
Definition yatesig.h:411
Library wide services and data provider.
Definition yatesig.h:2651
static bool appendFlag(NamedList &list, const char *param, const char *flag)
static bool decodeCaps(const SignallingComponent *comp, NamedList &list, const unsigned char *buf, unsigned int len, const char *prefix, bool isup)
static unsigned int encodeFlags(const SignallingComponent *comp, const String &flags, const SignallingFlags *dict, const char *paramName=0)
static bool encodeCause(const SignallingComponent *comp, DataBlock &buf, const NamedList &params, const char *prefix, bool isup, bool fail=false)
static bool hasFlag(const NamedList &list, const char *param, const char *flag)
static const TokenDict * locations()
static const TokenDict * dict(unsigned int index, unsigned char coding=0)
Definition yatesig.h:2676
static bool decodeCause(const SignallingComponent *comp, NamedList &list, const unsigned char *buf, unsigned int len, const char *prefix, bool isup)
static bool encodeCaps(const SignallingComponent *comp, DataBlock &buf, const NamedList &params, const char *prefix, bool isup)
static void dumpData(const SignallingComponent *comp, NamedList &list, const char *param, const unsigned char *buf, unsigned int len, char sep=' ')
static void addKeyword(NamedList &list, const char *param, const TokenDict *tokens, unsigned int val)
static bool appendFlag(String &flags, const char *flag)
static unsigned int * parseUIntArray(const String &source, unsigned int minVal, unsigned int maxVal, unsigned int &count, bool discardDup)
static unsigned int dumpDataExt(const SignallingComponent *comp, NamedList &list, const char *param, const unsigned char *buf, unsigned int len, char sep=' ')
static bool hasFlag(const String &flags, const char *flag)
static const TokenDict * codings()
static void encodeFlags(const SignallingComponent *comp, int &dest, const String &flags, const TokenDict *dict)
static bool decodeFlags(const SignallingComponent *comp, NamedList &list, const char *param, const SignallingFlags *flags, const unsigned char *buf, unsigned int len)
static bool removeFlag(String &flags, const char *flag)
A socket address holder.
Definition yateclass.h:6400
An abstract stream class capable of reading and writing.
Definition yateclass.h:6874
A C-style string handling class.
Definition yateclass.h:2131
const char * c_str() const
Definition yateclass.h:2236
static const String & empty()
bool startTest(SccpRemote *remoteSccp, SccpSubsystem *rSubsystem)
void setAllowed(bool allowed)
Definition yatesig.h:5431
SccpRemote * getRemote()
Definition yatesig.h:5400
bool markAllowed()
Definition yatesig.h:5424
SccpSubsystem * getSubsystem()
Definition yatesig.h:5413
virtual ~SubsystemStatusTest()
bool timeout()
Definition yatesig.h:5407
SubsystemStatusTest(u_int32_t interval)
Definition yatesig.h:5378
Abstract SS7 TCAP user interface.
Definition yatesig.h:5565
virtual bool tcapIndication(NamedList &params)
virtual void attach(SS7TCAP *tcap)
SS7TCAP * tcap() const
Definition yatesig.h:5595
virtual void destroyed()
virtual bool managementNotify(SCCP::Type type, NamedList &params)
virtual ~TCAPUser()
virtual int managementState()
Thread support class.
Definition yateclass.h:6005
Priority
Definition yateclass.h:6014
A time holding class.
Definition yateclass.h:3927
static u_int32_t secNow()
static u_int64_t msecNow()
Definition yatemime.h:34
String & operator<<(String &str, const Complex &c)
Definition yatemath.h:1685
Description of parameter flags.
Definition yatesig.h:2629
unsigned int value
Definition yatesig.h:2638
const char * name
Definition yatesig.h:2643
unsigned int mask
Definition yatesig.h:2633
Definition yateclass.h:848