OPAL  Version 3.14.3
gkserver.h
Go to the documentation of this file.
1 /*
2  * gkserver.h
3  *
4  * H225 Registration Admission and Security protocol handler
5  *
6  * Open H323 Library
7  *
8  * Copyright (c) 1998-2001 Equivalence Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Open H323 Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * This code was based on original code from OpenGate of Egoboo Ltd. thanks
25  * to Ashley Unitt for his efforts.
26  *
27  * Contributor(s): ______________________________________.
28  *
29  * $Revision: 32064 $
30  * $Author: rjongbloed $
31  * $Date: 2014-06-04 18:00:24 +1000 (Wed, 04 Jun 2014) $
32  */
33 
34 #ifndef OPAL_H323_GKSERVER_H
35 #define OPAL_H323_GKSERVER_H
36 
37 #ifdef P_USE_PRAGMA
38 #pragma interface
39 #endif
40 
41 #include <opal_config.h>
42 
43 #if OPAL_H323
44 
45 #include <ptlib/safecoll.h>
46 #include <opal/guid.h>
47 #include <h323/h225ras.h>
48 #include <h323/transaddr.h>
49 #include <h323/h235auth.h>
50 #include <h323/h323pdu.h>
51 #include <h323/h323trans.h>
52 
53 
54 class PASN_Sequence;
55 class PASN_Choice;
56 
57 class H225_AliasAddress;
58 class H225_EndpointIdentifier;
59 class H225_GatekeeperIdentifier;
60 class H225_ArrayOf_TransportAddress;
61 class H225_GatekeeperIdentifier;
62 class H225_EndpointIdentifier;
63 class H225_InfoRequestResponse_perCallInfo_subtype;
64 class H225_RasUsageInformation;
65 
69 class H323RasPDU;
70 
71 #if OPAL_H501
72 class H323PeerElement;
73 #endif
74 
76 {
78  public:
84  H323GatekeeperListener & rasChannel,
85  const H323RasPDU & pdu
86  );
88 
89  virtual H323TransactionPDU * CreateRIP(
90  unsigned sequenceNumber,
91  unsigned delay
92  ) const;
93 
94  virtual PBoolean WritePDU(
95  H323TransactionPDU & pdu
96  );
97  virtual bool CheckCryptoTokens();
99  bool GetRegisteredEndPoint();
100 
101  virtual PString GetGatekeeperIdentifier() const = 0;
102  virtual unsigned GetGatekeeperRejectTag() const = 0;
103  virtual PString GetEndpointIdentifier() const = 0;
104  virtual unsigned GetRegisteredEndPointRejectTag() const = 0;
105 
107 
108  PSafePtr<H323RegisteredEndPoint> m_endpoint;
109 
110  protected:
112 };
113 
114 
116 {
118  public:
120  H323GatekeeperListener & listener,
121  const H323RasPDU & pdu
122  );
123 
124 #if PTRACING
125  virtual const char * GetName() const;
126 #endif
127  virtual PString GetGatekeeperIdentifier() const;
128  virtual unsigned GetGatekeeperRejectTag() const;
129  virtual PString GetEndpointIdentifier() const;
130  virtual unsigned GetRegisteredEndPointRejectTag() const;
131  virtual void PrepareConfirm();
133  virtual unsigned GetSecurityRejectTag() const;
134  virtual void SetRejectReason(
135  unsigned reasonCode
136  );
137 
138  H225_GatekeeperRequest & grq;
139  H225_GatekeeperConfirm & gcf;
140  H225_GatekeeperReject & grj;
141 
142  protected:
143  virtual Response OnHandlePDU();
144 };
145 
146 
148 {
150  public:
152  H323GatekeeperListener & listener,
153  const H323RasPDU & pdu
154  );
155 
156 #if PTRACING
157  virtual const char * GetName() const;
158 #endif
159  virtual PString GetGatekeeperIdentifier() const;
160  virtual unsigned GetGatekeeperRejectTag() const;
161  virtual PString GetEndpointIdentifier() const;
162  virtual unsigned GetRegisteredEndPointRejectTag() const;
164  virtual unsigned GetSecurityRejectTag() const;
165  virtual void SetRejectReason(
166  unsigned reasonCode
167  );
168 
169  H225_RegistrationRequest & rrq;
170  H225_RegistrationConfirm & rcf;
171  H225_RegistrationReject & rrj;
172 
173  protected:
174  virtual Response OnHandlePDU();
175 };
176 
177 
179 {
181  public:
183  H323GatekeeperListener & listener,
184  const H323RasPDU & pdu
185  );
186 
187 #if PTRACING
188  virtual const char * GetName() const;
189 #endif
190  virtual PString GetGatekeeperIdentifier() const;
191  virtual unsigned GetGatekeeperRejectTag() const;
192  virtual PString GetEndpointIdentifier() const;
193  virtual unsigned GetRegisteredEndPointRejectTag() const;
195  virtual unsigned GetSecurityRejectTag() const;
196  virtual void SetRejectReason(
197  unsigned reasonCode
198  );
199 
200  H225_UnregistrationRequest & urq;
201  H225_UnregistrationConfirm & ucf;
202  H225_UnregistrationReject & urj;
203 
204  protected:
205  virtual Response OnHandlePDU();
206 };
207 
208 
210 {
212  public:
214  H323GatekeeperListener & listener,
215  const H323RasPDU & pdu
216  );
217 
218 #if PTRACING
219  virtual const char * GetName() const;
220 #endif
221  virtual PString GetGatekeeperIdentifier() const;
222  virtual unsigned GetGatekeeperRejectTag() const;
223  virtual PString GetEndpointIdentifier() const;
224  virtual unsigned GetRegisteredEndPointRejectTag() const;
226  virtual unsigned GetSecurityRejectTag() const;
227  virtual void SetRejectReason(
228  unsigned reasonCode
229  );
230 
231  H225_AdmissionRequest & arq;
232  H225_AdmissionConfirm & acf;
233  H225_AdmissionReject & arj;
234 
236 
237  protected:
238  virtual Response OnHandlePDU();
239 };
240 
241 
243 {
245  public:
247  H323GatekeeperListener & listener,
248  const H323RasPDU & pdu
249  );
250 
251 #if PTRACING
252  virtual const char * GetName() const;
253 #endif
254  virtual PString GetGatekeeperIdentifier() const;
255  virtual unsigned GetGatekeeperRejectTag() const;
256  virtual PString GetEndpointIdentifier() const;
257  virtual unsigned GetRegisteredEndPointRejectTag() const;
259  virtual unsigned GetSecurityRejectTag() const;
260  virtual void SetRejectReason(
261  unsigned reasonCode
262  );
263 
264  H225_DisengageRequest & drq;
265  H225_DisengageConfirm & dcf;
266  H225_DisengageReject & drj;
267 
268  protected:
269  virtual Response OnHandlePDU();
270 };
271 
272 
274 {
276  public:
278  H323GatekeeperListener & listener,
279  const H323RasPDU & pdu
280  );
281 
282 #if PTRACING
283  virtual const char * GetName() const;
284 #endif
285  virtual PString GetGatekeeperIdentifier() const;
286  virtual unsigned GetGatekeeperRejectTag() const;
287  virtual PString GetEndpointIdentifier() const;
288  virtual unsigned GetRegisteredEndPointRejectTag() const;
290  virtual unsigned GetSecurityRejectTag() const;
291  virtual void SetRejectReason(
292  unsigned reasonCode
293  );
294 
295  H225_BandwidthRequest & brq;
296  H225_BandwidthConfirm & bcf;
297  H225_BandwidthReject & brj;
298 
299  protected:
300  virtual Response OnHandlePDU();
301 };
302 
303 
305 {
307  public:
309  H323GatekeeperListener & listener,
310  const H323RasPDU & pdu
311  );
312 
313 #if PTRACING
314  virtual const char * GetName() const;
315 #endif
316  virtual PString GetGatekeeperIdentifier() const;
317  virtual unsigned GetGatekeeperRejectTag() const;
318  virtual PString GetEndpointIdentifier() const;
319  virtual unsigned GetRegisteredEndPointRejectTag() const;
321  virtual unsigned GetSecurityRejectTag() const;
322  virtual void SetRejectReason(
323  unsigned reasonCode
324  );
325 
326  H225_LocationRequest & lrq;
327  H225_LocationConfirm & lcf;
328  H225_LocationReject & lrj;
329 
330  protected:
331  virtual Response OnHandlePDU();
332 };
333 
334 
336 {
338  public:
340  H323GatekeeperListener & listener,
341  const H323RasPDU & pdu
342  );
343 
344 #if PTRACING
345  virtual const char * GetName() const;
346 #endif
347  virtual PString GetGatekeeperIdentifier() const;
348  virtual unsigned GetGatekeeperRejectTag() const;
349  virtual PString GetEndpointIdentifier() const;
350  virtual unsigned GetRegisteredEndPointRejectTag() const;
352  virtual unsigned GetSecurityRejectTag() const;
353  virtual void SetRejectReason(
354  unsigned reasonCode
355  );
356 
357  H225_InfoRequestResponse & irr;
358  H225_InfoRequestAck & iack;
359  H225_InfoRequestNak & inak;
360 
361  protected:
362  virtual Response OnHandlePDU();
363 };
364 
365 
368 class H323GatekeeperCall : public PSafeObject
369 {
370  PCLASSINFO(H323GatekeeperCall, PSafeObject);
371  public:
374  enum Direction {
378  };
379 
383  H323GatekeeperServer & server,
384  const OpalGloballyUniqueID & callIdentifier,
385  Direction direction
386  );
387 
392 
397  Comparison Compare(
398  const PObject & obj
399  ) const;
400 
403  void PrintOn(
404  ostream & strm
405  ) const;
407 
416  H323GatekeeperARQ & request
417  );
418 
422  virtual PBoolean Disengage(
423  int reason = -1
424  );
425 
430  H323GatekeeperDRQ & request
431  );
432 
438  H323GatekeeperBRQ & request
439  );
440 
445  H323GatekeeperIRR & request,
446  H225_InfoRequestResponse_perCallInfo_subtype & call
447  );
448 
451  virtual void OnAlerting();
452 
455  virtual void OnConnected();
456 
467  virtual PBoolean OnHeartbeat();
468 
475  virtual PString GetCallCreditAmount() const;
476 
483  virtual PBoolean GetCallCreditMode() const;
484 
492  virtual unsigned GetDurationLimit() const;
493 
498  virtual PBoolean SendCallCreditServiceControl();
499 
503  H225_ArrayOf_ServiceControlSession & serviceControl
504  ) const;
505 
510  virtual PBoolean SendServiceControlSession(
511  const H323ServiceControlSession & session
512  );
513 
519  virtual PBoolean TranslateAliasAddress(
520  const H225_AliasAddress & alias,
521  H225_ArrayOf_AliasAddress & aliases,
522  H323TransportAddress & address,
523  PBoolean & isGkRouted
524  );
525 
527 
531  H323RegisteredEndPoint & GetEndPoint() const { return *PAssertNULL(m_endpoint); }
532  bool IsAnsweringCall() const { return m_direction == AnsweringCall; }
533  unsigned GetCallReference() const { return m_callReference; }
536  const PString & GetSourceNumber() const { return m_srcNumber; }
537  const PStringArray & GetSourceAliases() const { return m_srcAliases; }
538  const H323TransportAddress & GetSourceHost() const { return m_srcHost; }
539  PString GetSourceAddress() const;
540  const PString & GetDestinationNumber() const { return m_dstNumber; }
541  const PStringArray & GetDestinationAliases() const { return m_dstAliases; }
543  PString GetDestinationAddress() const;
544  unsigned GetBandwidthUsed() const { return m_bandwidthUsed; }
545  bool SetBandwidthUsed(unsigned bandwidth);
546  const PTime & GetLastInfoResponseTime() const { return m_lastInfoResponse; }
547  const PTime & GetCallStartTime() const { return m_callStartTime; }
548  const PTime & GetAlertingTime() const { return m_alertingTime; }
549  const PTime & GetConnectedTime() const { return m_connectedTime; }
550  const PTime & GetCallEndTime() const { return m_callEndTime; }
553 
554  protected:
555  void SetUsageInfo(const H225_RasUsageInformation & usage);
556 
560 
562  unsigned m_callReference;
565  PString m_srcNumber;
566  PStringArray m_srcAliases;
568  PString m_dstNumber;
569  PStringArray m_dstAliases;
571  unsigned m_bandwidthUsed;
574 
581 };
582 
583 
589 class H323RegisteredEndPoint : public PSafeObject
590 {
591  PCLASSINFO(H323RegisteredEndPoint, PSafeObject);
592  public:
598  H323GatekeeperServer & server,
599  const PString & id
600  );
602 
607  Comparison Compare(
608  const PObject & obj
609  ) const;
610 
613  void PrintOn(
614  ostream & strm
615  ) const;
617 
624  virtual void AddCall(
625  H323GatekeeperCall * call
626  );
627 
632  virtual PBoolean RemoveCall(
633  H323GatekeeperCall * call
634  );
635 
638  PINDEX GetCallCount() const { return m_activeCalls.GetSize(); }
639 
643  PINDEX idx
644  ) { return m_activeCalls[idx]; }
646 
656  H323GatekeeperRRQ & request
657  );
658 
669  H323GatekeeperRRQ & request
670  );
671 
681  H323GatekeeperRRQ & request
682  );
683 
688  H323GatekeeperURQ & request
689  );
690 
694  virtual PBoolean Unregister(
695  int reason = -1
696  );
697 
703  H323GatekeeperIRR & request
704  );
705 
716  virtual PBoolean OnTimeToLive();
717 
729  virtual PString GetCallCreditAmount() const;
730 
738  virtual PBoolean GetCallCreditMode() const;
739 
744  virtual PBoolean SendServiceControlSession(
745  const H323ServiceControlSession & session
746  );
747 
751  virtual PBoolean AddServiceControlSession(
752  const H323ServiceControlSession & session,
753  H225_ArrayOf_ServiceControlSession & serviceControl
754  );
756 
761  virtual PBoolean SetPassword(
762  const PString & password,
763  const PString & username = PString::Empty()
764  );
765 
768  const PString & GetIdentifier() const { return m_identifier; }
769 
773 
777 
782 
786  PINDEX GetRASAddressCount() const { return m_rasAddresses.GetSize(); }
787 
792  PINDEX idx
793  ) const { return m_rasAddresses[idx]; }
794 
799 
803  PINDEX GetSignalAddressCount() const { return m_signalAddresses.GetSize(); }
804 
809  PINDEX idx
810  ) const { return m_signalAddresses[idx]; }
811 
814  const PStringArray & GetAliases() const { return m_aliases; }
815 
819  const PString & alias
820  ) { return m_aliases.GetStringsIndex(alias) != P_MAX_INDEX; }
821 
824  PINDEX GetAliasCount() const { return m_aliases.GetSize(); }
825 
828  PString GetAlias(
829  PINDEX idx
830  ) const { if (idx < m_aliases.GetSize()) return m_aliases[idx]; return PString::Empty(); }
831 
837  void RemoveAlias(
838  const PString & alias
839  );
840 
843  virtual const H235Authenticators & GetAuthenticators() const { return m_authenticators; }
844 
847  PINDEX GetPrefixCount() const { return m_voicePrefixes.GetSize(); }
848 
851  PString GetPrefix(
852  PINDEX idx
853  ) const { return m_voicePrefixes[idx]; }
854 
857  PCaselessString GetApplicationInfo() const { return m_productInfo.AsString(); }
858 
861  const OpalProductInfo & GetProductInfo() const { return m_productInfo; }
862 
865  unsigned GetProtocolVersion() const { return m_protocolVersion; }
866 
869  bool IsBehindNAT() const { return m_isBehindNAT; }
870 
874 
878 
881  bool CanReceiveRIP() const;
882 
885  bool GetH225Version() const { return m_h225Version; }
886 
889  const PTime & GetCreationTime() const { return m_creationTime; }
891 
901  virtual PBoolean OnSendDescriptorForEndpoint(
902  H225_ArrayOf_AliasAddress & aliases,
903  H225_EndpointType & terminalType,
904  H225_ArrayOf_AliasAddress & transportAddresses
905  );
907 
908 
909  protected:
912 
913  PString m_identifier;
917  PStringArray m_aliases;
918  PStringArray m_voicePrefixes;
924  unsigned m_h225Version;
925  unsigned m_timeToLive;
926  H235Authenticators m_authenticators;
927 
931 
932  PSortedList<H323GatekeeperCall> m_activeCalls;
933  POrdinalDictionary<PString> m_serviceControlSessions;
934 };
935 
936 
943 {
944  PCLASSINFO(H323GatekeeperListener, H225_RAS);
945  public:
952  H323GatekeeperServer & server,
953  const PString & gatekeeperIdentifier,
954  H323Transport * transport = NULL
955  );
956 
961 
966  void PrintOn(
967  ostream & strm
968  ) const;
970 
975  virtual PBoolean UnregistrationRequest(
976  const H323RegisteredEndPoint & ep,
977  unsigned reason
978  );
979 
982  virtual PBoolean DisengageRequest(
983  const H323GatekeeperCall & call,
984  unsigned reason
985  );
986 
989  virtual PBoolean InfoRequest(
991  H323GatekeeperCall * call = NULL
992  );
993 
996  virtual PBoolean ServiceControlIndication(
998  const H323ServiceControlSession & session,
999  H323GatekeeperCall * call = NULL
1000  );
1002 
1010  H323GatekeeperGRQ & request
1011  );
1012 
1018  H323GatekeeperRRQ & request
1019  );
1020 
1026  H323GatekeeperURQ & request
1027  );
1028 
1034  H323GatekeeperARQ & request
1035  );
1036 
1042  H323GatekeeperDRQ & request
1043  );
1044 
1050  H323GatekeeperBRQ & request
1051  );
1052 
1058  H323GatekeeperLRQ & request
1059  );
1060 
1066  H323GatekeeperIRR & request
1067  );
1069 
1072  virtual PBoolean OnReceiveGatekeeperRequest(const H323RasPDU &, const H225_GatekeeperRequest &);
1073  virtual PBoolean OnReceiveRegistrationRequest(const H323RasPDU &, const H225_RegistrationRequest &);
1074  virtual PBoolean OnReceiveUnregistrationRequest(const H323RasPDU &, const H225_UnregistrationRequest &);
1075  virtual PBoolean OnReceiveUnregistrationConfirm(const H225_UnregistrationConfirm &);
1076  virtual PBoolean OnReceiveUnregistrationReject(const H225_UnregistrationReject &);
1077  virtual PBoolean OnReceiveAdmissionRequest(const H323RasPDU &, const H225_AdmissionRequest &);
1078  virtual PBoolean OnReceiveBandwidthRequest(const H323RasPDU &, const H225_BandwidthRequest &);
1079  virtual PBoolean OnReceiveBandwidthConfirm(const H225_BandwidthConfirm &);
1080  virtual PBoolean OnReceiveBandwidthReject(const H225_BandwidthReject &);
1081  virtual PBoolean OnReceiveDisengageRequest(const H323RasPDU &, const H225_DisengageRequest &);
1082  virtual PBoolean OnReceiveDisengageConfirm(const H225_DisengageConfirm &);
1083  virtual PBoolean OnReceiveDisengageReject(const H225_DisengageReject &);
1084  virtual PBoolean OnReceiveLocationRequest(const H323RasPDU &, const H225_LocationRequest &);
1085  virtual PBoolean OnReceiveInfoRequestResponse(const H323RasPDU &, const H225_InfoRequestResponse &);
1086  virtual PBoolean OnReceiveResourcesAvailableConfirm(const H225_ResourcesAvailableConfirm &);
1087 #if OPAL_H460
1088  virtual PBoolean OnSendFeatureSet(H460_MessageType pduType, H225_FeatureSet & features) const;
1089  virtual void OnReceiveFeatureSet(H460_MessageType pduType, const H225_FeatureSet & features) const;
1090 #endif
1091 
1092 
1097 
1098 
1099  protected:
1101 };
1102 
1103 
1115 {
1117  public:
1123  H323EndPoint & endpoint
1124  );
1125 
1130 
1132 
1143  virtual H323Transactor * CreateListener(
1144  H323Transport * transport
1145  );
1146 
1148 
1155  H323GatekeeperGRQ & request
1156  );
1157 
1166  H323GatekeeperRRQ & request
1167  );
1168 
1175  H323GatekeeperURQ & request
1176  );
1177 
1183  H323GatekeeperIRR & request
1184  );
1185 
1196  virtual void AddEndPoint(
1198  );
1199 
1202  virtual PBoolean RemoveEndPoint(
1204  );
1205 
1215  H323GatekeeperRequest & request
1216  );
1217 
1226  virtual PString CreateEndPointIdentifier();
1227 
1230  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByIdentifier(
1231  const PString & identifier,
1232  PSafetyMode mode = PSafeReference
1233  );
1234 
1237  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointBySignalAddresses(
1238  const H225_ArrayOf_TransportAddress & addresses,
1239  PSafetyMode mode = PSafeReference
1240  );
1241 
1244  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointBySignalAddress(
1245  const H323TransportAddress & address,
1246  PSafetyMode mode = PSafeReference
1247  );
1248 
1251  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByAliasAddress(
1252  const H225_AliasAddress & alias,
1253  PSafetyMode mode = PSafeReadWrite
1254  );
1255 
1258  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByAliasString(
1259  const PString & alias,
1260  PSafetyMode mode = PSafeReference
1261  );
1262 
1265  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByPartialAlias(
1266  const PString & alias,
1267  PSafetyMode mode = PSafeReference
1268  );
1269 
1272  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByPrefixString(
1273  const PString & prefix,
1274  PSafetyMode mode = PSafeReference
1275  );
1276 
1279  PSafePtr<H323RegisteredEndPoint> GetFirstEndPoint(
1280  PSafetyMode mode = PSafeReference
1281  ) { return PSafePtr<H323RegisteredEndPoint>(m_byIdentifier, mode); }
1283 
1284  PSafePtr<H323RegisteredEndPoint> FindDestinationEndPoint(
1285  const OpalGloballyUniqueID & id,
1287  );
1288 
1297  H323GatekeeperARQ & request
1298  );
1299 
1305  H323GatekeeperDRQ & request
1306  );
1307 
1313  H323GatekeeperBRQ & request
1314  );
1315 
1324  virtual H323GatekeeperCall * CreateCall(
1325  const OpalGloballyUniqueID & callIdentifier,
1327  );
1328 
1331  virtual void AddCall(H323GatekeeperCall *)
1332  { }
1333 
1336  virtual void RemoveCall(
1337  H323GatekeeperCall * call
1338  );
1339 
1342  virtual PSafePtr<H323GatekeeperCall> FindCall(
1343  const PString & description,
1344  PSafetyMode mode = PSafeReference
1345  );
1346 
1349  virtual PSafePtr<H323GatekeeperCall> FindCall(
1350  const OpalGloballyUniqueID & callIdentifier,
1351  PBoolean answeringCall,
1352  PSafetyMode mode = PSafeReference
1353  );
1354 
1357  virtual PSafePtr<H323GatekeeperCall> FindCall(
1358  const OpalGloballyUniqueID & callIdentifier,
1360  PSafetyMode mode = PSafeReference
1361  );
1362 
1365  PSafePtr<H323GatekeeperCall> GetFirstCall(
1366  PSafetyMode mode = PSafeReference
1367  ) { return PSafePtr<H323GatekeeperCall>(m_activeCalls, mode); }
1369 
1380  H323GatekeeperLRQ & request
1381  );
1382 
1394  virtual PBoolean TranslateAliasAddress(
1395  const H225_AliasAddress & alias,
1396  H225_ArrayOf_AliasAddress & aliases,
1397  H323TransportAddress & address,
1398  PBoolean & isGkRouted,
1399  H323GatekeeperCall * call
1400  );
1401 
1421  virtual PBoolean TranslateAliasAddressToSignalAddress(
1422  const H225_AliasAddress & alias,
1423  H323TransportAddress & address
1424  );
1426 
1438  virtual PBoolean CheckSignalAddressPolicy(
1439  const H323RegisteredEndPoint & ep,
1440  const H225_AdmissionRequest & arq,
1441  const H323TransportAddress & address
1442  );
1443 
1456  virtual PBoolean CheckAliasAddressPolicy(
1457  const H323RegisteredEndPoint & ep,
1458  const H225_AdmissionRequest & arq,
1459  const H225_AliasAddress & alias
1460  );
1461 
1474  virtual PBoolean CheckAliasStringPolicy(
1475  const H323RegisteredEndPoint & ep,
1476  const H225_AdmissionRequest & arq,
1477  const PString & alias
1478  );
1479 
1485  virtual unsigned AllocateBandwidth(
1486  unsigned newBandwidth,
1487  unsigned oldBandwidth = 0
1488  );
1490 
1502  virtual PBoolean GetAdmissionRequestAuthentication(
1503  H323GatekeeperARQ & info,
1504  H235Authenticators & authenticators
1505  );
1506 
1512  virtual PBoolean GetUsersPassword(
1513  const PString & alias,
1514  PString & password,
1515  H323RegisteredEndPoint & registeredEndpoint
1516  ) const;
1517  virtual PBoolean GetUsersPassword(
1518  const PString & alias,
1519  PString & password
1520  ) const;
1521  virtual void SetUsersPassword(
1522  const PString & alias,
1523  const PString & password
1524  );
1525  virtual void ClearPasswords() { m_passwords.RemoveAll(); }
1527 
1528 #if OPAL_H501
1529 
1534 
1538  void SetPeerElement(
1539  H323PeerElement * newPeerElement
1540  );
1541 
1547  void CreatePeerElement(
1548  const H323TransportAddress & h501Interface
1549  );
1550 
1556  bool OpenPeerElement(
1557  const H323TransportAddress & remotePeer,
1558  bool append = false,
1559  bool keepTrying = true
1560  );
1562 #endif
1563 
1568  const PString & GetGatekeeperIdentifier() const { return m_gatekeeperIdentifier; }
1569 
1576  const PString & id,
1577  bool adjustListeners = true
1578  );
1579 
1582  unsigned GetAvailableBandwidth() const { return m_totalBandwidth; }
1583 
1586  void SetAvailableBandwidth(unsigned bps100) { m_totalBandwidth = bps100; }
1587 
1590  unsigned GetUsedBandwidth() const { return m_usedBandwidth; }
1591 
1594  unsigned GetDefaultBandwidth() const { return m_defaultBandwidth; }
1595  void SetDefaultBandwidth(unsigned bw) { m_defaultBandwidth = bw; }
1596 
1599  unsigned GetMaximumBandwidth() const { return m_maximumBandwidth; }
1600  void SetMaximumBandwidth(unsigned bw) { m_maximumBandwidth = bw; }
1601 
1604  unsigned GetTimeToLive() const { return m_defaultTimeToLive; }
1605 
1608  void SetTimeToLive(unsigned seconds) { m_defaultTimeToLive = seconds; }
1609 
1612  unsigned GetInfoResponseRate() const { return m_defaultInfoResponseRate; }
1613 
1616  void SetInfoResponseRate(unsigned seconds) { m_defaultInfoResponseRate = seconds; }
1617 
1621 
1623  unsigned GetMinAliasToAllocate() const { return m_minAliasToAllocate; }
1625 
1627  unsigned GetMaxAliasToAllocate() const { return m_maxAliasToAllocate; }
1629 
1633 
1637 
1641 
1645 
1649 
1653 
1657 
1661 
1664  bool IsGatekeeperRouted() const { return m_isGatekeeperRouted; }
1666 
1669  bool IsRequiredH235() const { return m_requireH235; }
1670  void SetRequiredH235(bool req) { m_requireH235 = req; }
1671 
1674  unsigned GetActiveRegistrations() const { return m_byIdentifier.GetSize(); }
1675 
1678  unsigned GetPeakRegistrations() const { return m_peakRegistrations; }
1679 
1682  unsigned GetTotalRegistrations() const { return m_totalRegistrations; }
1683 
1687 
1690  unsigned GetActiveCalls() const { return m_activeCalls.GetSize(); }
1691 
1694  unsigned GetPeakCalls() const { return m_peakCalls; }
1695 
1698  unsigned GetTotalCalls() const { return m_totalCalls; }
1699 
1702  unsigned GetRejectedCalls() const { return m_rejectedCalls; }
1704 
1705  // Remove an alias from the server database.
1706  void RemoveAlias(
1708  const PString & alias
1709  );
1710 
1711  // called when an endpoint needs to send a descriptor to the H.501 peer element
1713  H323RegisteredEndPoint & /*ep*/,
1714  H225_ArrayOf_AliasAddress & /*aliases*/,
1715  H225_EndpointType & /*terminalType*/,
1716  H225_ArrayOf_AliasAddress & /*transportAddresses*/
1717  )
1718  { return true; }
1719 
1720  virtual PBoolean AllowDuplicateAlias(const H225_ArrayOf_AliasAddress & /*aliases*/)
1721  { return m_canHaveDuplicateAlias; }
1722 
1723  virtual PString AllocateAlias(H225_RegistrationRequest & rrq);
1724 
1725 #if OPAL_H460
1726  virtual PBoolean OnSendFeatureSet(H460_MessageType pduType, H225_FeatureSet & features) const;
1727  virtual void OnReceiveFeatureSet(H460_MessageType pduType, const H225_FeatureSet & features) const;
1728 #endif
1729 
1730  protected:
1731 
1732  PDECLARE_NOTIFIER(PThread, H323GatekeeperServer, MonitorMain);
1733 
1734  // Configuration & policy variables
1743  unsigned m_minAliasToAllocate; // Zero is no allocation RRJ
1756 
1757  PStringToString m_passwords;
1758 
1759  // Dynamic variables
1762  PThread * m_monitorThread;
1763  PSyncPoint m_monitorExit;
1764 
1765  PLIST(ListenerList, H323GatekeeperListener);
1766  ListenerList m_listeners;
1767 
1768 #if OPAL_H501
1770 #endif
1771 
1772  PSafeDictionary<H225_AliasAddress, H323RegisteredEndPoint> m_discoveredEndpoints;
1773 
1774  PSafeDictionary<PString, H323RegisteredEndPoint> m_byIdentifier;
1775 
1776  class StringMap : public PString {
1777  PCLASSINFO(StringMap, PString);
1778  public:
1779  StringMap(const PString & from, const PString & id)
1780  : PString(from), identifier(id) { }
1781  PString identifier;
1782  };
1783  PSortedStringList m_byAddress;
1784  PSortedStringList m_byAlias;
1785  PSortedStringList m_byVoicePrefix;
1786 
1787  PSafeSortedList<H323GatekeeperCall> m_activeCalls;
1788 
1791  PAtomicInteger m_rejectedRegistrations;
1792  PINDEX m_peakCalls;
1794  PAtomicInteger m_rejectedCalls;
1795 
1796  friend class H323GatekeeperRRQ;
1797  friend class H323GatekeeperARQ;
1798 
1800 };
1801 
1802 
1803 #endif // OPAL_H323
1804 
1805 #endif // OPAL_H323_GKSERVER_H
1806 
1807 
1809