Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

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-2000 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 1.83  2004/09/03 01:06:08  csoutheren
00031  * Added initial hooks for H.460 GEF
00032  * Thanks to Simon Horne and ISVO (Asia) Pte Ltd. for this contribution
00033  *
00034  * Revision 1.82  2004/08/03 07:00:13  csoutheren
00035  * Added isGKRouted hint to TranslateAliasAddress as this is needed for the reply ACF
00036  *
00037  * Revision 1.81  2004/06/15 03:30:45  csoutheren
00038  * Adde guard to function to prevent crash if no aliases on an endpoint
00039  *
00040  * Revision 1.80  2004/06/04 07:05:07  csoutheren
00041  * Fixed obvious typos
00042  *
00043  * Revision 1.79  2004/04/25 01:52:46  rjongbloed
00044  * Fixed GCC 3.4 warnings
00045  *
00046  * Revision 1.78  2004/04/21 01:39:05  csoutheren
00047  * Added new overrides to GatekeeperServer to provide virtuals when calls and endpoints are created and destroyed
00048  *
00049  * Revision 1.77  2004/04/15 07:43:36  csoutheren
00050  * Allow gatekeeper to make a decision on multiple alias registrations for each registration
00051  *
00052  * Revision 1.76  2004/04/14 01:41:59  csoutheren
00053  * Added access to endpoint information for GetUserPassword
00054  *
00055  * Revision 1.75  2004/03/31 07:16:22  csoutheren
00056  * Added virtual to provide access to H.501 descriptor sent by GK
00057  *
00058  * Revision 1.74  2004/02/15 03:36:30  rjongbloed
00059  * Fixed bug in removing prefixes, plus added ability to have multiple endpoints
00060  *   with the same profix, thanks Rossano Ravelli
00061  *
00062  * Revision 1.73  2004/02/07 11:43:59  rjongbloed
00063  * Fixed deadlocks caused under high load by failure to check locking
00064  *   success. Also added functions to find destination endpoint.
00065  *   Thanks Federico Pinna and the gang at Reitek S.p.A.
00066  *
00067  * Revision 1.72  2003/12/24 07:08:47  csoutheren
00068  * Added TranslateAliasAddress on H323GatekeeperCall
00069  *
00070  * Revision 1.71  2003/12/11 05:39:04  csoutheren
00071  * Added storage of H.225 version in endpoint structure
00072  * Disabled sending RIPs to endpoints that cannot handle them
00073  *
00074  * Revision 1.70  2003/12/11 02:18:17  csoutheren
00075  * More fixes for NM deregistration problems. Seems to be fixed now :)
00076  *
00077  * Revision 1.69  2003/12/09 00:58:46  csoutheren
00078  * Fixed problem with endpoints deregistering
00079  *
00080  * Revision 1.68  2003/12/09 00:33:17  csoutheren
00081  * Added patch to prevent crash when NM unregisters from GK
00082  * Abject apologies to Rossano Ravelli for taking so long to add this
00083  *
00084  * Revision 1.67  2003/04/30 00:28:50  robertj
00085  * Redesigned the alternate credentials in ARQ system as old implementation
00086  *   was fraught with concurrency issues, most importantly it can cause false
00087  *   detection of replay attacks taking out an endpoint completely.
00088  *
00089  * Revision 1.66  2003/04/02 06:58:10  robertj
00090  * Added support for (optional) duplicate aliases in gatekeeper server, necessitating
00091  *   the removal of AddAlias and RemoveAlias functions.
00092  *
00093  * Revision 1.65  2003/04/02 06:07:12  robertj
00094  * Added H.323 Annex G Peer Element support to gatekeeper server.
00095  *
00096  * Revision 1.64  2003/04/01 07:30:52  robertj
00097  * Added function to translate alias into alias list and transport to make
00098  *   use of full information returned by peer element.
00099  *
00100  * Revision 1.63  2003/04/01 04:47:48  robertj
00101  * Abstracted H.225 RAS transaction processing (RIP and secondary thread) in
00102  *   server environment for use by H.501 peer elements.
00103  *
00104  * Revision 1.62  2003/03/26 07:10:03  robertj
00105  * Added more access functions.
00106  *
00107  * Revision 1.61  2003/03/17 22:52:06  craigs
00108  * Improvided useability of AddAlias and RemoveAlias
00109  *
00110  * Revision 1.60  2003/03/04 05:34:13  robertj
00111  * Fixed GNU warnings
00112  *
00113  * Revision 1.59  2003/03/04 05:27:51  robertj
00114  * Added statistics for rejected registrations and call admissions.
00115  *
00116  * Revision 1.58  2003/03/03 06:59:26  robertj
00117  * Fixed call SetBandwidth function so adjusts global bandwidth as well.
00118  *
00119  * Revision 1.57  2003/02/21 07:21:40  robertj
00120  * Fixed incorrect ancestor in PCLASSINFO()
00121  *
00122  * Revision 1.56  2003/02/21 05:28:39  craigs
00123  * Factored out code for user with peer elements
00124  *
00125  * Revision 1.55  2003/02/06 04:43:14  robertj
00126  * Changes to help with endpoints behind NAT.
00127  *
00128  * Revision 1.54  2003/02/03 03:58:06  robertj
00129  * Fixed use of local password database with ep's that have multiple aliases.
00130  *
00131  * Revision 1.53  2003/02/01 13:31:14  robertj
00132  * Changes to support CAT authentication in RAS.
00133  *
00134  * Revision 1.52  2002/12/17 01:25:23  robertj
00135  * Added call backs on gk server when ep indicates alerting or connect.
00136  *
00137  * Revision 1.51  2002/11/28 05:45:46  robertj
00138  * Fixed bug so can set total bandwidth while calls are in progress.
00139  *
00140  * Revision 1.50  2002/11/28 04:41:44  robertj
00141  * Added support for RAS ServiceControlIndication command.
00142  *
00143  * Revision 1.49  2002/11/27 06:54:52  robertj
00144  * Added Service Control Session management as per Annex K/H.323 via RAS
00145  *   only at this stage.
00146  * Added H.248 ASN and very primitive infrastructure for linking into the
00147  *   Service Control Session management system.
00148  * Added basic infrastructure for Annex K/H.323 HTTP transport system.
00149  * Added Call Credit Service Control to display account balances.
00150  *
00151  * Revision 1.48  2002/11/22 00:11:29  robertj
00152  * Added call start time.
00153  *
00154  * Revision 1.47  2002/11/18 23:40:45  robertj
00155  * Changed to use the H323EndPoint::CreateAuthenticators() function, we
00156  *   should use only one.
00157  *
00158  * Revision 1.46  2002/11/12 11:36:03  robertj
00159  * Added function to find endpoint by partial alias.
00160  * Optimised endpoint "indexes" to use sorted lists instead of dictionaries.
00161  *
00162  * Revision 1.45  2002/11/06 23:23:48  robertj
00163  * Fixed minor error in parameter, should be reference not value
00164  *
00165  * Revision 1.44  2002/10/29 00:12:02  robertj
00166  * Changed template classes so things like PSafeList actually creates the
00167  *   base collection class as well.
00168  * Improved setting of usage info, included getting it from BRQ etc.
00169  *
00170  * Revision 1.43  2002/10/21 00:54:47  robertj
00171  * Added function to unregister an endpoint via user interface.
00172  * Added reason code to call disengage.
00173  * Added ability to find call by a description string.
00174  *
00175  * Revision 1.42  2002/10/17 05:26:33  robertj
00176  * Added function to get at registered endpoints protocol version.
00177  *
00178  * Revision 1.41  2002/10/16 07:22:50  robertj
00179  * Added support for endpoints that do not support RRQ timeToLive parameter,
00180  *   will actively go see if ep is there using IRQ before expiring the ep.
00181  *
00182  * Revision 1.40  2002/10/01 08:17:34  robertj
00183  * Fixed (benign) race condition between client and server both wanting to do
00184  *   a DRQ of a call at the same time. Caused an Assert, but no crash.
00185  *
00186  * Revision 1.39  2002/09/26 01:27:31  robertj
00187  * Changed appliation info name in registered endpoint to be caseless string.
00188  *
00189  * Revision 1.38  2002/09/24 08:03:51  robertj
00190  * Added H.225 RAS protocol version number to registered endpoint structure.
00191  *
00192  * Revision 1.37  2002/09/19 09:15:56  robertj
00193  * Fixed problem with making (and assuring with multi-threading) IRQ and DRQ
00194  *   requests are sent to the correct endpoint address, thanks Martijn Roest.
00195  *
00196  * Revision 1.36  2002/09/16 01:14:15  robertj
00197  * Added #define so can select if #pragma interface/implementation is used on
00198  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00199  *
00200  * Revision 1.35  2002/09/03 06:19:36  robertj
00201  * Normalised the multi-include header prevention ifdef/define symbol.
00202  *
00203  * Revision 1.34  2002/08/29 07:57:08  robertj
00204  * Added some statistics to gatekeeper server.
00205  *
00206  * Revision 1.33  2002/08/29 06:54:52  robertj
00207  * Removed redundent thread member variable from request info.
00208  *
00209  * Revision 1.32  2002/08/12 08:12:45  robertj
00210  * Added extra hint to help with ARQ using separate credentials from RRQ.
00211  *
00212  * Revision 1.31  2002/08/12 05:38:20  robertj
00213  * Changes to the RAS subsystem to support ability to make requests to client
00214  *   from gkserver without causing bottlenecks and race conditions.
00215  *
00216  * Revision 1.30  2002/08/05 10:03:47  robertj
00217  * Cosmetic changes to normalise the usage of pragma interface/implementation.
00218  *
00219  * Revision 1.29  2002/08/05 05:17:37  robertj
00220  * Fairly major modifications to support different authentication credentials
00221  *   in ARQ to the logged in ones on RRQ. For both client and server.
00222  * Various other H.235 authentication bugs and anomalies fixed on the way.
00223  *
00224  * Revision 1.28  2002/07/16 13:49:22  robertj
00225  * Added missing lock when removing call from endpoint.
00226  *
00227  * Revision 1.27  2002/07/11 09:33:56  robertj
00228  * Added access functions to various call statistics member variables.
00229  *
00230  * Revision 1.26  2002/07/11 07:01:37  robertj
00231  * Added Disengage() function to force call drop from gk server.
00232  * Added InfoRequest() function to force client to send an IRR.
00233  * Added ability to automatically clear calls if do not get IRR for it.
00234  *
00235  * Revision 1.25  2002/06/21 02:52:44  robertj
00236  * Fixed problem with double checking H.235 hashing, this causes failure as
00237  *   the authenticator thinks it is a replay attack.
00238  *
00239  * Revision 1.24  2002/06/19 05:03:08  robertj
00240  * Changed gk code to allow for H.235 security on an endpoint by endpoint basis.
00241  *
00242  * Revision 1.23  2002/06/12 03:55:21  robertj
00243  * Added function to add/remove multiple listeners in one go comparing against
00244  *   what is already running so does not interrupt unchanged listeners.
00245  *
00246  * Revision 1.22  2002/05/29 00:03:15  robertj
00247  * Fixed unsolicited IRR support in gk client and server,
00248  *   including support for IACK and INAK.
00249  *
00250  * Revision 1.21  2002/05/21 06:30:31  robertj
00251  * Changed GRQ to the same as all the other xRQ request handlers.
00252  *
00253  * Revision 1.20  2002/05/17 03:42:08  robertj
00254  * Fixed problems with H.235 authentication on RAS for server and client.
00255  *
00256  * Revision 1.19  2002/05/07 03:18:12  robertj
00257  * Added application info (name/version etc) into registered endpoint data.
00258  *
00259  * Revision 1.18  2002/05/06 00:56:37  robertj
00260  * Sizeable rewrite of gatekeeper server code to make more bulletproof against
00261  *   multithreaded operation. Especially when using slow response/RIP feature.
00262  * Also changed the call indexing to use call id and direction as key.
00263  *
00264  * Revision 1.17  2002/04/30 23:19:00  dereks
00265  * Fix documentation typos.
00266  *
00267  * Revision 1.16  2002/03/06 02:01:31  robertj
00268  * Fixed race condition when starting slow server response thread.
00269  *
00270  * Revision 1.15  2002/03/05 00:36:01  craigs
00271  * Added GetReplyAddress for H323GatekeeperRequest
00272  *
00273  * Revision 1.14  2002/03/03 21:34:50  robertj
00274  * Added gatekeeper monitor thread.
00275  *
00276  * Revision 1.13  2002/03/02 05:58:57  robertj
00277  * Fixed possible bandwidth leak (thanks Francisco Olarte Sanz) and in
00278  *   the process added OnBandwidth function to H323GatekeeperCall class.
00279  *
00280  * Revision 1.12  2002/03/01 04:09:09  robertj
00281  * Fixed problems with keeping track of calls. Calls are now indexed by call-id
00282  *   alone and maintain both endpoints of call in its structure. Fixes problem
00283  *   with calls form an endpoint to itself, and having two objects being tracked
00284  *   where there is really only one call.
00285  *
00286  * Revision 1.11  2002/02/04 05:21:13  robertj
00287  * Lots of changes to fix multithreaded slow response code (RIP).
00288  * Fixed problem with having two entries for same call in call list.
00289  *
00290  * Revision 1.10  2002/01/31 06:45:44  robertj
00291  * Added more checking for invalid list processing in calls database.
00292  *
00293  * Revision 1.9  2002/01/31 00:16:15  robertj
00294  * Removed const to allow things to compile!
00295  *
00296  * Revision 1.8  2001/12/15 08:08:52  robertj
00297  * Added alerting, connect and end of call times to be sent to RAS server.
00298  *
00299  * Revision 1.7  2001/12/14 06:40:47  robertj
00300  * Added call end reason codes in DisengageRequest for GK server use.
00301  *
00302  * Revision 1.6  2001/12/13 11:08:45  robertj
00303  * Significant changes to support slow request handling, automatically sending
00304  *   RIP and spawning thread to handle time consuming operation.
00305  *
00306  * Revision 1.5  2001/11/19 06:56:44  robertj
00307  * Added prefix strings for gateways registered with this gk, thanks Mikael Stolt
00308  *
00309  * Revision 1.4  2001/08/10 11:03:49  robertj
00310  * Major changes to H.235 support in RAS to support server.
00311  *
00312  * Revision 1.3  2001/08/06 07:44:52  robertj
00313  * Fixed problems with building without SSL
00314  *
00315  * Revision 1.2  2001/08/06 03:18:35  robertj
00316  * Fission of h323.h to h323ep.h & h323con.h, h323.h now just includes files.
00317  * Improved access to H.235 secure RAS functionality.
00318  * Changes to H.323 secure RAS contexts to help use with gk server.
00319  *
00320  * Revision 1.1  2001/07/24 02:30:55  robertj
00321  * Added gatekeeper RAS protocol server classes.
00322  *
00323  */
00324 
00325 #ifndef __OPAL_GKSERVER_H
00326 #define __OPAL_GKSERVER_H
00327 
00328 #ifdef P_USE_PRAGMA
00329 #pragma interface
00330 #endif
00331 
00332 
00333 #include "h323ep.h"
00334 #include "h225ras.h"
00335 #include "guid.h"
00336 #include "h235auth.h"
00337 #include "h323pdu.h"
00338 #include "h323trans.h"
00339 
00340 #include <ptlib/safecoll.h>
00341 
00342 
00343 class PASN_Sequence;
00344 class PASN_Choice;
00345 
00346 class H225_AliasAddress;
00347 class H225_ArrayOf_TransportAddress;
00348 class H225_GatekeeperIdentifier;
00349 class H225_EndpointIdentifier;
00350 class H225_InfoRequestResponse_perCallInfo_subtype;
00351 class H225_RasUsageInformation;
00352 
00353 class H323RegisteredEndPoint;
00354 class H323GatekeeperListener;
00355 class H323GatekeeperServer;
00356 class H323RasPDU;
00357 class H323PeerElement;
00358 
00359 
00360 class H323GatekeeperRequest : public H323Transaction
00361 {
00362     PCLASSINFO(H323GatekeeperRequest, H323Transaction);
00363   public:
00368     H323GatekeeperRequest(
00369       H323GatekeeperListener & rasChannel,
00370       const H323RasPDU & pdu
00371     );
00373 
00374     virtual H323TransactionPDU * CreateRIP(
00375       unsigned sequenceNumber,
00376       unsigned delay
00377     ) const;
00378 
00379     virtual BOOL WritePDU(
00380       H323TransactionPDU & pdu
00381     );
00382     BOOL CheckCryptoTokens();
00383     BOOL CheckGatekeeperIdentifier();
00384     BOOL GetRegisteredEndPoint();
00385 
00386     virtual PString GetGatekeeperIdentifier() const = 0;
00387     virtual unsigned GetGatekeeperRejectTag() const = 0;
00388     virtual PString GetEndpointIdentifier() const = 0;
00389     virtual unsigned GetRegisteredEndPointRejectTag() const = 0;
00390     virtual unsigned GetSecurityRejectTag() const = 0;
00391 
00392     H323GatekeeperListener & GetRasChannel() const { return rasChannel; }
00393 
00394     PSafePtr<H323RegisteredEndPoint> endpoint;
00395 
00396   protected:
00397     H323GatekeeperListener & rasChannel;
00398 };
00399 
00400 
00401 class H323GatekeeperGRQ : public H323GatekeeperRequest
00402 {
00403     PCLASSINFO(H323GatekeeperGRQ, H323GatekeeperRequest);
00404   public:
00405     H323GatekeeperGRQ(
00406       H323GatekeeperListener & listener,
00407       const H323RasPDU & pdu
00408     );
00409 
00410 #if PTRACING
00411     virtual const char * GetName() const;
00412 #endif
00413     virtual PString GetGatekeeperIdentifier() const;
00414     virtual unsigned GetGatekeeperRejectTag() const;
00415     virtual PString GetEndpointIdentifier() const;
00416     virtual unsigned GetRegisteredEndPointRejectTag() const;
00417     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00418     virtual unsigned GetSecurityRejectTag() const;
00419     virtual void SetRejectReason(
00420       unsigned reasonCode
00421     );
00422 
00423     H225_GatekeeperRequest & grq;
00424     H225_GatekeeperConfirm & gcf;
00425     H225_GatekeeperReject  & grj;
00426 
00427   protected:
00428     virtual Response OnHandlePDU();
00429 };
00430 
00431 
00432 class H323GatekeeperRRQ : public H323GatekeeperRequest
00433 {
00434     PCLASSINFO(H323GatekeeperRRQ, H323GatekeeperRequest);
00435   public:
00436     H323GatekeeperRRQ(
00437       H323GatekeeperListener & listener,
00438       const H323RasPDU & pdu
00439     );
00440 
00441 #if PTRACING
00442     virtual const char * GetName() const;
00443 #endif
00444     virtual PString GetGatekeeperIdentifier() const;
00445     virtual unsigned GetGatekeeperRejectTag() const;
00446     virtual PString GetEndpointIdentifier() const;
00447     virtual unsigned GetRegisteredEndPointRejectTag() const;
00448     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00449     virtual unsigned GetSecurityRejectTag() const;
00450     virtual void SetRejectReason(
00451       unsigned reasonCode
00452     );
00453 
00454     H225_RegistrationRequest & rrq;
00455     H225_RegistrationConfirm & rcf;
00456     H225_RegistrationReject  & rrj;
00457 
00458   protected:
00459     virtual Response OnHandlePDU();
00460 };
00461 
00462 
00463 class H323GatekeeperURQ : public H323GatekeeperRequest
00464 {
00465     PCLASSINFO(H323GatekeeperURQ, H323GatekeeperRequest);
00466   public:
00467     H323GatekeeperURQ(
00468       H323GatekeeperListener & listener,
00469       const H323RasPDU & pdu
00470     );
00471 
00472 #if PTRACING
00473     virtual const char * GetName() const;
00474 #endif
00475     virtual PString GetGatekeeperIdentifier() const;
00476     virtual unsigned GetGatekeeperRejectTag() const;
00477     virtual PString GetEndpointIdentifier() const;
00478     virtual unsigned GetRegisteredEndPointRejectTag() const;
00479     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00480     virtual unsigned GetSecurityRejectTag() const;
00481     virtual void SetRejectReason(
00482       unsigned reasonCode
00483     );
00484 
00485     H225_UnregistrationRequest & urq;
00486     H225_UnregistrationConfirm & ucf;
00487     H225_UnregistrationReject  & urj;
00488 
00489   protected:
00490     virtual Response OnHandlePDU();
00491 };
00492 
00493 
00494 class H323GatekeeperARQ : public H323GatekeeperRequest
00495 {
00496     PCLASSINFO(H323GatekeeperARQ, H323GatekeeperRequest);
00497   public:
00498     H323GatekeeperARQ(
00499       H323GatekeeperListener & listener,
00500       const H323RasPDU & pdu
00501     );
00502 
00503 #if PTRACING
00504     virtual const char * GetName() const;
00505 #endif
00506     virtual PString GetGatekeeperIdentifier() const;
00507     virtual unsigned GetGatekeeperRejectTag() const;
00508     virtual PString GetEndpointIdentifier() const;
00509     virtual unsigned GetRegisteredEndPointRejectTag() const;
00510     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00511     virtual unsigned GetSecurityRejectTag() const;
00512     virtual void SetRejectReason(
00513       unsigned reasonCode
00514     );
00515 
00516     H225_AdmissionRequest & arq;
00517     H225_AdmissionConfirm & acf;
00518     H225_AdmissionReject  & arj;
00519 
00520     PString alternateSecurityID;
00521 
00522   protected:
00523     virtual Response OnHandlePDU();
00524 };
00525 
00526 
00527 class H323GatekeeperDRQ : public H323GatekeeperRequest
00528 {
00529     PCLASSINFO(H323GatekeeperDRQ, H323GatekeeperRequest);
00530   public:
00531     H323GatekeeperDRQ(
00532       H323GatekeeperListener & listener,
00533       const H323RasPDU & pdu
00534     );
00535 
00536 #if PTRACING
00537     virtual const char * GetName() const;
00538 #endif
00539     virtual PString GetGatekeeperIdentifier() const;
00540     virtual unsigned GetGatekeeperRejectTag() const;
00541     virtual PString GetEndpointIdentifier() const;
00542     virtual unsigned GetRegisteredEndPointRejectTag() const;
00543     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00544     virtual unsigned GetSecurityRejectTag() const;
00545     virtual void SetRejectReason(
00546       unsigned reasonCode
00547     );
00548 
00549     H225_DisengageRequest & drq;
00550     H225_DisengageConfirm & dcf;
00551     H225_DisengageReject  & drj;
00552 
00553   protected:
00554     virtual Response OnHandlePDU();
00555 };
00556 
00557 
00558 class H323GatekeeperBRQ : public H323GatekeeperRequest
00559 {
00560     PCLASSINFO(H323GatekeeperBRQ, H323GatekeeperRequest);
00561   public:
00562     H323GatekeeperBRQ(
00563       H323GatekeeperListener & listener,
00564       const H323RasPDU & pdu
00565     );
00566 
00567 #if PTRACING
00568     virtual const char * GetName() const;
00569 #endif
00570     virtual PString GetGatekeeperIdentifier() const;
00571     virtual unsigned GetGatekeeperRejectTag() const;
00572     virtual PString GetEndpointIdentifier() const;
00573     virtual unsigned GetRegisteredEndPointRejectTag() const;
00574     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00575     virtual unsigned GetSecurityRejectTag() const;
00576     virtual void SetRejectReason(
00577       unsigned reasonCode
00578     );
00579 
00580     H225_BandwidthRequest & brq;
00581     H225_BandwidthConfirm & bcf;
00582     H225_BandwidthReject  & brj;
00583 
00584   protected:
00585     virtual Response OnHandlePDU();
00586 };
00587 
00588 
00589 class H323GatekeeperLRQ : public H323GatekeeperRequest
00590 {
00591     PCLASSINFO(H323GatekeeperLRQ, H323GatekeeperRequest);
00592   public:
00593     H323GatekeeperLRQ(
00594       H323GatekeeperListener & listener,
00595       const H323RasPDU & pdu
00596     );
00597 
00598 #if PTRACING
00599     virtual const char * GetName() const;
00600 #endif
00601     virtual PString GetGatekeeperIdentifier() const;
00602     virtual unsigned GetGatekeeperRejectTag() const;
00603     virtual PString GetEndpointIdentifier() const;
00604     virtual unsigned GetRegisteredEndPointRejectTag() const;
00605     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00606     virtual unsigned GetSecurityRejectTag() const;
00607     virtual void SetRejectReason(
00608       unsigned reasonCode
00609     );
00610 
00611     H225_LocationRequest & lrq;
00612     H225_LocationConfirm & lcf;
00613     H225_LocationReject  & lrj;
00614 
00615   protected:
00616     virtual Response OnHandlePDU();
00617 };
00618 
00619 
00620 class H323GatekeeperIRR : public H323GatekeeperRequest
00621 {
00622     PCLASSINFO(H323GatekeeperIRR, H323GatekeeperRequest);
00623   public:
00624     H323GatekeeperIRR(
00625       H323GatekeeperListener & listener,
00626       const H323RasPDU & pdu
00627     );
00628 
00629 #if PTRACING
00630     virtual const char * GetName() const;
00631 #endif
00632     virtual PString GetGatekeeperIdentifier() const;
00633     virtual unsigned GetGatekeeperRejectTag() const;
00634     virtual PString GetEndpointIdentifier() const;
00635     virtual unsigned GetRegisteredEndPointRejectTag() const;
00636     virtual H235Authenticator::ValidationResult ValidatePDU() const;
00637     virtual unsigned GetSecurityRejectTag() const;
00638     virtual void SetRejectReason(
00639       unsigned reasonCode
00640     );
00641 
00642     H225_InfoRequestResponse & irr;
00643     H225_InfoRequestAck      & iack;
00644     H225_InfoRequestNak      & inak;
00645 
00646   protected:
00647     virtual Response OnHandlePDU();
00648 };
00649 
00650 
00653 class H323GatekeeperCall : public PSafeObject
00654 {
00655     PCLASSINFO(H323GatekeeperCall, PSafeObject);
00656   public:
00659     enum Direction {
00660       AnsweringCall,
00661       OriginatingCall,
00662       UnknownDirection
00663     };
00664 
00667     H323GatekeeperCall(
00668       H323GatekeeperServer & server,               
00669       const OpalGloballyUniqueID & callIdentifier, 
00670       Direction direction                          
00671     );
00672 
00675     ~H323GatekeeperCall();
00677 
00682     Comparison Compare(
00683       const PObject & obj  
00684     ) const;
00685 
00688     void PrintOn(
00689       ostream & strm    
00690     ) const;
00692 
00700     virtual H323GatekeeperRequest::Response OnAdmission(
00701       H323GatekeeperARQ & request
00702     );
00703 
00707     virtual BOOL Disengage(
00708       int reason = -1   // Reason for disengage
00709     );
00710 
00714     virtual H323GatekeeperRequest::Response OnDisengage(
00715       H323GatekeeperDRQ & request
00716     );
00717 
00722     virtual H323GatekeeperRequest::Response OnBandwidth(
00723       H323GatekeeperBRQ & request
00724     );
00725 
00729     virtual H323GatekeeperRequest::Response OnInfoResponse(
00730       H323GatekeeperIRR & request,
00731       H225_InfoRequestResponse_perCallInfo_subtype & call
00732     );
00733 
00736     virtual void OnAlerting();
00737 
00740     virtual void OnConnected();
00741 
00752     virtual BOOL OnHeartbeat();
00753 
00760     virtual PString GetCallCreditAmount() const;
00761 
00768     virtual BOOL GetCallCreditMode() const;
00769 
00777     virtual unsigned GetDurationLimit() const;
00778 
00783     virtual BOOL SendCallCreditServiceControl();
00784 
00787     BOOL AddCallCreditServiceControl(
00788       H225_ArrayOf_ServiceControlSession & serviceControl
00789     ) const;
00790 
00795     virtual BOOL SendServiceControlSession(
00796       const H323ServiceControlSession & session
00797     );
00798 
00804     virtual BOOL TranslateAliasAddress(
00805       const H225_AliasAddress & alias,
00806       H225_ArrayOf_AliasAddress & aliases,
00807       H323TransportAddress & address,
00808       BOOL & isGkRouted
00809     );
00810 
00812 
00815     H323GatekeeperServer & GetGatekeeper() const { return gatekeeper; }
00816     H323RegisteredEndPoint & GetEndPoint() const { return *PAssertNULL(endpoint); }
00817     BOOL IsAnsweringCall() const { return direction == AnsweringCall; }
00818     unsigned GetCallReference() const { return callReference; }
00819     const OpalGloballyUniqueID & GetCallIdentifier() const { return callIdentifier; }
00820     const OpalGloballyUniqueID & GetConferenceIdentifier() const { return conferenceIdentifier; }
00821     const PString & GetSourceNumber() const { return srcNumber; }
00822     const PStringArray & GetSourceAliases() const { return srcAliases; }
00823     const H323TransportAddress & GetSourceHost() const { return srcHost; }
00824     PString GetSourceAddress() const;
00825     const PString & GetDestinationNumber() const { return dstNumber; }
00826     const PStringArray & GetDestinationAliases() const { return dstAliases; }
00827     const H323TransportAddress & GetDestinationHost() const { return dstHost; }
00828     PString GetDestinationAddress() const;
00829     unsigned GetBandwidthUsed() const { return bandwidthUsed; }
00830     BOOL SetBandwidthUsed(unsigned bandwidth);
00831     const PTime & GetLastInfoResponseTime() const { return lastInfoResponse; }
00832     const PTime & GetCallStartTime() const { return callStartTime; }
00833     const PTime & GetAlertingTime() const { return alertingTime; }
00834     const PTime & GetConnectedTime() const { return connectedTime; }
00835     const PTime & GetCallEndTime() const { return callEndTime; }
00836     H323Connection::CallEndReason GetCallEndReason() const { return callEndReason; }
00838 
00839   protected:
00840     void SetUsageInfo(const H225_RasUsageInformation & usage);
00841 
00842     H323GatekeeperServer   & gatekeeper;
00843     H323RegisteredEndPoint * endpoint;
00844     H323GatekeeperListener * rasChannel;
00845 
00846     Direction            direction;
00847     unsigned             callReference;
00848     OpalGloballyUniqueID callIdentifier;
00849     OpalGloballyUniqueID conferenceIdentifier;
00850     PString              srcNumber;
00851     PStringArray         srcAliases;
00852     H323TransportAddress srcHost;
00853     PString              dstNumber;
00854     PStringArray         dstAliases;
00855     H323TransportAddress dstHost;
00856     unsigned             bandwidthUsed;
00857     unsigned             infoResponseRate;
00858     PTime                lastInfoResponse;
00859 
00860     BOOL                          drqReceived;
00861     PTime                         callStartTime;
00862     PTime                         alertingTime;
00863     PTime                         connectedTime;
00864     PTime                         callEndTime;
00865     H323Connection::CallEndReason callEndReason;
00866 };
00867 
00868 
00874 class H323RegisteredEndPoint : public PSafeObject
00875 {
00876     PCLASSINFO(H323RegisteredEndPoint, PSafeObject);
00877   public:
00882     H323RegisteredEndPoint(
00883       H323GatekeeperServer & server, 
00884       const PString & id             
00885     );
00887 
00892     Comparison Compare(
00893       const PObject & obj  
00894     ) const;
00895 
00898     void PrintOn(
00899       ostream & strm    
00900     ) const;
00902 
00909     virtual void AddCall(
00910       H323GatekeeperCall * call
00911     );
00912 
00917     virtual BOOL RemoveCall(
00918       H323GatekeeperCall * call
00919     );
00920 
00923     PINDEX GetCallCount() const { return activeCalls.GetSize(); }
00924 
00927     H323GatekeeperCall & GetCall(
00928       PINDEX idx
00929     ) { return activeCalls[idx]; }
00931 
00940     virtual H323GatekeeperRequest::Response OnRegistration(
00941       H323GatekeeperRRQ & request
00942     );
00943 
00953     virtual H323GatekeeperRequest::Response OnFullRegistration(
00954       H323GatekeeperRRQ & request
00955     );
00956 
00965     virtual H323GatekeeperRequest::Response OnSecureRegistration(
00966       H323GatekeeperRRQ & request
00967     );
00968 
00972     virtual H323GatekeeperRequest::Response OnUnregistration(
00973       H323GatekeeperURQ & request
00974     );
00975 
00979     virtual BOOL Unregister(
00980       int reason = -1   // Reason for unregistration
00981     );
00982 
00987     virtual H323GatekeeperRequest::Response OnInfoResponse(
00988       H323GatekeeperIRR & request
00989     );
00990 
01001     virtual BOOL OnTimeToLive();
01002 
01014     virtual PString GetCallCreditAmount() const;
01015 
01023     virtual BOOL GetCallCreditMode() const;
01024 
01029     virtual BOOL SendServiceControlSession(
01030       const H323ServiceControlSession & session
01031     );
01032 
01036     virtual BOOL AddServiceControlSession(
01037       const H323ServiceControlSession & session,
01038       H225_ArrayOf_ServiceControlSession & serviceControl
01039     );
01041 
01046     virtual BOOL SetPassword(
01047       const PString & password,
01048       const PString & username = PString::Empty()
01049     );
01050 
01053     const PString & GetIdentifier() const { return identifier; }
01054 
01057     const OpalGloballyUniqueID & GetDescriptorID() const { return descriptorID; }
01058 
01061     H323GatekeeperServer & GetGatekeeper() const { return gatekeeper; }
01062 
01066     const H323TransportAddressArray & GetRASAddresses() const { return rasAddresses; }
01067 
01071     PINDEX GetRASAddressCount() const { return rasAddresses.GetSize(); }
01072 
01076     H323TransportAddress GetRASAddress(
01077       PINDEX idx
01078     ) const { return rasAddresses[idx]; }
01079 
01083     const H323TransportAddressArray & GetSignalAddresses() const { return signalAddresses; }
01084 
01088     PINDEX GetSignalAddressCount() const { return signalAddresses.GetSize(); }
01089 
01093     H323TransportAddress GetSignalAddress(
01094       PINDEX idx
01095     ) const { return signalAddresses[idx]; }
01096 
01099     const PStringArray & GetAliases() const { return aliases; }
01100 
01103     BOOL ContainsAlias(
01104       const PString & alias
01105       ) { return aliases.GetStringsIndex(alias) != P_MAX_INDEX; }
01106 
01109     PINDEX GetAliasCount() const { return aliases.GetSize(); }
01110 
01113     PString GetAlias(
01114       PINDEX idx
01115     ) const { if (idx < aliases.GetSize()) return aliases[idx]; return PString::Empty(); }
01116 
01122     void RemoveAlias(
01123       const PString & alias
01124     );
01125 
01128     virtual const H235Authenticators & GetAuthenticators() const { return authenticators; }
01129 
01132     PINDEX GetPrefixCount() const { return voicePrefixes.GetSize(); }
01133 
01136     PString GetPrefix(
01137       PINDEX idx
01138     ) const { return voicePrefixes[idx]; }
01139 
01142     const PCaselessString & GetApplicationInfo() const { return applicationInfo; }
01143 
01146     unsigned GetProtocolVersion() const { return protocolVersion; }
01147 
01150     BOOL IsBehindNAT() const { return isBehindNAT; }
01151 
01154     BOOL CanDisplayAmountString() const { return canDisplayAmountString; }
01155 
01158     BOOL CanEnforceDurationLimit() const { return canEnforceDurationLimit; }
01159 
01162     BOOL CanReceiveRIP() const;
01163 
01166     BOOL GetH225Version() const { return h225Version; }
01168 
01178       virtual BOOL OnSendDescriptorForEndpoint(
01179         H225_ArrayOf_AliasAddress & aliases,          // aliases for the enndpoint
01180         H225_EndpointType & terminalType,             // terminal type
01181         H225_ArrayOf_AliasAddress & transportAddresses  // transport addresses
01182       );
01184 
01185 
01186   protected:
01187     H323GatekeeperServer    & gatekeeper;
01188     H323GatekeeperListener  * rasChannel;
01189 
01190     PString                   identifier;
01191     OpalGloballyUniqueID      descriptorID;
01192     H323TransportAddressArray rasAddresses;
01193     H323TransportAddressArray signalAddresses;
01194     PStringArray              aliases;
01195     PStringArray              voicePrefixes;
01196     PCaselessString           applicationInfo;
01197     unsigned                  protocolVersion;
01198     BOOL                      isBehindNAT;
01199     BOOL                      canDisplayAmountString;
01200     BOOL                      canEnforceDurationLimit;
01201     unsigned                  h225Version;
01202     unsigned                  timeToLive;
01203     H235Authenticators        authenticators;
01204 
01205     PTime lastRegistration;
01206     PTime lastInfoResponse;
01207 
01208     PSortedList<H323GatekeeperCall> activeCalls;
01209     POrdinalDictionary<PString>     serviceControlSessions;
01210 };
01211 
01212 
01218 class H323GatekeeperListener : public H225_RAS
01219 {
01220     PCLASSINFO(H323GatekeeperListener, H225_RAS);
01221   public:
01226     H323GatekeeperListener(
01227       H323EndPoint & endpoint,               
01228       H323GatekeeperServer & server,         
01229       const PString & gatekeeperIdentifier,  
01230       H323Transport * transport = NULL       
01231     );
01232 
01235     ~H323GatekeeperListener();
01237 
01242     BOOL UnregistrationRequest(
01243       const H323RegisteredEndPoint & ep,
01244       unsigned reason
01245     );
01246 
01249     BOOL DisengageRequest(
01250       const H323GatekeeperCall & call,
01251       unsigned reason
01252     );
01253 
01256     virtual BOOL InfoRequest(
01257       H323RegisteredEndPoint & ep,
01258       H323GatekeeperCall * call = NULL
01259     );
01260 
01263     virtual BOOL ServiceControlIndication(
01264       H323RegisteredEndPoint & ep,
01265       const H323ServiceControlSession & session,
01266       H323GatekeeperCall * call = NULL
01267     );
01269 
01276     virtual H323GatekeeperRequest::Response OnDiscovery(
01277       H323GatekeeperGRQ & request
01278     );
01279 
01284     virtual H323GatekeeperRequest::Response OnRegistration(
01285       H323GatekeeperRRQ & request
01286     );
01287 
01292     virtual H323GatekeeperRequest::Response OnUnregistration(
01293       H323GatekeeperURQ & request
01294     );
01295 
01300     virtual H323GatekeeperRequest::Response OnAdmission(
01301       H323GatekeeperARQ & request
01302     );
01303 
01308     virtual H323GatekeeperRequest::Response OnDisengage(
01309       H323GatekeeperDRQ & request
01310     );
01311 
01316     virtual H323GatekeeperRequest::Response OnBandwidth(
01317       H323GatekeeperBRQ & request
01318     );
01319 
01324     virtual H323GatekeeperRequest::Response OnLocation(
01325       H323GatekeeperLRQ & request
01326     );
01327 
01332     virtual H323GatekeeperRequest::Response OnInfoResponse(
01333       H323GatekeeperIRR & request
01334     );
01336 
01339     BOOL OnReceiveGatekeeperRequest(const H323RasPDU &, const H225_GatekeeperRequest &);
01340     BOOL OnReceiveRegistrationRequest(const H323RasPDU &, const H225_RegistrationRequest &);
01341     BOOL OnReceiveUnregistrationRequest(const H323RasPDU &, const H225_UnregistrationRequest &);
01342     BOOL OnReceiveUnregistrationConfirm(const H225_UnregistrationConfirm &);
01343     BOOL OnReceiveUnregistrationReject(const H225_UnregistrationReject &);
01344     BOOL OnReceiveAdmissionRequest(const H323RasPDU &, const H225_AdmissionRequest &);
01345     BOOL OnReceiveBandwidthRequest(const H323RasPDU &, const H225_BandwidthRequest &);
01346     BOOL OnReceiveBandwidthConfirm(const H225_BandwidthConfirm &);
01347     BOOL OnReceiveBandwidthReject(const H225_BandwidthReject &);
01348     BOOL OnReceiveDisengageRequest(const H323RasPDU &, const H225_DisengageRequest &);
01349     BOOL OnReceiveDisengageConfirm(const H225_DisengageConfirm &);
01350     BOOL OnReceiveDisengageReject(const H225_DisengageReject &);
01351     BOOL OnReceiveLocationRequest(const H323RasPDU &, const H225_LocationRequest &);
01352     BOOL OnReceiveInfoRequestResponse(const H323RasPDU &, const H225_InfoRequestResponse &);
01353     BOOL OnReceiveResourcesAvailableConfirm(const H225_ResourcesAvailableConfirm &);
01354     BOOL OnSendFeatureSet(unsigned, H225_FeatureSet & features) const;
01355     void OnReceiveFeatureSet(unsigned, const H225_FeatureSet & features) const;
01357 
01360     H323GatekeeperServer & GetGatekeeper() const { return gatekeeper; }
01362 
01363 
01364   protected:
01365     H323GatekeeperServer & gatekeeper;
01366 };
01367 
01368 
01379 class H323GatekeeperServer : public H323TransactionServer
01380 {
01381     PCLASSINFO(H323GatekeeperServer, H323TransactionServer);
01382   public:
01387     H323GatekeeperServer(
01388       H323EndPoint & endpoint
01389     );
01390 
01393     ~H323GatekeeperServer();
01395 
01396     WORD GetDefaultUdpPort() { return H225_RAS::DefaultRasUdpPort; }
01397 
01408     virtual H323Transactor * CreateListener(
01409       H323Transport * transport  // Transport for listener
01410     );
01411 
01413 
01419     virtual H323GatekeeperRequest::Response OnDiscovery(
01420       H323GatekeeperGRQ & request
01421     );
01422 
01430     virtual H323GatekeeperRequest::Response OnRegistration(
01431       H323GatekeeperRRQ & request
01432     );
01433 
01439     virtual H323GatekeeperRequest::Response OnUnregistration(
01440       H323GatekeeperURQ & request
01441     );
01442 
01447     virtual H323GatekeeperRequest::Response OnInfoResponse(
01448       H323GatekeeperIRR & request
01449     );
01450 
01461     virtual void AddEndPoint(
01462       H323RegisteredEndPoint * ep
01463     );
01464 
01467     virtual BOOL RemoveEndPoint(
01468       H323RegisteredEndPoint * ep
01469     );
01470 
01479     virtual H323RegisteredEndPoint * CreateRegisteredEndPoint(
01480       H323GatekeeperRRQ & request
01481     );
01482 
01491     virtual PString CreateEndPointIdentifier();
01492 
01495     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByIdentifier(
01496       const PString & identifier,
01497       PSafetyMode mode = PSafeReference
01498     );
01499 
01502     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointBySignalAddresses(
01503       const H225_ArrayOf_TransportAddress & addresses,
01504       PSafetyMode mode = PSafeReference
01505     );
01506 
01509     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointBySignalAddress(
01510       const H323TransportAddress & address,
01511       PSafetyMode mode = PSafeReference
01512     );
01513 
01516     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByAliasAddress(
01517       const H225_AliasAddress & alias,
01518       PSafetyMode mode = PSafeReadWrite
01519     );
01520 
01523     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByAliasString(
01524       const PString & alias,
01525       PSafetyMode mode = PSafeReference
01526     );
01527 
01530     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByPartialAlias(
01531       const PString & alias,
01532       PSafetyMode mode = PSafeReference
01533     );
01534 
01537     virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByPrefixString(
01538       const PString & prefix,
01539       PSafetyMode mode = PSafeReference
01540     );
01541 
01544     PSafePtr<H323RegisteredEndPoint> GetFirstEndPoint(
01545       PSafetyMode mode = PSafeReference
01546     ) { return PSafePtr<H323RegisteredEndPoint>(byIdentifier, mode); }
01548 
01549     PSafePtr<H323RegisteredEndPoint> FindDestinationEndPoint(
01550       const OpalGloballyUniqueID & id, 
01551       H323GatekeeperCall::Direction direction
01552     );
01553     
01561     virtual H323GatekeeperRequest::Response OnAdmission(
01562       H323GatekeeperARQ & request
01563     );
01564 
01569     virtual H323GatekeeperRequest::Response OnDisengage(
01570       H323GatekeeperDRQ & request
01571     );
01572 
01577     virtual H323GatekeeperRequest::Response OnBandwidth(
01578       H323GatekeeperBRQ & request
01579     );
01580 
01589     virtual H323GatekeeperCall * CreateCall(
01590       const OpalGloballyUniqueID & callIdentifier,
01591       H323GatekeeperCall::Direction direction
01592     );
01593 
01596     virtual void AddCall(H323GatekeeperCall *) 
01597     { }
01598 
01601     virtual void RemoveCall(
01602       H323GatekeeperCall * call
01603     );
01604 
01607     virtual PSafePtr<H323GatekeeperCall> FindCall(
01608       const PString & description,
01609       PSafetyMode mode = PSafeReference
01610     );
01611 
01614     virtual PSafePtr<H323GatekeeperCall> FindCall(
01615       const OpalGloballyUniqueID & callIdentifier,
01616       BOOL answeringCall,
01617       PSafetyMode mode = PSafeReference
01618     );
01619 
01622     virtual PSafePtr<H323GatekeeperCall> FindCall(
01623       const OpalGloballyUniqueID & callIdentifier,
01624       H323GatekeeperCall::Direction direction,
01625       PSafetyMode mode = PSafeReference
01626     );
01627 
01630     PSafePtr<H323GatekeeperCall> GetFirstCall(
01631       PSafetyMode mode = PSafeReference
01632     ) { return PSafePtr<H323GatekeeperCall>(activeCalls, mode); }
01633 
01634 
01636 
01646     virtual H323GatekeeperRequest::Response OnLocation(
01647       H323GatekeeperLRQ & request
01648     );
01649 
01661     virtual BOOL TranslateAliasAddress(
01662       const H225_AliasAddress & alias,
01663       H225_ArrayOf_AliasAddress & aliases,
01664       H323TransportAddress & address,
01665       BOOL & isGkRouted
01666     );
01667     virtual BOOL TranslateAliasAddressToSignalAddress(
01668       const H225_AliasAddress & alias,
01669       H323TransportAddress & address
01670     );
01671 
01673 
01685     virtual BOOL CheckSignalAddressPolicy(
01686       const H323RegisteredEndPoint & ep,
01687       const H225_AdmissionRequest & arq,
01688       const H323TransportAddress & address
01689     );
01690 
01703     virtual BOOL CheckAliasAddressPolicy(
01704       const H323RegisteredEndPoint & ep,
01705       const H225_AdmissionRequest & arq,
01706       const H225_AliasAddress & alias
01707     );
01708 
01721     virtual BOOL CheckAliasStringPolicy(
01722       const H323RegisteredEndPoint & ep,
01723       const H225_AdmissionRequest & arq,
01724       const PString & alias
01725     );
01726 
01732     virtual unsigned AllocateBandwidth(
01733       unsigned newBandwidth,
01734       unsigned oldBandwidth = 0
01735     );
01737 
01749     virtual BOOL GetAdmissionRequestAuthentication(
01750       H323GatekeeperARQ & info,           
01751       H235Authenticators & authenticators 
01752     );
01753 
01759     virtual BOOL GetUsersPassword(
01760       const PString & alias,
01761       PString & password,
01762       H323RegisteredEndPoint & registeredEndpoint
01763     ) const;
01764     virtual BOOL GetUsersPassword(
01765       const PString & alias,
01766       PString & password
01767     ) const;
01769 
01774     H323PeerElement * GetPeerElement() const { return peerElement; }
01775 
01779     void SetPeerElement(
01780       H323PeerElement * newPeerElement
01781     );
01782 
01788     void CreatePeerElement(
01789       const H323TransportAddress & h501Interface
01790     );
01791 
01797     BOOL OpenPeerElement(
01798       const H323TransportAddress & remotePeer,
01799       BOOL append = FALSE,
01800       BOOL keepTrying = TRUE
01801     );
01803 
01808     const PString & GetGatekeeperIdentifier() const { return gatekeeperIdentifier; }
01809 
01815     void SetGatekeeperIdentifier(
01816       const PString & id,
01817       BOOL adjustListeners = TRUE
01818     );
01819 
01822     unsigned GetAvailableBandwidth() const { return totalBandwidth; }
01823 
01826     void SetAvailableBandwidth(unsigned bps100) { totalBandwidth = bps100; }
01827 
01830     unsigned GetUsedBandwidth() const { return usedBandwidth; }
01831 
01834     unsigned GetDefaultBandwidth() const { return defaultBandwidth; }
01835 
01838     unsigned GetTimeToLive() const { return defaultTimeToLive; }
01839 
01842     void SetTimeToLive(unsigned seconds) { defaultTimeToLive = seconds; }
01843 
01846     unsigned GetInfoResponseRate() const { return defaultInfoResponseRate; }
01847 
01850     void SetInfoResponseRate(unsigned seconds) { defaultInfoResponseRate = seconds; }
01851 
01854     BOOL IsGatekeeperRouted() const { return isGatekeeperRouted; }
01855 
01858     BOOL IsRequiredH235() const { return requireH235; }
01859 
01862     unsigned GetActiveRegistrations() const { return byIdentifier.GetSize(); }
01863 
01866     unsigned GetPeakRegistrations() const { return peakRegistrations; }
01867 
01870     unsigned GetTotalRegistrations() const { return totalRegistrations; }
01871 
01874     unsigned GetRejectedRegistrations() const { return rejectedRegistrations; }
01875 
01878     unsigned GetActiveCalls() const { return activeCalls.GetSize(); }
01879 
01882     unsigned GetPeakCalls() const { return peakCalls; }
01883 
01886     unsigned GetTotalCalls() const { return totalCalls; }
01887 
01890     unsigned GetRejectedCalls() const { return rejectedCalls; }
01892 
01893     // Remove an alias from the server database.
01894     void RemoveAlias(
01895       H323RegisteredEndPoint & ep,
01896       const PString & alias
01897     );
01898 
01899     // called when an endpoint needs to send a descriptor to the H.501 peer element
01900     virtual BOOL OnSendDescriptorForEndpoint(
01901       H323RegisteredEndPoint & /*ep*/,                    // endpoint
01902       H225_ArrayOf_AliasAddress & /*aliases*/,            // aliases for the enndpoint
01903       H225_EndpointType & /*terminalType*/,               // terminal type
01904       H225_ArrayOf_AliasAddress & /*transportAddresses*/  // transport addresses
01905     )
01906     { return TRUE; } 
01907 
01908     virtual BOOL AllowDuplicateAlias(const H225_ArrayOf_AliasAddress & /*aliases*/)
01909     { return canHaveDuplicateAlias; }
01910 
01911     virtual BOOL OnSendFeatureSet(unsigned, H225_FeatureSet & features) const;
01912     virtual void OnReceiveFeatureSet(unsigned, const H225_FeatureSet & features) const;
01913 
01914   protected:
01915 
01916     PDECLARE_NOTIFIER(PThread, H323GatekeeperServer, MonitorMain);
01917 
01918     // Configuration & policy variables
01919     PString  gatekeeperIdentifier;
01920     unsigned totalBandwidth;
01921     unsigned usedBandwidth;
01922     unsigned defaultBandwidth;
01923     unsigned maximumBandwidth;
01924     unsigned defaultTimeToLive;
01925     unsigned defaultInfoResponseRate;
01926     BOOL     overwriteOnSameSignalAddress;
01927     BOOL     canHaveDuplicateAlias;
01928     BOOL     canHaveDuplicatePrefix;
01929     BOOL     canOnlyCallRegisteredEP;
01930     BOOL     canOnlyAnswerRegisteredEP;
01931     BOOL     answerCallPreGrantedARQ;
01932     BOOL     makeCallPreGrantedARQ;
01933     BOOL     isGatekeeperRouted;
01934     BOOL     aliasCanBeHostName;
01935     BOOL     requireH235;
01936     BOOL     disengageOnHearbeatFail;
01937 
01938     PStringToString passwords;
01939 
01940     // Dynamic variables
01941     PMutex         mutex;
01942     time_t         identifierBase;
01943     unsigned       nextIdentifier;
01944     PThread      * monitorThread;
01945     PSyncPoint     monitorExit;
01946 
01947     PLIST(ListenerList, H323GatekeeperListener);
01948     ListenerList listeners;
01949 
01950     H323PeerElement * peerElement;
01951 
01952     PSafeDictionary<PString, H323RegisteredEndPoint> byIdentifier;
01953 
01954     class StringMap : public PString {
01955         PCLASSINFO(StringMap, PString);
01956       public:
01957         StringMap(const PString & from, const PString & id)
01958           : PString(from), identifier(id) { }
01959         PString identifier;
01960     };
01961     PSortedStringList byAddress;
01962     PSortedStringList byAlias;
01963     PSortedStringList byVoicePrefix;
01964 
01965     PSafeSortedList<H323GatekeeperCall> activeCalls;
01966 
01967     PINDEX peakRegistrations;
01968     PINDEX totalRegistrations;
01969     PINDEX rejectedRegistrations;
01970     PINDEX peakCalls;
01971     PINDEX totalCalls;
01972     PINDEX rejectedCalls;
01973 
01974   friend class H323GatekeeperRRQ;
01975   friend class H323GatekeeperARQ;
01976 };
01977 
01978 
01979 #endif // __OPAL_GKSERVER_H
01980 
01981 
01983 

Generated on Tue Mar 15 11:16:45 2005 for OpenH323 by  doxygen 1.4.0