gkserver.h

Go to the documentation of this file.
00001 /*
00002  * gkserver.h
00003  *
00004  * H225 Registration Admission and Security protocol handler
00005  *
00006  * Open H323 Library
00007  *
00008  * Copyright (c) 1998-2001 Equivalence Pty. Ltd.
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Open H323 Library.
00021  *
00022  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00023  *
00024  * This code was based on original code from OpenGate of Egoboo Ltd. thanks
00025  * to Ashley Unitt for his efforts.
00026  *
00027  * Contributor(s): ______________________________________.
00028  *
00029  * $Log: gkserver.h,v $
00030  * Revision 2.14  2006/01/02 15:51:44  dsandras
00031  * Merged changes from OpenH323 Atlas_devel_2.
00032  *
00033  * Revision 2.13  2005/11/30 13:35:26  csoutheren
00034  * Changed tags for Doxygen
00035  *
00036  * Revision 2.12  2004/06/04 06:54:02  csoutheren
00037  * Migrated updates from OpenH323 1.14.1
00038  *
00039  * Revision 2.11  2004/04/25 02:53:29  rjongbloed
00040  * Fixed GNU 3.4 warnings
00041  *
00042  * Revision 2.10  2004/02/19 10:46:43  rjongbloed
00043  * Merged OpenH323 version 1.13.1 changes.
00044  *
00045  * Revision 2.9  2003/01/07 04:39:52  robertj
00046  * Updated to OpenH323 v1.11.2
00047  *
00048  * Revision 2.8  2002/11/10 11:33:16  robertj
00049  * Updated to OpenH323 v1.10.3
00050  *
00051  * Revision 2.7  2002/09/16 02:52:33  robertj
00052  * Added #define so can select if #pragma interface/implementation is used on
00053  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00054  *
00055  * Revision 2.6  2002/09/04 06:01:46  robertj
00056  * Updated to OpenH323 v1.9.6
00057  *
00058  * Revision 2.5  2002/07/01 04:56:29  robertj
00059  * Updated to OpenH323 v1.9.1
00060  *
00061  * Revision 2.4  2002/03/22 06:57:48  robertj
00062  * Updated to OpenH323 version 1.8.2
00063  *
00064  * Revision 2.3  2002/02/11 09:32:11  robertj
00065  * Updated to openH323 v1.8.0
00066  *
00067  * Revision 2.2  2002/01/14 06:35:56  robertj
00068  * Updated to OpenH323 v1.7.9
00069  *
00070  * Revision 2.1  2001/08/13 05:10:39  robertj
00071  * Updates from OpenH323 v1.6.0 release.
00072  *
00073  * Revision 2.0  2001/07/27 15:48:24  robertj
00074  * Conversion of OpenH323 to Open Phone Abstraction Library (OPAL)
00075  *
00076  * Revision 1.74  2004/02/15 03:36:30  rjongbloed
00077  * Fixed bug in removing prefixes, plus added ability to have multiple endpoints
00078  *   with the same profix, thanks Rossano Ravelli
00079  *
00080  * Revision 1.73  2004/02/07 11:43:59  rjongbloed
00081  * Fixed deadlocks caused under high load by failure to check locking
00082  *   success. Also added functions to find destination endpoint.
00083  *   Thanks Federico Pinna and the gang at Reitek S.p.A.
00084  *
00085  * Revision 1.72  2003/12/24 07:08:47  csoutheren
00086  * Added TranslateAliasAddress on H323GatekeeperCall
00087  *
00088  * Revision 1.71  2003/12/11 05:39:04  csoutheren
00089  * Added storage of H.225 version in endpoint structure
00090  * Disabled sending RIPs to endpoints that cannot handle them
00091  *
00092  * Revision 1.70  2003/12/11 02:18:17  csoutheren
00093  * More fixes for NM deregistration problems. Seems to be fixed now :)
00094  *
00095  * Revision 1.69  2003/12/09 00:58:46  csoutheren
00096  * Fixed problem with endpoints deregistering
00097  *
00098  * Revision 1.68  2003/12/09 00:33:17  csoutheren
00099  * Added patch to prevent crash when NM unregisters from GK
00100  * Abject apologies to Rossano Ravelli for taking so long to add this
00101  *
00102  * Revision 1.67  2003/04/30 00:28:50  robertj
00103  * Redesigned the alternate credentials in ARQ system as old implementation
00104  *   was fraught with concurrency issues, most importantly it can cause false
00105  *   detection of replay attacks taking out an endpoint completely.
00106  *
00107  * Revision 1.66  2003/04/02 06:58:10  robertj
00108  * Added support for (optional) duplicate aliases in gatekeeper server, necessitating
00109  *   the removal of AddAlias and RemoveAlias functions.
00110  *
00111  * Revision 1.65  2003/04/02 06:07:12  robertj
00112  * Added H.323 Annex G Peer Element support to gatekeeper server.
00113  *
00114  * Revision 1.64  2003/04/01 07:30:52  robertj
00115  * Added function to translate alias into alias list and transport to make
00116  *   use of full information returned by peer element.
00117  *
00118  * Revision 1.63  2003/04/01 04:47:48  robertj
00119  * Abstracted H.225 RAS transaction processing (RIP and secondary thread) in
00120  *   server environment for use by H.501 peer elements.
00121  *
00122  * Revision 1.62  2003/03/26 07:10:03  robertj
00123  * Added more access functions.
00124  *
00125  * Revision 1.61  2003/03/17 22:52:06  craigs
00126  * Improvided useability of AddAlias and RemoveAlias
00127  *
00128  * Revision 1.60  2003/03/04 05:34:13  robertj
00129  * Fixed GNU warnings
00130  *
00131  * Revision 1.59  2003/03/04 05:27:51  robertj
00132  * Added statistics for rejected registrations and call admissions.
00133  *
00134  * Revision 1.58  2003/03/03 06:59:26  robertj
00135  * Fixed call SetBandwidth function so adjusts global bandwidth as well.
00136  *
00137  * Revision 1.57  2003/02/21 07:21:40  robertj
00138  * Fixed incorrect ancestor in PCLASSINFO()
00139  *
00140  * Revision 1.56  2003/02/21 05:28:39  craigs
00141  * Factored out code for user with peer elements
00142  *
00143  * Revision 1.55  2003/02/06 04:43:14  robertj
00144  * Changes to help with endpoints behind NAT.
00145  *
00146  * Revision 1.54  2003/02/03 03:58:06  robertj
00147  * Fixed use of local password database with ep's that have multiple aliases.
00148  *
00149  * Revision 1.53  2003/02/01 13:31:14  robertj
00150  * Changes to support CAT authentication in RAS.
00151  *
00152  * Revision 1.52  2002/12/17 01:25:23  robertj
00153  * Added call backs on gk server when ep indicates alerting or connect.
00154  *
00155  * Revision 1.51  2002/11/28 05:45:46  robertj
00156  * Fixed bug so can set total bandwidth while calls are in progress.
00157  *
00158  * Revision 1.50  2002/11/28 04:41:44  robertj
00159  * Added support for RAS ServiceControlIndication command.
00160  *
00161  * Revision 1.49  2002/11/27 06:54:52  robertj
00162  * Added Service Control Session management as per Annex K/H.323 via RAS
00163  *   only at this stage.
00164  * Added H.248 ASN and very primitive infrastructure for linking into the
00165  *   Service Control Session management system.
00166  * Added basic infrastructure for Annex K/H.323 HTTP transport system.
00167  * Added Call Credit Service Control to display account balances.
00168  *
00169  * Revision 1.48  2002/11/22 00:11:29  robertj
00170  * Added call start time.
00171  *
00172  * Revision 1.47  2002/11/18 23:40:45  robertj
00173  * Changed to use the H323EndPoint::CreateAuthenticators() function, we
00174  *   should use only one.
00175  *
00176  * Revision 1.46  2002/11/12 11:36:03  robertj
00177  * Added function to find endpoint by partial alias.
00178  * Optimised endpoint "indexes" to use sorted lists instead of dictionaries.
00179  *
00180  * Revision 1.45  2002/11/06 23:23:48  robertj
00181  * Fixed minor error in parameter, should be reference not value
00182  *
00183  * Revision 1.44  2002/10/29 00:12:02  robertj
00184  * Changed template classes so things like PSafeList actually creates the
00185  *   base collection class as well.
00186  * Improved setting of usage info, included getting it from BRQ etc.
00187  *
00188  * Revision 1.43  2002/10/21 00:54:47  robertj
00189  * Added function to unregister an endpoint via user interface.
00190  * Added reason code to call disengage.
00191  * Added ability to find call by a description string.
00192  *
00193  * Revision 1.42  2002/10/17 05:26:33  robertj
00194  * Added function to get at registered endpoints protocol version.
00195  *
00196  * Revision 1.41  2002/10/16 07:22:50  robertj
00197  * Added support for endpoints that do not support RRQ timeToLive parameter,
00198  *   will actively go see if ep is there using IRQ before expiring the ep.
00199  *
00200  * Revision 1.40  2002/10/01 08:17:34  robertj
00201  * Fixed (benign) race condition between client and server both wanting to do
00202  *   a DRQ of a call at the same time. Caused an Assert, but no crash.
00203  *
00204  * Revision 1.39  2002/09/26 01:27:31  robertj
00205  * Changed appliation info name in registered endpoint to be caseless string.
00206  *
00207  * Revision 1.38  2002/09/24 08:03:51  robertj
00208  * Added H.225 RAS protocol version number to registered endpoint structure.
00209  *
00210  * Revision 1.37  2002/09/19 09:15:56  robertj
00211  * Fixed problem with making (and assuring with multi-threading) IRQ and DRQ
00212  *   requests are sent to the correct endpoint address, thanks Martijn Roest.
00213  *
00214  * Revision 1.36  2002/09/16 01:14:15  robertj
00215  * Added #define so can select if #pragma interface/implementation is used on
00216  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00217  *
00218  * Revision 1.35  2002/09/03 06:19:36  robertj
00219  * Normalised the multi-include header prevention ifdef/define symbol.
00220  *
00221  * Revision 1.34  2002/08/29 07:57:08  robertj
00222  * Added some statistics to gatekeeper server.
00223  *
00224  * Revision 1.33  2002/08/29 06:54:52  robertj
00225  * Removed redundent thread member variable from request info.
00226  *
00227  * Revision 1.32  2002/08/12 08:12:45  robertj
00228  * Added extra hint to help with ARQ using separate credentials from RRQ.
00229  *
00230  * Revision 1.31  2002/08/12 05:38:20  robertj
00231  * Changes to the RAS subsystem to support ability to make requests to client
00232  *   from gkserver without causing bottlenecks and race conditions.
00233  *
00234  * Revision 1.30  2002/08/05 10:03:47  robertj
00235  * Cosmetic changes to normalise the usage of pragma interface/implementation.
00236  *
00237  * Revision 1.29  2002/08/05 05:17:37  robertj
00238  * Fairly major modifications to support different authentication credentials
00239  *   in ARQ to the logged in ones on RRQ. For both client and server.
00240  * Various other H.235 authentication bugs and anomalies fixed on the way.
00241  *
00242  * Revision 1.28  2002/07/16 13:49:22  robertj
00243  * Added missing lock when removing call from endpoint.
00244  *
00245  * Revision 1.27  2002/07/11 09:33:56  robertj
00246  * Added access functions to various call statistics member variables.
00247  *
00248  * Revision 1.26  2002/07/11 07:01:37  robertj
00249  * Added Disengage() function to force call drop from gk server.
00250  * Added InfoRequest() function to force client to send an IRR.
00251  * Added ability to automatically clear calls if do not get IRR for it.
00252  *
00253  * Revision 1.25  2002/06/21 02:52:44  robertj
00254  * Fixed problem with double checking H.235 hashing, this causes failure as
00255  *   the authenticator thinks it is a replay attack.
00256  *
00257  * Revision 1.24  2002/06/19 05:03:08  robertj
00258  * Changed gk code to allow for H.235 security on an endpoint by endpoint basis.
00259  *
00260  * Revision 1.23  2002/06/12 03:55:21  robertj
00261  * Added function to add/remove multiple listeners in one go comparing against
00262  *   what is already running so does not interrupt unchanged listeners.
00263  *
00264  * Revision 1.22  2002/05/29 00:03:15  robertj
00265  * Fixed unsolicited IRR support in gk client and server,
00266  *   including support for IACK and INAK.
00267  *
00268  * Revision 1.21  2002/05/21 06:30:31  robertj
00269  * Changed GRQ to the same as all the other xRQ request handlers.
00270  *
00271  * Revision 1.20  2002/05/17 03:42:08  robertj
00272  * Fixed problems with H.235 authentication on RAS for server and client.
00273  *
00274  * Revision 1.19  2002/05/07 03:18:12  robertj
00275  * Added application info (name/version etc) into registered endpoint data.
00276  *
00277  * Revision 1.18  2002/05/06 00:56:37  robertj
00278  * Sizeable rewrite of gatekeeper server code to make more bulletproof against
00279  *   multithreaded operation. Especially when using slow response/RIP feature.
00280  * Also changed the call indexing to use call id and direction as key.
00281  *
00282  * Revision 1.17  2002/04/30 23:19:00  dereks
00283  * Fix documentation typos.
00284  *
00285  * Revision 1.16  2002/03/06 02:01:31  robertj
00286  * Fixed race condition when starting slow server response thread.
00287  *
00288  * Revision 1.15  2002/03/05 00:36:01  craigs
00289  * Added GetReplyAddress for H323GatekeeperRequest
00290  *
00291  * Revision 1.14  2002/03/03 21:34:50  robertj
00292  * Added gatekeeper monitor thread.
00293  *
00294  * Revision 1.13  2002/03/02 05:58:57  robertj
00295  * Fixed possible bandwidth leak (thanks Francisco Olarte Sanz) and in
00296  *   the process added OnBandwidth function to H323GatekeeperCall class.
00297  *
00298  * Revision 1.12  2002/03/01 04:09:09  robertj
00299  * Fixed problems with keeping track of calls. Calls are now indexed by call-id
00300  *   alone and maintain both endpoints of call in its structure. Fixes problem
00301  *   with calls form an endpoint to itself, and having two objects being tracked
00302  *   where there is really only one call.
00303  *
00304  * Revision 1.11  2002/02/04 05:21:13  robertj
00305  * Lots of changes to fix multithreaded slow response code (RIP).
00306  * Fixed problem with having two entries for same call in call list.
00307  *
00308  * Revision 1.10  2002/01/31 06:45:44  robertj
00309  * Added more checking for invalid list processing in calls database.
00310  *
00311  * Revision 1.9  2002/01/31 00:16:15  robertj
00312  * Removed const to allow things to compile!
00313  *
00314  * Revision 1.8  2001/12/15 08:08:52  robertj
00315  * Added alerting, connect and end of call times to be sent to RAS server.
00316  *
00317  * Revision 1.7  2001/12/14 06:40:47  robertj
00318  * Added call end reason codes in DisengageRequest for GK server use.
00319  *
00320  * Revision 1.6  2001/12/13 11:08:45  robertj
00321  * Significant changes to support slow request handling, automatically sending
00322  *   RIP and spawning thread to handle time consuming operation.
00323  *
00324  * Revision 1.5  2001/11/19 06:56:44  robertj
00325  * Added prefix strings for gateways registered with this gk, thanks Mikael Stolt
00326  *
00327  * Revision 1.4  2001/08/10 11:03:49  robertj
00328  * Major changes to H.235 support in RAS to support server.
00329  *
00330  * Revision 1.3  2001/08/06 07:44:52  robertj
00331  * Fixed problems with building without SSL
00332  *
00333  * Revision 1.2  2001/08/06 03:18:35  robertj
00334  * Fission of h323.h to h323ep.h & h323con.h, h323.h now just includes files.
00335  * Improved access to H.235 secure RAS functionality.
00336  * Changes to H.323 secure RAS contexts to help use with gk server.
00337  *
00338  * Revision 1.1  2001/07/24 02:30:55  robertj
00339  * Added gatekeeper RAS protocol server classes.
00340  *
00341  */
00342 
00343 #ifndef __OPAL_GKSERVER_H
00344 #define __OPAL_GKSERVER_H
00345 
00346 #ifdef P_USE_PRAGMA
00347 #pragma interface
00348 #endif
00349 
00350 
00351 #include <ptlib/safecoll.h>
00352 #include <opal/guid.h>
00353 #include <h323/h225ras.h>
00354 #include <h323/transaddr.h>
00355 #include <h323/h235auth.h>
00356 #include <h323/h323pdu.h>
00357 #include <h323/h323trans.h>
00358 
00359 
00360 class PASN_Sequence;
00361 class PASN_Choice;
00362 
00363 class H225_AliasAddress;
00364 class H225_EndpointIdentifier;
00365 class H225_GatekeeperIdentifier;
00366 class H225_ArrayOf_TransportAddress;
00367 class H225_GatekeeperIdentifier;
00368 class H225_EndpointIdentifier;
00369 class H225_InfoRequestResponse_perCallInfo_subtype;
00370 class H225_RasUsageInformation;
00371 
00372 class H323RegisteredEndPoint;
00373 class H323GatekeeperListener;
00374 class H323GatekeeperServer;
00375 class H323RasPDU;
00376 class H323PeerElement;
00377 
00378 
00379 class H323GatekeeperRequest : public H323Transaction
00380 {
00381     PCLASSINFO(H323GatekeeperRequest, H323Transaction);
00382   public:
00387     H323GatekeeperRequest(
00388       H323GatekeeperListener & rasChannel,
00389       const H323RasPDU & pdu
00390     );
00392 
00393     virtual H323TransactionPDU * CreateRIP(
00394       unsigned sequenceNumber,
00395       unsigned delay
00396     ) const;
00397 
00398     virtual BOOL WritePDU(
00399       H323TransactionPDU & pdu
00400     );
00401     BOOL CheckCryptoTokens();
00402     BOOL CheckGatekeeperIdentifier();
00403     BOOL GetRegisteredEndPoint();
00404 
00405     virtual PString GetGatekeeperIdentifier() const = 0;
00406     virtual unsigned GetGatekeeperRejectTag() const = 0;
00407     virtual PString GetEndpointIdentifier() const = 0;
00408     virtual unsigned GetRegisteredEndPointRejectTag() const = 0;
00409     virtual unsigned GetSecurityRejectTag() const = 0;
00410 
00411     H323GatekeeperListener & GetRasChannel() const { return rasChannel; }
00412 
00413     PSafePtr<H323RegisteredEndPoint> endpoint;
00414 
00415   protected:
00416     H323GatekeeperListener & rasChannel;
00417 };
00418 
00419 
00420 class H323GatekeeperGRQ : public H323GatekeeperRequest
00421 {
00422     PCLASSINFO(H323GatekeeperGRQ, H323GatekeeperRequest);
00423   public:
00424     H323GatekeeperGRQ(
00425       H323GatekeeperListener & listener,
00426       const H323RasPDU & pdu
00427     );
00428 
00429 #if PTRACING
00430     virtual const char * GetName() const;
00431 #endif
00432     virtual PString GetGatekeeperIdentifier() const;
00433     virtual unsigned GetGatekeeperRejectTag() const;
00434     virtual PString GetEndpointIdentifier() const;
00435     virtual unsigned GetRegisteredEndPointRejectTag() const;
00436     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00437     virtual unsigned GetSecurityRejectTag() const;
00438     virtual void SetRejectReason(
00439       unsigned reasonCode
00440     );
00441 
00442     H225_GatekeeperRequest & grq;
00443     H225_GatekeeperConfirm & gcf;
00444     H225_GatekeeperReject  & grj;
00445 
00446   protected:
00447     virtual Response OnHandlePDU();
00448 };
00449 
00450 
00451 class H323GatekeeperRRQ : public H323GatekeeperRequest
00452 {
00453     PCLASSINFO(H323GatekeeperRRQ, H323GatekeeperRequest);
00454   public:
00455     H323GatekeeperRRQ(
00456       H323GatekeeperListener & listener,
00457       const H323RasPDU & pdu
00458     );
00459 
00460 #if PTRACING
00461     virtual const char * GetName() const;
00462 #endif
00463     virtual PString GetGatekeeperIdentifier() const;
00464     virtual unsigned GetGatekeeperRejectTag() const;
00465     virtual PString GetEndpointIdentifier() const;
00466     virtual unsigned GetRegisteredEndPointRejectTag() const;
00467     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00468     virtual unsigned GetSecurityRejectTag() const;
00469     virtual void SetRejectReason(
00470       unsigned reasonCode
00471     );
00472 
00473     H225_RegistrationRequest & rrq;
00474     H225_RegistrationConfirm & rcf;
00475     H225_RegistrationReject  & rrj;
00476 
00477   protected:
00478     virtual Response OnHandlePDU();
00479 };
00480 
00481 
00482 class H323GatekeeperURQ : public H323GatekeeperRequest
00483 {
00484     PCLASSINFO(H323GatekeeperURQ, H323GatekeeperRequest);
00485   public:
00486     H323GatekeeperURQ(
00487       H323GatekeeperListener & listener,
00488       const H323RasPDU & pdu
00489     );
00490 
00491 #if PTRACING
00492     virtual const char * GetName() const;
00493 #endif
00494     virtual PString GetGatekeeperIdentifier() const;
00495     virtual unsigned GetGatekeeperRejectTag() const;
00496     virtual PString GetEndpointIdentifier() const;
00497     virtual unsigned GetRegisteredEndPointRejectTag() const;
00498     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00499     virtual unsigned GetSecurityRejectTag() const;
00500     virtual void SetRejectReason(
00501       unsigned reasonCode
00502     );
00503 
00504     H225_UnregistrationRequest & urq;
00505     H225_UnregistrationConfirm & ucf;
00506     H225_UnregistrationReject  & urj;
00507 
00508   protected:
00509     virtual Response OnHandlePDU();
00510 };
00511 
00512 
00513 class H323GatekeeperARQ : public H323GatekeeperRequest
00514 {
00515     PCLASSINFO(H323GatekeeperARQ, H323GatekeeperRequest);
00516   public:
00517     H323GatekeeperARQ(
00518       H323GatekeeperListener & listener,
00519       const H323RasPDU & pdu
00520     );
00521 
00522 #if PTRACING
00523     virtual const char * GetName() const;
00524 #endif
00525     virtual PString GetGatekeeperIdentifier() const;
00526     virtual unsigned GetGatekeeperRejectTag() const;
00527     virtual PString GetEndpointIdentifier() const;
00528     virtual unsigned GetRegisteredEndPointRejectTag() const;
00529     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00530     virtual unsigned GetSecurityRejectTag() const;
00531     virtual void SetRejectReason(
00532       unsigned reasonCode
00533     );
00534 
00535     H225_AdmissionRequest & arq;
00536     H225_AdmissionConfirm & acf;
00537     H225_AdmissionReject  & arj;
00538 
00539     PString alternateSecurityID;
00540 
00541   protected:
00542     virtual Response OnHandlePDU();
00543 };
00544 
00545 
00546 class H323GatekeeperDRQ : public H323GatekeeperRequest
00547 {
00548     PCLASSINFO(H323GatekeeperDRQ, H323GatekeeperRequest);
00549   public:
00550     H323GatekeeperDRQ(
00551       H323GatekeeperListener & listener,
00552       const H323RasPDU & pdu
00553     );
00554 
00555 #if PTRACING
00556     virtual const char * GetName() const;
00557 #endif
00558     virtual PString GetGatekeeperIdentifier() const;
00559     virtual unsigned GetGatekeeperRejectTag() const;
00560     virtual PString GetEndpointIdentifier() const;
00561     virtual unsigned GetRegisteredEndPointRejectTag() const;
00562     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00563     virtual unsigned GetSecurityRejectTag() const;
00564     virtual void SetRejectReason(
00565       unsigned reasonCode
00566     );
00567 
00568     H225_DisengageRequest & drq;
00569     H225_DisengageConfirm & dcf;
00570     H225_DisengageReject  & drj;
00571 
00572   protected:
00573     virtual Response OnHandlePDU();
00574 };
00575 
00576 
00577 class H323GatekeeperBRQ : public H323GatekeeperRequest
00578 {
00579     PCLASSINFO(H323GatekeeperBRQ, H323GatekeeperRequest);
00580   public:
00581     H323GatekeeperBRQ(
00582       H323GatekeeperListener & listener,
00583       const H323RasPDU & pdu
00584     );
00585 
00586 #if PTRACING
00587     virtual const char * GetName() const;
00588 #endif
00589     virtual PString GetGatekeeperIdentifier() const;
00590     virtual unsigned GetGatekeeperRejectTag() const;
00591     virtual PString GetEndpointIdentifier() const;
00592     virtual unsigned GetRegisteredEndPointRejectTag() const;
00593     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00594     virtual unsigned GetSecurityRejectTag() const;
00595     virtual void SetRejectReason(
00596       unsigned reasonCode
00597     );
00598 
00599     H225_BandwidthRequest & brq;
00600     H225_BandwidthConfirm & bcf;
00601     H225_BandwidthReject  & brj;
00602 
00603   protected:
00604     virtual Response OnHandlePDU();
00605 };
00606 
00607 
00608 class H323GatekeeperLRQ : public H323GatekeeperRequest
00609 {
00610     PCLASSINFO(H323GatekeeperLRQ, H323GatekeeperRequest);
00611   public:
00612     H323GatekeeperLRQ(
00613       H323GatekeeperListener & listener,
00614       const H323RasPDU & pdu
00615     );
00616 
00617 #if PTRACING
00618     virtual const char * GetName() const;
00619 #endif
00620     virtual PString GetGatekeeperIdentifier() const;
00621     virtual unsigned GetGatekeeperRejectTag() const;
00622     virtual PString GetEndpointIdentifier() const;
00623     virtual unsigned GetRegisteredEndPointRejectTag() const;
00624     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00625     virtual unsigned GetSecurityRejectTag() const;
00626     virtual void SetRejectReason(
00627       unsigned reasonCode
00628     );
00629 
00630     H225_LocationRequest & lrq;
00631     H225_LocationConfirm & lcf;
00632     H225_LocationReject  & lrj;
00633 
00634   protected:
00635     virtual Response OnHandlePDU();
00636 };
00637 
00638 
00639 class H323GatekeeperIRR : public H323GatekeeperRequest
00640 {
00641     PCLASSINFO(H323GatekeeperIRR, H323GatekeeperRequest);
00642   public:
00643     H323GatekeeperIRR(
00644       H323GatekeeperListener & listener,
00645       const H323RasPDU & pdu
00646     );
00647 
00648 #if PTRACING
00649     virtual const char * GetName() const;
00650 #endif
00651     virtual PString GetGatekeeperIdentifier() const;
00652     virtual unsigned GetGatekeeperRejectTag() const;
00653     virtual PString GetEndpointIdentifier() const;
00654     virtual unsigned GetRegisteredEndPointRejectTag() const;
00655     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00656     virtual unsigned GetSecurityRejectTag() const;
00657     virtual void SetRejectReason(
00658       unsigned reasonCode
00659     );
00660 
00661     H225_InfoRequestResponse & irr;
00662     H225_InfoRequestAck      & iack;
00663     H225_InfoRequestNak      & inak;
00664 
00665   protected:
00666     virtual Response OnHandlePDU();
00667 };
00668 
00669 
00672 class H323GatekeeperCall : public PSafeObject
00673 {
00674     PCLASSINFO(H323GatekeeperCall, PSafeObject);
00675   public:
00678     enum Direction {
00679       AnsweringCall,
00680       OriginatingCall,
00681       UnknownDirection
00682     };
00683 
00686     H323GatekeeperCall(
00687       H323GatekeeperServer & server,               
00688       const OpalGloballyUniqueID & callIdentifier, 
00689       Direction direction                          
00690     );
00691 
00694     ~H323GatekeeperCall();
00696 
00701     Comparison Compare(
00702       const PObject & obj  
00703     ) const;
00704 
00707     void PrintOn(
00708       ostream & strm    
00709     ) const;
00711 
00719     virtual H323GatekeeperRequest::Response OnAdmission(
00720       H323GatekeeperARQ & request
00721     );
00722 
00726     virtual BOOL Disengage(
00727       int reason = -1   
00728     );
00729 
00733     virtual H323GatekeeperRequest::Response OnDisengage(
00734       H323GatekeeperDRQ & request
00735     );
00736 
00741     virtual H323GatekeeperRequest::Response OnBandwidth(
00742       H323GatekeeperBRQ & request
00743     );
00744 
00748     virtual H323GatekeeperRequest::Response OnInfoResponse(
00749       H323GatekeeperIRR & request,
00750       H225_InfoRequestResponse_perCallInfo_subtype & call
00751     );
00752 
00755     virtual void OnAlerting();
00756 
00759     virtual void OnConnected();
00760 
00771     virtual BOOL OnHeartbeat();
00772 
00779     virtual PString GetCallCreditAmount() const;
00780 
00787     virtual BOOL GetCallCreditMode() const;
00788 
00796     virtual unsigned GetDurationLimit() const;
00797 
00802     virtual BOOL SendCallCreditServiceControl();
00803 
00806     BOOL AddCallCreditServiceControl(
00807       H225_ArrayOf_ServiceControlSession & serviceControl
00808     ) const;
00809 
00814     virtual BOOL SendServiceControlSession(
00815       const H323ServiceControlSession & session
00816     );
00817 
00823     virtual BOOL TranslateAliasAddress(
00824       const H225_AliasAddress & alias,
00825       H225_ArrayOf_AliasAddress & aliases,
00826       H323TransportAddress & address,
00827       BOOL & gkRouted
00828     );
00829 
00831 
00834     H323GatekeeperServer & GetGatekeeper() const { return gatekeeper; }
00835     H323RegisteredEndPoint & GetEndPoint() const { return *PAssertNULL(endpoint); }
00836     BOOL IsAnsweringCall() const { return direction == AnsweringCall; }
00837     unsigned GetCallReference() const { return callReference; }
00838     const OpalGloballyUniqueID & GetCallIdentifier() const { return callIdentifier; }
00839     const OpalGloballyUniqueID & GetConferenceIdentifier() const { return conferenceIdentifier; }
00840     const PString & GetSourceNumber() const { return srcNumber; }
00841     const PStringArray & GetSourceAliases() const { return srcAliases; }
00842     const H323TransportAddress & GetSourceHost() const { return srcHost; }
00843     PString GetSourceAddress() const;
00844     const PString & GetDestinationNumber() const { return dstNumber; }
00845     const PStringArray & GetDestinationAliases() const { return dstAliases; }
00846     const H323TransportAddress & GetDestinationHost() const { return dstHost; }
00847     PString GetDestinationAddress() const;
00848     unsigned GetBandwidthUsed() const { return bandwidthUsed; }
00849     BOOL SetBandwidthUsed(unsigned bandwidth);
00850     const PTime & GetLastInfoResponseTime() const { return lastInfoResponse; }
00851     const PTime & GetCallStartTime() const { return callStartTime; }
00852     const PTime & GetAlertingTime() const { return alertingTime; }
00853     const PTime & GetConnectedTime() const { return connectedTime; }
00854     const PTime & GetCallEndTime() const { return callEndTime; }
00855     H323Connection::CallEndReason GetCallEndReason() const { return callEndReason; }
00857 
00858   protected:
00859     void SetUsageInfo(const H225_RasUsageInformation & usage);
00860 
00861     H323GatekeeperServer   & gatekeeper;
00862     H323RegisteredEndPoint * endpoint;
00863     H323GatekeeperListener * rasChannel;
00864 
00865     Direction            direction;
00866     unsigned             callReference;
00867     OpalGloballyUniqueID callIdentifier;
00868     OpalGloballyUniqueID conferenceIdentifier;
00869     PString              srcNumber;
00870     PStringArray         srcAliases;
00871     H323TransportAddress srcHost;
00872     PString              dstNumber;
00873     PStringArray         dstAliases;
00874     H323TransportAddress dstHost;
00875     unsigned             bandwidthUsed;
00876     unsigned             infoResponseRate;
00877     PTime                lastInfoResponse;
00878 
00879     BOOL                          drqReceived;
00880     PTime                         callStartTime;
00881     PTime                         alertingTime;
00882     PTime                         connectedTime;
00883     PTime                         callEndTime;
00884     H323Connection::CallEndReason callEndReason;
00885 };
00886 
00887 
00893 class H323RegisteredEndPoint : public PSafeObject
00894 {
00895     PCLASSINFO(H323RegisteredEndPoint, PSafeObject);
00896   public:
00901     H323RegisteredEndPoint(
00902       H323GatekeeperServer & server, 
00903       const PString & id             
00904     );
00906 
00911     Comparison Compare(
00912       const PObject & obj  
00913     ) const;
00914 
00917     void PrintOn(
00918       ostream & strm    
00919     ) const;
00921 
00928     void AddCall(
00929       H323GatekeeperCall * call
00930     );
00931 
00936     BOOL RemoveCall(
00937       H323GatekeeperCall * call
00938     );
00939 
00942     PINDEX GetCallCount() const { return activeCalls.GetSize(); }
00943 
00946     H323GatekeeperCall & GetCall(
00947       PINDEX idx
00948     ) { return activeCalls[idx]; }
00950 
00959     virtual H323GatekeeperRequest::Response OnRegistration(
00960       H323GatekeeperRRQ & request
00961     );
00962 
00972     virtual H323GatekeeperRequest::Response OnFullRegistration(
00973       H323GatekeeperRRQ & request
00974     );
00975 
00984     virtual H323GatekeeperRequest::Response OnSecureRegistration(
00985       H323GatekeeperRRQ & request
00986     );
00987 
00991     virtual H323GatekeeperRequest::Response OnUnregistration(
00992       H323GatekeeperURQ & request
00993     );
00994 
00998     virtual BOOL Unregister(
00999       int reason = -1   
01000     );
01001 
01006     virtual H323GatekeeperRequest::Response OnInfoResponse(
01007       H323GatekeeperIRR & request
01008     );
01009 
01020     virtual BOOL OnTimeToLive();
01021 
01033     virtual PString GetCallCreditAmount() const;
01034 
01042     virtual BOOL GetCallCreditMode() const;
01043 
01048     virtual BOOL SendServiceControlSession(
01049       const H323ServiceControlSession & session
01050     );
01051 
01055     virtual BOOL AddServiceControlSession(
01056       const H323ServiceControlSession & session,
01057       H225_ArrayOf_ServiceControlSession & serviceControl
01058     );
01060 
01065     virtual BOOL SetPassword(
01066       const PString & password,
01067       const PString & username = PString::Empty()
01068     );
01069 
01072     const PString & GetIdentifier() const { return identifier; }
01073 
01076     const OpalGloballyUniqueID & GetDescriptorID() const { return descriptorID; }
01077 
01080     H323GatekeeperServer & GetGatekeeper() const { return gatekeeper; }
01081 
01085     const H323TransportAddressArray & GetRASAddresses() const { return rasAddresses; }
01086 
01090     PINDEX GetRASAddressCount() const { return rasAddresses.GetSize(); }
01091 
01095     H323TransportAddress GetRASAddress(
01096       PINDEX idx
01097     ) const { return rasAddresses[idx]; }
01098 
01102     const H323TransportAddressArray & GetSignalAddresses() const { return signalAddresses; }
01103 
01107     PINDEX GetSignalAddressCount() const { return signalAddresses.GetSize(); }
01108 
01112     H323TransportAddress GetSignalAddress(
01113       PINDEX idx
01114     ) const { return signalAddresses[idx]; }
01115 
01118     const PStringArray & GetAliases() const { return aliases; }
01119 
01122     BOOL ContainsAlias(
01123       const PString & alias
01124       ) { return aliases.GetStringsIndex(alias) != P_MAX_INDEX; }
01125 
01128     PINDEX GetAliasCount() const { return aliases.GetSize(); }
01129 
01132     PString GetAlias(
01133       PINDEX idx
01134     ) const { return aliases[idx]; }
01135 
01141     void RemoveAlias(
01142       const PString & alias
01143     );
01144 
01147     virtual const H235Authenticators & GetAuthenticators() const { return authenticators; }
01148 
01151     PINDEX GetPrefixCount() const { return voicePrefixes.GetSize(); }
01152 
01155     PString GetPrefix(
01156       PINDEX idx
01157     ) const { return voicePrefixes[idx]; }
01158 
01161     const PCaselessString & GetApplicationInfo() const { return applicationInfo; }
01162 
01165     unsigned GetProtocolVersion() const { return protocolVersion; }
01166 
01169     BOOL IsBehindNAT() const { return isBehindNAT; }
01170 
01173     BOOL CanDisplayAmountString() const { return canDisplayAmountString; }
01174 
01177     BOOL CanEnforceDurationLimit() const { return canEnforceDurationLimit; }
01178 
01181     BOOL CanReceiveRIP() const;
01182 
01185     BOOL GetH225Version() const { return h225Version; }
01187 
01197       virtual BOOL OnSendDescriptorForEndpoint(
01198         H225_ArrayOf_AliasAddress & aliases,          
01199         H225_EndpointType & terminalType,             
01200         H225_ArrayOf_AliasAddress & transportAddresses  
01201       );
01203 
01204 
01205   protected:
01206     H323GatekeeperServer    & gatekeeper;
01207     H323GatekeeperListener  * rasChannel;
01208 
01209     PString                   identifier;
01210     OpalGloballyUniqueID      descriptorID;
01211     H323TransportAddressArray rasAddresses;
01212     H323TransportAddressArray signalAddresses;
01213     PStringArray              aliases;
01214     PStringArray              voicePrefixes;
01215     PCaselessString           applicationInfo;
01216     unsigned                  protocolVersion;
01217     BOOL                      isBehindNAT;
01218     BOOL                      canDisplayAmountString;
01219     BOOL                      canEnforceDurationLimit;
01220     unsigned                  h225Version;
01221     unsigned                  timeToLive;
01222     H235Authenticators        authenticators;
01223 
01224     PTime lastRegistration;
01225     PTime lastInfoResponse;
01226 
01227     PSortedList<H323GatekeeperCall> activeCalls;
01228     POrdinalDictionary<PString>     serviceControlSessions;
01229 };
01230 
01231 
01237 class H323GatekeeperListener : public H225_RAS
01238 {
01239     PCLASSINFO(H323GatekeeperListener, H225_RAS);
01240   public:
01245     H323GatekeeperListener(
01246       H323EndPoint & endpoint,               
01247       H323GatekeeperServer & server,         
01248       const PString & gatekeeperIdentifier,  
01249       H323Transport * transport = NULL       
01250     );
01251 
01254     ~H323GatekeeperListener();
01256 
01261     BOOL UnregistrationRequest(
01262       const H323RegisteredEndPoint & ep,
01263       unsigned reason
01264     );
01265 
01268     BOOL DisengageRequest(
01269       const H323GatekeeperCall & call,
01270       unsigned reason
01271     );
01272 
01275     virtual BOOL InfoRequest(
01276       H323RegisteredEndPoint & ep,
01277       H323GatekeeperCall * call = NULL
01278     );
01279 
01282     virtual BOOL ServiceControlIndication(
01283       H323RegisteredEndPoint & ep,
01284       const H323ServiceControlSession & session,
01285       H323GatekeeperCall * call = NULL
01286     );
01288 
01295     virtual H323GatekeeperRequest::Response OnDiscovery(
01296       H323GatekeeperGRQ & request
01297     );
01298 
01303     virtual H323GatekeeperRequest::Response OnRegistration(
01304       H323GatekeeperRRQ & request
01305     );
01306 
01311     virtual H323GatekeeperRequest::Response OnUnregistration(
01312       H323GatekeeperURQ & request
01313     );
01314 
01319     virtual H323GatekeeperRequest::Response OnAdmission(
01320       H323GatekeeperARQ & request
01321     );
01322 
01327     virtual H323GatekeeperRequest::Response OnDisengage(
01328       H323GatekeeperDRQ & request
01329     );
01330 
01335     virtual H323GatekeeperRequest::Response OnBandwidth(
01336       H323GatekeeperBRQ & request
01337     );
01338 
01343     virtual H323GatekeeperRequest::Response OnLocation(
01344       H323GatekeeperLRQ & request
01345     );
01346 
01351     virtual H323GatekeeperRequest::Response OnInfoResponse(
01352       H323GatekeeperIRR & request
01353     );
01355 
01358     virtual BOOL OnReceiveGatekeeperRequest(const H323RasPDU &, const H225_GatekeeperRequest &);
01359     virtual BOOL OnReceiveRegistrationRequest(const H323RasPDU &, const H225_RegistrationRequest &);
01360     virtual BOOL OnReceiveUnregistrationRequest(const H323RasPDU &, const H225_UnregistrationRequest &);
01361     virtual BOOL OnReceiveUnregistrationConfirm(const H225_UnregistrationConfirm &);
01362     virtual BOOL OnReceiveUnregistrationReject(const H225_UnregistrationReject &);
01363     virtual BOOL OnReceiveAdmissionRequest(const H323RasPDU &, const H225_AdmissionRequest &);
01364     virtual BOOL OnReceiveBandwidthRequest(const H323RasPDU &, const H225_BandwidthRequest &);
01365     virtual BOOL OnReceiveBandwidthConfirm(const H225_BandwidthConfirm &);
01366     virtual BOOL OnReceiveBandwidthReject(const H225_BandwidthReject &);
01367     virtual BOOL OnReceiveDisengageRequest(const H323RasPDU &, const H225_DisengageRequest &);
01368     virtual BOOL OnReceiveDisengageConfirm(const H225_DisengageConfirm &);
01369     virtual BOOL OnReceiveDisengageReject(const H225_DisengageReject &);
01370     virtual BOOL OnReceiveLocationRequest(const H323RasPDU &, const H225_LocationRequest &);
01371     virtual BOOL OnReceiveInfoRequestResponse(const H323RasPDU &, const H225_InfoRequestResponse &);
01372     virtual BOOL OnReceiveResourcesAvailableConfirm(const H225_ResourcesAvailableConfirm &);
01374 
01377     H323GatekeeperServer & GetGatekeeper() const { return gatekeeper; }
01379 
01380 
01381   protected:
01382     H323GatekeeperServer & gatekeeper;
01383 };
01384 
01385 
01396 class H323GatekeeperServer : public H323TransactionServer
01397 {
01398     PCLASSINFO(H323GatekeeperServer, H323TransactionServer);
01399   public:
01404     H323GatekeeperServer(
01405       H323EndPoint & endpoint
01406     );
01407 
01410     ~H323GatekeeperServer();
01412 
01413     WORD GetDefaultUdpPort() { return H225_RAS::DefaultRasUdpPort; }
01414 
01425     virtual H323Transactor * CreateListener(
01426       H323Transport * transport  
01427     );
01428 
01430 
01436     virtual H323GatekeeperRequest::Response OnDiscovery(
01437       H323GatekeeperGRQ & request
01438     );
01439 
01447     virtual H323GatekeeperRequest::Response OnRegistration(
01448       H323GatekeeperRRQ & request
01449     );
01450 
01456     virtual H323GatekeeperRequest::Response OnUnregistration(
01457       H323GatekeeperURQ & request
01458     );
01459 
01464     virtual H323GatekeeperRequest::Response OnInfoResponse(
01465       H323GatekeeperIRR & request
01466     );
01467 
01478     virtual void AddEndPoint(
01479       H323RegisteredEndPoint * ep
01480     );
01481 
01484     virtual BOOL RemoveEndPoint(
01485       H323RegisteredEndPoint * ep
01486     );
01487 
01496     virtual H323RegisteredEndPoint * CreateRegisteredEndPoint(
01497       H323GatekeeperRRQ & request
01498     );
01499 
01508     virtual PString CreateEndPointIdentifier();
01509 
01512     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByIdentifier(
01513       const PString & identifier,
01514       PSafetyMode mode = PSafeReference
01515     );
01516 
01519     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointBySignalAddresses(
01520       const H225_ArrayOf_TransportAddress & addresses,
01521       PSafetyMode mode = PSafeReference
01522     );
01523 
01526     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointBySignalAddress(
01527       const H323TransportAddress & address,
01528       PSafetyMode mode = PSafeReference
01529     );
01530 
01533     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByAliasAddress(
01534       const H225_AliasAddress & alias,
01535       PSafetyMode mode = PSafeReadWrite
01536     );
01537 
01540     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByAliasString(
01541       const PString & alias,
01542       PSafetyMode mode = PSafeReference
01543     );
01544 
01547     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByPartialAlias(
01548       const PString & alias,
01549       PSafetyMode mode = PSafeReference
01550     );
01551 
01554     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByPrefixString(
01555       const PString & prefix,
01556       PSafetyMode mode = PSafeReference
01557     );
01558 
01561     PSafePtr<H323RegisteredEndPoint> GetFirstEndPoint(
01562       PSafetyMode mode = PSafeReference
01563     ) { return PSafePtr<H323RegisteredEndPoint>(byIdentifier, mode); }
01565 
01566     PSafePtr<H323RegisteredEndPoint> FindDestinationEndPoint(
01567       const OpalGloballyUniqueID & id, 
01568       H323GatekeeperCall::Direction direction
01569     );
01570     
01578     virtual H323GatekeeperRequest::Response OnAdmission(
01579       H323GatekeeperARQ & request
01580     );
01581 
01586     virtual H323GatekeeperRequest::Response OnDisengage(
01587       H323GatekeeperDRQ & request
01588     );
01589 
01594     virtual H323GatekeeperRequest::Response OnBandwidth(
01595       H323GatekeeperBRQ & request
01596     );
01597 
01606     virtual H323GatekeeperCall * CreateCall(
01607       const OpalGloballyUniqueID & callIdentifier,
01608       H323GatekeeperCall::Direction direction
01609     );
01610 
01613     virtual void RemoveCall(
01614       H323GatekeeperCall * call
01615     );
01616 
01619     virtual PSafePtr<H323GatekeeperCall> FindCall(
01620       const PString & description,
01621       PSafetyMode mode = PSafeReference
01622     );
01623 
01626     virtual PSafePtr<H323GatekeeperCall> FindCall(
01627       const OpalGloballyUniqueID & callIdentifier,
01628       BOOL answeringCall,
01629       PSafetyMode mode = PSafeReference
01630     );
01631 
01634     virtual PSafePtr<H323GatekeeperCall> FindCall(
01635       const OpalGloballyUniqueID & callIdentifier,
01636       H323GatekeeperCall::Direction direction,
01637       PSafetyMode mode = PSafeReference
01638     );
01639 
01642     PSafePtr<H323GatekeeperCall> GetFirstCall(
01643       PSafetyMode mode = PSafeReference
01644     ) { return PSafePtr<H323GatekeeperCall>(activeCalls, mode); }
01646 
01656     virtual H323GatekeeperRequest::Response OnLocation(
01657       H323GatekeeperLRQ & request
01658     );
01659 
01670     virtual BOOL TranslateAliasAddress(
01671       const H225_AliasAddress & alias,
01672       H225_ArrayOf_AliasAddress & aliases,
01673       H323TransportAddress & address,
01674       BOOL & isGKRouted
01675     );
01676 
01696     virtual BOOL TranslateAliasAddressToSignalAddress(
01697       const H225_AliasAddress & alias,
01698       H323TransportAddress & address
01699     );
01701 
01713     virtual BOOL CheckSignalAddressPolicy(
01714       const H323RegisteredEndPoint & ep,
01715       const H225_AdmissionRequest & arq,
01716       const H323TransportAddress & address
01717     );
01718 
01731     virtual BOOL CheckAliasAddressPolicy(
01732       const H323RegisteredEndPoint & ep,
01733       const H225_AdmissionRequest & arq,
01734       const H225_AliasAddress & alias
01735     );
01736 
01749     virtual BOOL CheckAliasStringPolicy(
01750       const H323RegisteredEndPoint & ep,
01751       const H225_AdmissionRequest & arq,
01752       const PString & alias
01753     );
01754 
01760     virtual unsigned AllocateBandwidth(
01761       unsigned newBandwidth,
01762       unsigned oldBandwidth = 0
01763     );
01765 
01777     virtual BOOL GetAdmissionRequestAuthentication(
01778       H323GatekeeperARQ & info,           
01779       H235Authenticators & authenticators 
01780     );
01781 
01787     virtual BOOL GetUsersPassword(
01788       const PString & alias,
01789       PString & password,
01790       H323RegisteredEndPoint & registeredEndpoint
01791     ) const;
01792     virtual BOOL GetUsersPassword(
01793       const PString & alias,
01794       PString & password
01795     ) const;
01797 
01802     H323PeerElement * GetPeerElement() const { return peerElement; }
01803 
01807     void SetPeerElement(
01808       H323PeerElement * newPeerElement
01809     );
01810 
01816     void CreatePeerElement(
01817       const H323TransportAddress & h501Interface
01818     );
01819 
01825     BOOL OpenPeerElement(
01826       const H323TransportAddress & remotePeer,
01827       BOOL append = FALSE,
01828       BOOL keepTrying = TRUE
01829     );
01831 
01836     const PString & GetGatekeeperIdentifier() const { return gatekeeperIdentifier; }
01837 
01843     void SetGatekeeperIdentifier(
01844       const PString & id,
01845       BOOL adjustListeners = TRUE
01846     );
01847 
01850     unsigned GetAvailableBandwidth() const { return totalBandwidth; }
01851 
01854     void SetAvailableBandwidth(unsigned bps100) { totalBandwidth = bps100; }
01855 
01858     unsigned GetUsedBandwidth() const { return usedBandwidth; }
01859 
01862     unsigned GetDefaultBandwidth() const { return defaultBandwidth; }
01863 
01866     unsigned GetTimeToLive() const { return defaultTimeToLive; }
01867 
01870     void SetTimeToLive(unsigned seconds) { defaultTimeToLive = seconds; }
01871 
01874     unsigned GetInfoResponseRate() const { return defaultInfoResponseRate; }
01875 
01878     void SetInfoResponseRate(unsigned seconds) { defaultInfoResponseRate = seconds; }
01879 
01882     BOOL IsGatekeeperRouted() const { return isGatekeeperRouted; }
01883 
01886     BOOL IsRequiredH235() const { return requireH235; }
01887 
01890     unsigned GetActiveRegistrations() const { return byIdentifier.GetSize(); }
01891 
01894     unsigned GetPeakRegistrations() const { return peakRegistrations; }
01895 
01898     unsigned GetTotalRegistrations() const { return totalRegistrations; }
01899 
01902     unsigned GetRejectedRegistrations() const { return rejectedRegistrations; }
01903 
01906     unsigned GetActiveCalls() const { return activeCalls.GetSize(); }
01907 
01910     unsigned GetPeakCalls() const { return peakCalls; }
01911 
01914     unsigned GetTotalCalls() const { return totalCalls; }
01915 
01918     unsigned GetRejectedCalls() const { return rejectedCalls; }
01920 
01921     // Remove an alias from the server database.
01922     void RemoveAlias(
01923       H323RegisteredEndPoint & ep,
01924       const PString & alias
01925     );
01926 
01927     // called when an endpoint needs to send a descriptor to the H.501 peer element
01928     virtual BOOL OnSendDescriptorForEndpoint(
01929       H323RegisteredEndPoint & /*ep*/,                    
01930       H225_ArrayOf_AliasAddress & /*aliases*/,            
01931       H225_EndpointType & /*terminalType*/,               
01932       H225_ArrayOf_AliasAddress & /*transportAddresses*/  
01933     )
01934     { return TRUE; } 
01935 
01936     virtual BOOL AllowDuplicateAlias(const H225_ArrayOf_AliasAddress & /*aliases*/)
01937     { return canHaveDuplicateAlias; }
01938 
01939   protected:
01940 
01941     PDECLARE_NOTIFIER(PThread, H323GatekeeperServer, MonitorMain);
01942 
01943     // Configuration & policy variables
01944     PString  gatekeeperIdentifier;
01945     unsigned totalBandwidth;
01946     unsigned usedBandwidth;
01947     unsigned defaultBandwidth;
01948     unsigned maximumBandwidth;
01949     unsigned defaultTimeToLive;
01950     unsigned defaultInfoResponseRate;
01951     BOOL     overwriteOnSameSignalAddress;
01952     BOOL     canHaveDuplicateAlias;
01953     BOOL     canHaveDuplicatePrefix;
01954     BOOL     canOnlyCallRegisteredEP;
01955     BOOL     canOnlyAnswerRegisteredEP;
01956     BOOL     answerCallPreGrantedARQ;
01957     BOOL     makeCallPreGrantedARQ;
01958     BOOL     isGatekeeperRouted;
01959     BOOL     aliasCanBeHostName;
01960     BOOL     requireH235;
01961     BOOL     disengageOnHearbeatFail;
01962 
01963     PStringToString passwords;
01964 
01965     // Dynamic variables
01966     PMutex         mutex;
01967     time_t         identifierBase;
01968     unsigned       nextIdentifier;
01969     PThread      * monitorThread;
01970     PSyncPoint     monitorExit;
01971 
01972     PLIST(ListenerList, H323GatekeeperListener);
01973     ListenerList listeners;
01974 
01975     H323PeerElement * peerElement;
01976 
01977     PSafeDictionary<PString, H323RegisteredEndPoint> byIdentifier;
01978 
01979     class StringMap : public PString {
01980         PCLASSINFO(StringMap, PString);
01981       public:
01982         StringMap(const PString & from, const PString & id)
01983           : PString(from), identifier(id) { }
01984         PString identifier;
01985     };
01986     PSortedStringList byAddress;
01987     PSortedStringList byAlias;
01988     PSortedStringList byVoicePrefix;
01989 
01990     PSafeSortedList<H323GatekeeperCall> activeCalls;
01991 
01992     PINDEX peakRegistrations;
01993     PINDEX totalRegistrations;
01994     PINDEX rejectedRegistrations;
01995     PINDEX peakCalls;
01996     PINDEX totalCalls;
01997     PINDEX rejectedCalls;
01998 
01999   friend class H323GatekeeperRRQ;
02000   friend class H323GatekeeperARQ;
02001 };
02002 
02003 
02004 #endif // __OPAL_GKSERVER_H
02005 
02006 
02008 

Generated on Mon Sep 25 16:19:37 2006 for OPAL by  doxygen 1.4.7