OPAL  Version 3.12.9
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: 24178 $
30  * $Author: rjongbloed $
31  * $Date: 2010-04-06 10:10:56 +1000 (Tue, 06 Apr 2010) $
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/buildopts.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:
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  PBoolean CheckCryptoTokens();
98  PBoolean CheckGatekeeperIdentifier();
99  PBoolean 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  virtual unsigned GetSecurityRejectTag() const = 0;
106 
108 
109  PSafePtr<H323RegisteredEndPoint> endpoint;
110 
111  protected:
113 };
114 
115 
117 {
119  public:
121  H323GatekeeperListener & listener,
122  const H323RasPDU & pdu
123  );
124 
125 #if PTRACING
126  virtual const char * GetName() const;
127 #endif
128  virtual PString GetGatekeeperIdentifier() const;
129  virtual unsigned GetGatekeeperRejectTag() const;
130  virtual PString GetEndpointIdentifier() const;
131  virtual unsigned GetRegisteredEndPointRejectTag() const;
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,
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(endpoint); }
532  PBoolean IsAnsweringCall() const { return direction == AnsweringCall; }
533  unsigned GetCallReference() const { return callReference; }
536  const PString & GetSourceNumber() const { return srcNumber; }
537  const PStringArray & GetSourceAliases() const { return srcAliases; }
538  const H323TransportAddress & GetSourceHost() const { return srcHost; }
539  PString GetSourceAddress() const;
540  const PString & GetDestinationNumber() const { return dstNumber; }
541  const PStringArray & GetDestinationAliases() const { return dstAliases; }
542  const H323TransportAddress & GetDestinationHost() const { return dstHost; }
543  PString GetDestinationAddress() const;
544  unsigned GetBandwidthUsed() const { return bandwidthUsed; }
545  PBoolean SetBandwidthUsed(unsigned bandwidth);
546  const PTime & GetLastInfoResponseTime() const { return lastInfoResponse; }
547  const PTime & GetCallStartTime() const { return callStartTime; }
548  const PTime & GetAlertingTime() const { return alertingTime; }
549  const PTime & GetConnectedTime() const { return connectedTime; }
550  const PTime & GetCallEndTime() const { return callEndTime; }
553 
554  protected:
555  void SetUsageInfo(const H225_RasUsageInformation & usage);
556 
560 
562  unsigned callReference;
565  PString srcNumber;
566  PStringArray srcAliases;
568  PString dstNumber;
569  PStringArray dstAliases;
571  unsigned bandwidthUsed;
574 
575  PBoolean drqReceived;
579  PTime callEndTime;
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 activeCalls.GetSize(); }
639 
643  PINDEX idx
644  ) { return 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 identifier; }
769 
773 
777 
782 
786  PINDEX GetRASAddressCount() const { return rasAddresses.GetSize(); }
787 
792  PINDEX idx
793  ) const { return rasAddresses[idx]; }
794 
799 
803  PINDEX GetSignalAddressCount() const { return signalAddresses.GetSize(); }
804 
809  PINDEX idx
810  ) const { return signalAddresses[idx]; }
811 
814  const PStringArray & GetAliases() const { return aliases; }
815 
818  PBoolean ContainsAlias(
819  const PString & alias
820  ) { return aliases.GetStringsIndex(alias) != P_MAX_INDEX; }
821 
824  PINDEX GetAliasCount() const { return aliases.GetSize(); }
825 
828  PString GetAlias(
829  PINDEX idx
830  ) const { if (idx < aliases.GetSize()) return aliases[idx]; return PString::Empty(); }
831 
837  void RemoveAlias(
838  const PString & alias
839  );
840 
843  virtual const H235Authenticators & GetAuthenticators() const { return authenticators; }
844 
847  PINDEX GetPrefixCount() const { return voicePrefixes.GetSize(); }
848 
851  PString GetPrefix(
852  PINDEX idx
853  ) const { return voicePrefixes[idx]; }
854 
857  PCaselessString GetApplicationInfo() const { return productInfo.AsString(); }
858 
861  const OpalProductInfo & GetProductInfo() const { return productInfo; }
862 
865  unsigned GetProtocolVersion() const { return protocolVersion; }
866 
869  PBoolean IsBehindNAT() const { return isBehindNAT; }
870 
873  PBoolean CanDisplayAmountString() const { return canDisplayAmountString; }
874 
878 
881  PBoolean CanReceiveRIP() const;
882 
885  PBoolean GetH225Version() const { return h225Version; }
887 
897  virtual PBoolean OnSendDescriptorForEndpoint(
898  H225_ArrayOf_AliasAddress & aliases,
899  H225_EndpointType & terminalType,
900  H225_ArrayOf_AliasAddress & transportAddresses
901  );
903 
904 
905  protected:
908 
909  PString identifier;
913  PStringArray aliases;
914  PStringArray voicePrefixes;
916  unsigned protocolVersion;
917  PBoolean isBehindNAT;
920  unsigned h225Version;
921  unsigned timeToLive;
922  H235Authenticators authenticators;
923 
926 
927  PSortedList<H323GatekeeperCall> activeCalls;
928  POrdinalDictionary<PString> serviceControlSessions;
929 };
930 
931 
938 {
939  PCLASSINFO(H323GatekeeperListener, H225_RAS);
940  public:
947  H323GatekeeperServer & server,
948  const PString & gatekeeperIdentifier,
949  H323Transport * transport = NULL
950  );
951 
956 
961  PBoolean UnregistrationRequest(
962  const H323RegisteredEndPoint & ep,
963  unsigned reason
964  );
965 
968  PBoolean DisengageRequest(
969  const H323GatekeeperCall & call,
970  unsigned reason
971  );
972 
975  virtual PBoolean InfoRequest(
977  H323GatekeeperCall * call = NULL
978  );
979 
982  virtual PBoolean ServiceControlIndication(
984  const H323ServiceControlSession & session,
985  H323GatekeeperCall * call = NULL
986  );
988 
996  H323GatekeeperGRQ & request
997  );
998 
1004  H323GatekeeperRRQ & request
1005  );
1006 
1012  H323GatekeeperURQ & request
1013  );
1014 
1020  H323GatekeeperARQ & request
1021  );
1022 
1028  H323GatekeeperDRQ & request
1029  );
1030 
1036  H323GatekeeperBRQ & request
1037  );
1038 
1044  H323GatekeeperLRQ & request
1045  );
1046 
1052  H323GatekeeperIRR & request
1053  );
1055 
1058  virtual PBoolean OnReceiveGatekeeperRequest(const H323RasPDU &, const H225_GatekeeperRequest &);
1059  virtual PBoolean OnReceiveRegistrationRequest(const H323RasPDU &, const H225_RegistrationRequest &);
1060  virtual PBoolean OnReceiveUnregistrationRequest(const H323RasPDU &, const H225_UnregistrationRequest &);
1061  virtual PBoolean OnReceiveUnregistrationConfirm(const H225_UnregistrationConfirm &);
1062  virtual PBoolean OnReceiveUnregistrationReject(const H225_UnregistrationReject &);
1063  virtual PBoolean OnReceiveAdmissionRequest(const H323RasPDU &, const H225_AdmissionRequest &);
1064  virtual PBoolean OnReceiveBandwidthRequest(const H323RasPDU &, const H225_BandwidthRequest &);
1065  virtual PBoolean OnReceiveBandwidthConfirm(const H225_BandwidthConfirm &);
1066  virtual PBoolean OnReceiveBandwidthReject(const H225_BandwidthReject &);
1067  virtual PBoolean OnReceiveDisengageRequest(const H323RasPDU &, const H225_DisengageRequest &);
1068  virtual PBoolean OnReceiveDisengageConfirm(const H225_DisengageConfirm &);
1069  virtual PBoolean OnReceiveDisengageReject(const H225_DisengageReject &);
1070  virtual PBoolean OnReceiveLocationRequest(const H323RasPDU &, const H225_LocationRequest &);
1071  virtual PBoolean OnReceiveInfoRequestResponse(const H323RasPDU &, const H225_InfoRequestResponse &);
1072  virtual PBoolean OnReceiveResourcesAvailableConfirm(const H225_ResourcesAvailableConfirm &);
1073  virtual PBoolean OnSendFeatureSet(unsigned, H225_FeatureSet & features) const;
1074  virtual void OnReceiveFeatureSet(unsigned, const H225_FeatureSet & features) const;
1076 
1081 
1082 
1083  protected:
1085 };
1086 
1087 
1099 {
1101  public:
1107  H323EndPoint & endpoint
1108  );
1109 
1114 
1116 
1127  virtual H323Transactor * CreateListener(
1128  H323Transport * transport
1129  );
1130 
1132 
1139  H323GatekeeperGRQ & request
1140  );
1141 
1150  H323GatekeeperRRQ & request
1151  );
1152 
1159  H323GatekeeperURQ & request
1160  );
1161 
1167  H323GatekeeperIRR & request
1168  );
1169 
1180  virtual void AddEndPoint(
1182  );
1183 
1186  virtual PBoolean RemoveEndPoint(
1188  );
1189 
1199  H323GatekeeperRRQ & request
1200  );
1201 
1210  virtual PString CreateEndPointIdentifier();
1211 
1214  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByIdentifier(
1215  const PString & identifier,
1216  PSafetyMode mode = PSafeReference
1217  );
1218 
1221  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointBySignalAddresses(
1222  const H225_ArrayOf_TransportAddress & addresses,
1223  PSafetyMode mode = PSafeReference
1224  );
1225 
1228  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointBySignalAddress(
1229  const H323TransportAddress & address,
1230  PSafetyMode mode = PSafeReference
1231  );
1232 
1235  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByAliasAddress(
1236  const H225_AliasAddress & alias,
1237  PSafetyMode mode = PSafeReadWrite
1238  );
1239 
1242  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByAliasString(
1243  const PString & alias,
1244  PSafetyMode mode = PSafeReference
1245  );
1246 
1249  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByPartialAlias(
1250  const PString & alias,
1251  PSafetyMode mode = PSafeReference
1252  );
1253 
1256  virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByPrefixString(
1257  const PString & prefix,
1258  PSafetyMode mode = PSafeReference
1259  );
1260 
1263  PSafePtr<H323RegisteredEndPoint> GetFirstEndPoint(
1264  PSafetyMode mode = PSafeReference
1265  ) { return PSafePtr<H323RegisteredEndPoint>(byIdentifier, mode); }
1267 
1268  PSafePtr<H323RegisteredEndPoint> FindDestinationEndPoint(
1269  const OpalGloballyUniqueID & id,
1271  );
1272 
1281  H323GatekeeperARQ & request
1282  );
1283 
1289  H323GatekeeperDRQ & request
1290  );
1291 
1297  H323GatekeeperBRQ & request
1298  );
1299 
1308  virtual H323GatekeeperCall * CreateCall(
1309  const OpalGloballyUniqueID & callIdentifier,
1311  );
1312 
1315  virtual void AddCall(H323GatekeeperCall *)
1316  { }
1317 
1320  virtual void RemoveCall(
1321  H323GatekeeperCall * call
1322  );
1323 
1326  virtual PSafePtr<H323GatekeeperCall> FindCall(
1327  const PString & description,
1328  PSafetyMode mode = PSafeReference
1329  );
1330 
1333  virtual PSafePtr<H323GatekeeperCall> FindCall(
1334  const OpalGloballyUniqueID & callIdentifier,
1335  PBoolean answeringCall,
1336  PSafetyMode mode = PSafeReference
1337  );
1338 
1341  virtual PSafePtr<H323GatekeeperCall> FindCall(
1342  const OpalGloballyUniqueID & callIdentifier,
1344  PSafetyMode mode = PSafeReference
1345  );
1346 
1349  PSafePtr<H323GatekeeperCall> GetFirstCall(
1350  PSafetyMode mode = PSafeReference
1351  ) { return PSafePtr<H323GatekeeperCall>(activeCalls, mode); }
1353 
1364  H323GatekeeperLRQ & request
1365  );
1366 
1378  virtual PBoolean TranslateAliasAddress(
1379  const H225_AliasAddress & alias,
1380  H225_ArrayOf_AliasAddress & aliases,
1381  H323TransportAddress & address,
1382  PBoolean & isGkRouted,
1383  H323GatekeeperCall * call
1384  );
1385 
1405  virtual PBoolean TranslateAliasAddressToSignalAddress(
1406  const H225_AliasAddress & alias,
1407  H323TransportAddress & address
1408  );
1410 
1422  virtual PBoolean CheckSignalAddressPolicy(
1423  const H323RegisteredEndPoint & ep,
1424  const H225_AdmissionRequest & arq,
1425  const H323TransportAddress & address
1426  );
1427 
1440  virtual PBoolean CheckAliasAddressPolicy(
1441  const H323RegisteredEndPoint & ep,
1442  const H225_AdmissionRequest & arq,
1443  const H225_AliasAddress & alias
1444  );
1445 
1458  virtual PBoolean CheckAliasStringPolicy(
1459  const H323RegisteredEndPoint & ep,
1460  const H225_AdmissionRequest & arq,
1461  const PString & alias
1462  );
1463 
1469  virtual unsigned AllocateBandwidth(
1470  unsigned newBandwidth,
1471  unsigned oldBandwidth = 0
1472  );
1474 
1486  virtual PBoolean GetAdmissionRequestAuthentication(
1487  H323GatekeeperARQ & info,
1488  H235Authenticators & authenticators
1489  );
1490 
1496  virtual PBoolean GetUsersPassword(
1497  const PString & alias,
1498  PString & password,
1499  H323RegisteredEndPoint & registeredEndpoint
1500  ) const;
1501  virtual PBoolean GetUsersPassword(
1502  const PString & alias,
1503  PString & password
1504  ) const;
1506 
1507 #if OPAL_H501
1508 
1513 
1517  void SetPeerElement(
1518  H323PeerElement * newPeerElement
1519  );
1520 
1526  void CreatePeerElement(
1527  const H323TransportAddress & h501Interface
1528  );
1529 
1535  PBoolean OpenPeerElement(
1536  const H323TransportAddress & remotePeer,
1537  PBoolean append = false,
1538  PBoolean keepTrying = true
1539  );
1541 #endif
1542 
1547  const PString & GetGatekeeperIdentifier() const { return gatekeeperIdentifier; }
1548 
1555  const PString & id,
1556  PBoolean adjustListeners = true
1557  );
1558 
1561  unsigned GetAvailableBandwidth() const { return totalBandwidth; }
1562 
1565  void SetAvailableBandwidth(unsigned bps100) { totalBandwidth = bps100; }
1566 
1569  unsigned GetUsedBandwidth() const { return usedBandwidth; }
1570 
1573  unsigned GetDefaultBandwidth() const { return defaultBandwidth; }
1574 
1577  unsigned GetTimeToLive() const { return defaultTimeToLive; }
1578 
1581  void SetTimeToLive(unsigned seconds) { defaultTimeToLive = seconds; }
1582 
1585  unsigned GetInfoResponseRate() const { return defaultInfoResponseRate; }
1586 
1589  void SetInfoResponseRate(unsigned seconds) { defaultInfoResponseRate = seconds; }
1590 
1593  PBoolean IsGatekeeperRouted() const { return isGatekeeperRouted; }
1594 
1597  PBoolean IsRequiredH235() const { return requireH235; }
1598 
1601  unsigned GetActiveRegistrations() const { return byIdentifier.GetSize(); }
1602 
1605  unsigned GetPeakRegistrations() const { return peakRegistrations; }
1606 
1609  unsigned GetTotalRegistrations() const { return totalRegistrations; }
1610 
1614 
1617  unsigned GetActiveCalls() const { return activeCalls.GetSize(); }
1618 
1621  unsigned GetPeakCalls() const { return peakCalls; }
1622 
1625  unsigned GetTotalCalls() const { return totalCalls; }
1626 
1629  unsigned GetRejectedCalls() const { return rejectedCalls; }
1631 
1632  // Remove an alias from the server database.
1633  void RemoveAlias(
1635  const PString & alias
1636  );
1637 
1638  // called when an endpoint needs to send a descriptor to the H.501 peer element
1640  H323RegisteredEndPoint & /*ep*/,
1641  H225_ArrayOf_AliasAddress & /*aliases*/,
1642  H225_EndpointType & /*terminalType*/,
1643  H225_ArrayOf_AliasAddress & /*transportAddresses*/
1644  )
1645  { return true; }
1646 
1647  virtual PBoolean AllowDuplicateAlias(const H225_ArrayOf_AliasAddress & /*aliases*/)
1648  { return canHaveDuplicateAlias; }
1649 
1650  virtual PBoolean OnSendFeatureSet(unsigned, H225_FeatureSet & features) const;
1651  virtual void OnReceiveFeatureSet(unsigned, const H225_FeatureSet & features) const;
1652 
1653  protected:
1654 
1655  PDECLARE_NOTIFIER(PThread, H323GatekeeperServer, MonitorMain);
1656 
1657  // Configuration & policy variables
1659  unsigned totalBandwidth;
1660  unsigned usedBandwidth;
1674  PBoolean requireH235;
1676 
1677  PStringToString passwords;
1678 
1679  // Dynamic variables
1680  PMutex mutex;
1682  unsigned nextIdentifier;
1683  PThread * monitorThread;
1684  PSyncPoint monitorExit;
1685 
1686  PLIST(ListenerList, H323GatekeeperListener);
1687  ListenerList listeners;
1688 
1689 #if OPAL_H501
1691 #endif
1692 
1693  PSafeDictionary<PString, H323RegisteredEndPoint> byIdentifier;
1694 
1695  class StringMap : public PString {
1696  PCLASSINFO(StringMap, PString);
1697  public:
1698  StringMap(const PString & from, const PString & id)
1699  : PString(from), identifier(id) { }
1700  PString identifier;
1701  };
1702  PSortedStringList byAddress;
1703  PSortedStringList byAlias;
1704  PSortedStringList byVoicePrefix;
1705 
1706  PSafeSortedList<H323GatekeeperCall> activeCalls;
1707 
1711  PINDEX peakCalls;
1712  PINDEX totalCalls;
1714 
1715  friend class H323GatekeeperRRQ;
1716  friend class H323GatekeeperARQ;
1717 };
1718 
1719 
1720 #endif // OPAL_H323
1721 
1722 #endif // OPAL_H323_GKSERVER_H
1723 
1724 
1726