OpenH323 1.18.0
|
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.87 2005/11/30 13:05:01 csoutheren 00031 * Changed tags for Doxygen 00032 * 00033 * Revision 1.86 2005/01/03 14:03:19 csoutheren 00034 * Added new configure options and ability to disable/enable modules 00035 * 00036 * Revision 1.85 2005/01/03 06:25:52 csoutheren 00037 * Added extensive support for disabling code modules at compile time 00038 * 00039 * Revision 1.84 2004/12/14 06:22:20 csoutheren 00040 * More OSP implementation 00041 * 00042 * Revision 1.83 2004/09/03 01:06:08 csoutheren 00043 * Added initial hooks for H.460 GEF 00044 * Thanks to Simon Horne and ISVO (Asia) Pte Ltd. for this contribution 00045 * 00046 * Revision 1.82 2004/08/03 07:00:13 csoutheren 00047 * Added isGKRouted hint to TranslateAliasAddress as this is needed for the reply ACF 00048 * 00049 * Revision 1.81 2004/06/15 03:30:45 csoutheren 00050 * Adde guard to function to prevent crash if no aliases on an endpoint 00051 * 00052 * Revision 1.80 2004/06/04 07:05:07 csoutheren 00053 * Fixed obvious typos 00054 * 00055 * Revision 1.79 2004/04/25 01:52:46 rjongbloed 00056 * Fixed GCC 3.4 warnings 00057 * 00058 * Revision 1.78 2004/04/21 01:39:05 csoutheren 00059 * Added new overrides to GatekeeperServer to provide virtuals when calls and endpoints are created and destroyed 00060 * 00061 * Revision 1.77 2004/04/15 07:43:36 csoutheren 00062 * Allow gatekeeper to make a decision on multiple alias registrations for each registration 00063 * 00064 * Revision 1.76 2004/04/14 01:41:59 csoutheren 00065 * Added access to endpoint information for GetUserPassword 00066 * 00067 * Revision 1.75 2004/03/31 07:16:22 csoutheren 00068 * Added virtual to provide access to H.501 descriptor sent by GK 00069 * 00070 * Revision 1.74 2004/02/15 03:36:30 rjongbloed 00071 * Fixed bug in removing prefixes, plus added ability to have multiple endpoints 00072 * with the same profix, thanks Rossano Ravelli 00073 * 00074 * Revision 1.73 2004/02/07 11:43:59 rjongbloed 00075 * Fixed deadlocks caused under high load by failure to check locking 00076 * success. Also added functions to find destination endpoint. 00077 * Thanks Federico Pinna and the gang at Reitek S.p.A. 00078 * 00079 * Revision 1.72 2003/12/24 07:08:47 csoutheren 00080 * Added TranslateAliasAddress on H323GatekeeperCall 00081 * 00082 * Revision 1.71 2003/12/11 05:39:04 csoutheren 00083 * Added storage of H.225 version in endpoint structure 00084 * Disabled sending RIPs to endpoints that cannot handle them 00085 * 00086 * Revision 1.70 2003/12/11 02:18:17 csoutheren 00087 * More fixes for NM deregistration problems. Seems to be fixed now :) 00088 * 00089 * Revision 1.69 2003/12/09 00:58:46 csoutheren 00090 * Fixed problem with endpoints deregistering 00091 * 00092 * Revision 1.68 2003/12/09 00:33:17 csoutheren 00093 * Added patch to prevent crash when NM unregisters from GK 00094 * Abject apologies to Rossano Ravelli for taking so long to add this 00095 * 00096 * Revision 1.67 2003/04/30 00:28:50 robertj 00097 * Redesigned the alternate credentials in ARQ system as old implementation 00098 * was fraught with concurrency issues, most importantly it can cause false 00099 * detection of replay attacks taking out an endpoint completely. 00100 * 00101 * Revision 1.66 2003/04/02 06:58:10 robertj 00102 * Added support for (optional) duplicate aliases in gatekeeper server, necessitating 00103 * the removal of AddAlias and RemoveAlias functions. 00104 * 00105 * Revision 1.65 2003/04/02 06:07:12 robertj 00106 * Added H.323 Annex G Peer Element support to gatekeeper server. 00107 * 00108 * Revision 1.64 2003/04/01 07:30:52 robertj 00109 * Added function to translate alias into alias list and transport to make 00110 * use of full information returned by peer element. 00111 * 00112 * Revision 1.63 2003/04/01 04:47:48 robertj 00113 * Abstracted H.225 RAS transaction processing (RIP and secondary thread) in 00114 * server environment for use by H.501 peer elements. 00115 * 00116 * Revision 1.62 2003/03/26 07:10:03 robertj 00117 * Added more access functions. 00118 * 00119 * Revision 1.61 2003/03/17 22:52:06 craigs 00120 * Improvided useability of AddAlias and RemoveAlias 00121 * 00122 * Revision 1.60 2003/03/04 05:34:13 robertj 00123 * Fixed GNU warnings 00124 * 00125 * Revision 1.59 2003/03/04 05:27:51 robertj 00126 * Added statistics for rejected registrations and call admissions. 00127 * 00128 * Revision 1.58 2003/03/03 06:59:26 robertj 00129 * Fixed call SetBandwidth function so adjusts global bandwidth as well. 00130 * 00131 * Revision 1.57 2003/02/21 07:21:40 robertj 00132 * Fixed incorrect ancestor in PCLASSINFO() 00133 * 00134 * Revision 1.56 2003/02/21 05:28:39 craigs 00135 * Factored out code for user with peer elements 00136 * 00137 * Revision 1.55 2003/02/06 04:43:14 robertj 00138 * Changes to help with endpoints behind NAT. 00139 * 00140 * Revision 1.54 2003/02/03 03:58:06 robertj 00141 * Fixed use of local password database with ep's that have multiple aliases. 00142 * 00143 * Revision 1.53 2003/02/01 13:31:14 robertj 00144 * Changes to support CAT authentication in RAS. 00145 * 00146 * Revision 1.52 2002/12/17 01:25:23 robertj 00147 * Added call backs on gk server when ep indicates alerting or connect. 00148 * 00149 * Revision 1.51 2002/11/28 05:45:46 robertj 00150 * Fixed bug so can set total bandwidth while calls are in progress. 00151 * 00152 * Revision 1.50 2002/11/28 04:41:44 robertj 00153 * Added support for RAS ServiceControlIndication command. 00154 * 00155 * Revision 1.49 2002/11/27 06:54:52 robertj 00156 * Added Service Control Session management as per Annex K/H.323 via RAS 00157 * only at this stage. 00158 * Added H.248 ASN and very primitive infrastructure for linking into the 00159 * Service Control Session management system. 00160 * Added basic infrastructure for Annex K/H.323 HTTP transport system. 00161 * Added Call Credit Service Control to display account balances. 00162 * 00163 * Revision 1.48 2002/11/22 00:11:29 robertj 00164 * Added call start time. 00165 * 00166 * Revision 1.47 2002/11/18 23:40:45 robertj 00167 * Changed to use the H323EndPoint::CreateAuthenticators() function, we 00168 * should use only one. 00169 * 00170 * Revision 1.46 2002/11/12 11:36:03 robertj 00171 * Added function to find endpoint by partial alias. 00172 * Optimised endpoint "indexes" to use sorted lists instead of dictionaries. 00173 * 00174 * Revision 1.45 2002/11/06 23:23:48 robertj 00175 * Fixed minor error in parameter, should be reference not value 00176 * 00177 * Revision 1.44 2002/10/29 00:12:02 robertj 00178 * Changed template classes so things like PSafeList actually creates the 00179 * base collection class as well. 00180 * Improved setting of usage info, included getting it from BRQ etc. 00181 * 00182 * Revision 1.43 2002/10/21 00:54:47 robertj 00183 * Added function to unregister an endpoint via user interface. 00184 * Added reason code to call disengage. 00185 * Added ability to find call by a description string. 00186 * 00187 * Revision 1.42 2002/10/17 05:26:33 robertj 00188 * Added function to get at registered endpoints protocol version. 00189 * 00190 * Revision 1.41 2002/10/16 07:22:50 robertj 00191 * Added support for endpoints that do not support RRQ timeToLive parameter, 00192 * will actively go see if ep is there using IRQ before expiring the ep. 00193 * 00194 * Revision 1.40 2002/10/01 08:17:34 robertj 00195 * Fixed (benign) race condition between client and server both wanting to do 00196 * a DRQ of a call at the same time. Caused an Assert, but no crash. 00197 * 00198 * Revision 1.39 2002/09/26 01:27:31 robertj 00199 * Changed appliation info name in registered endpoint to be caseless string. 00200 * 00201 * Revision 1.38 2002/09/24 08:03:51 robertj 00202 * Added H.225 RAS protocol version number to registered endpoint structure. 00203 * 00204 * Revision 1.37 2002/09/19 09:15:56 robertj 00205 * Fixed problem with making (and assuring with multi-threading) IRQ and DRQ 00206 * requests are sent to the correct endpoint address, thanks Martijn Roest. 00207 * 00208 * Revision 1.36 2002/09/16 01:14:15 robertj 00209 * Added #define so can select if #pragma interface/implementation is used on 00210 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00211 * 00212 * Revision 1.35 2002/09/03 06:19:36 robertj 00213 * Normalised the multi-include header prevention ifdef/define symbol. 00214 * 00215 * Revision 1.34 2002/08/29 07:57:08 robertj 00216 * Added some statistics to gatekeeper server. 00217 * 00218 * Revision 1.33 2002/08/29 06:54:52 robertj 00219 * Removed redundent thread member variable from request info. 00220 * 00221 * Revision 1.32 2002/08/12 08:12:45 robertj 00222 * Added extra hint to help with ARQ using separate credentials from RRQ. 00223 * 00224 * Revision 1.31 2002/08/12 05:38:20 robertj 00225 * Changes to the RAS subsystem to support ability to make requests to client 00226 * from gkserver without causing bottlenecks and race conditions. 00227 * 00228 * Revision 1.30 2002/08/05 10:03:47 robertj 00229 * Cosmetic changes to normalise the usage of pragma interface/implementation. 00230 * 00231 * Revision 1.29 2002/08/05 05:17:37 robertj 00232 * Fairly major modifications to support different authentication credentials 00233 * in ARQ to the logged in ones on RRQ. For both client and server. 00234 * Various other H.235 authentication bugs and anomalies fixed on the way. 00235 * 00236 * Revision 1.28 2002/07/16 13:49:22 robertj 00237 * Added missing lock when removing call from endpoint. 00238 * 00239 * Revision 1.27 2002/07/11 09:33:56 robertj 00240 * Added access functions to various call statistics member variables. 00241 * 00242 * Revision 1.26 2002/07/11 07:01:37 robertj 00243 * Added Disengage() function to force call drop from gk server. 00244 * Added InfoRequest() function to force client to send an IRR. 00245 * Added ability to automatically clear calls if do not get IRR for it. 00246 * 00247 * Revision 1.25 2002/06/21 02:52:44 robertj 00248 * Fixed problem with double checking H.235 hashing, this causes failure as 00249 * the authenticator thinks it is a replay attack. 00250 * 00251 * Revision 1.24 2002/06/19 05:03:08 robertj 00252 * Changed gk code to allow for H.235 security on an endpoint by endpoint basis. 00253 * 00254 * Revision 1.23 2002/06/12 03:55:21 robertj 00255 * Added function to add/remove multiple listeners in one go comparing against 00256 * what is already running so does not interrupt unchanged listeners. 00257 * 00258 * Revision 1.22 2002/05/29 00:03:15 robertj 00259 * Fixed unsolicited IRR support in gk client and server, 00260 * including support for IACK and INAK. 00261 * 00262 * Revision 1.21 2002/05/21 06:30:31 robertj 00263 * Changed GRQ to the same as all the other xRQ request handlers. 00264 * 00265 * Revision 1.20 2002/05/17 03:42:08 robertj 00266 * Fixed problems with H.235 authentication on RAS for server and client. 00267 * 00268 * Revision 1.19 2002/05/07 03:18:12 robertj 00269 * Added application info (name/version etc) into registered endpoint data. 00270 * 00271 * Revision 1.18 2002/05/06 00:56:37 robertj 00272 * Sizeable rewrite of gatekeeper server code to make more bulletproof against 00273 * multithreaded operation. Especially when using slow response/RIP feature. 00274 * Also changed the call indexing to use call id and direction as key. 00275 * 00276 * Revision 1.17 2002/04/30 23:19:00 dereks 00277 * Fix documentation typos. 00278 * 00279 * Revision 1.16 2002/03/06 02:01:31 robertj 00280 * Fixed race condition when starting slow server response thread. 00281 * 00282 * Revision 1.15 2002/03/05 00:36:01 craigs 00283 * Added GetReplyAddress for H323GatekeeperRequest 00284 * 00285 * Revision 1.14 2002/03/03 21:34:50 robertj 00286 * Added gatekeeper monitor thread. 00287 * 00288 * Revision 1.13 2002/03/02 05:58:57 robertj 00289 * Fixed possible bandwidth leak (thanks Francisco Olarte Sanz) and in 00290 * the process added OnBandwidth function to H323GatekeeperCall class. 00291 * 00292 * Revision 1.12 2002/03/01 04:09:09 robertj 00293 * Fixed problems with keeping track of calls. Calls are now indexed by call-id 00294 * alone and maintain both endpoints of call in its structure. Fixes problem 00295 * with calls form an endpoint to itself, and having two objects being tracked 00296 * where there is really only one call. 00297 * 00298 * Revision 1.11 2002/02/04 05:21:13 robertj 00299 * Lots of changes to fix multithreaded slow response code (RIP). 00300 * Fixed problem with having two entries for same call in call list. 00301 * 00302 * Revision 1.10 2002/01/31 06:45:44 robertj 00303 * Added more checking for invalid list processing in calls database. 00304 * 00305 * Revision 1.9 2002/01/31 00:16:15 robertj 00306 * Removed const to allow things to compile! 00307 * 00308 * Revision 1.8 2001/12/15 08:08:52 robertj 00309 * Added alerting, connect and end of call times to be sent to RAS server. 00310 * 00311 * Revision 1.7 2001/12/14 06:40:47 robertj 00312 * Added call end reason codes in DisengageRequest for GK server use. 00313 * 00314 * Revision 1.6 2001/12/13 11:08:45 robertj 00315 * Significant changes to support slow request handling, automatically sending 00316 * RIP and spawning thread to handle time consuming operation. 00317 * 00318 * Revision 1.5 2001/11/19 06:56:44 robertj 00319 * Added prefix strings for gateways registered with this gk, thanks Mikael Stolt 00320 * 00321 * Revision 1.4 2001/08/10 11:03:49 robertj 00322 * Major changes to H.235 support in RAS to support server. 00323 * 00324 * Revision 1.3 2001/08/06 07:44:52 robertj 00325 * Fixed problems with building without SSL 00326 * 00327 * Revision 1.2 2001/08/06 03:18:35 robertj 00328 * Fission of h323.h to h323ep.h & h323con.h, h323.h now just includes files. 00329 * Improved access to H.235 secure RAS functionality. 00330 * Changes to H.323 secure RAS contexts to help use with gk server. 00331 * 00332 * Revision 1.1 2001/07/24 02:30:55 robertj 00333 * Added gatekeeper RAS protocol server classes. 00334 * 00335 */ 00336 00337 #ifndef __OPAL_GKSERVER_H 00338 #define __OPAL_GKSERVER_H 00339 00340 #ifdef P_USE_PRAGMA 00341 #pragma interface 00342 #endif 00343 00344 #include "h323.h" 00345 #include "h323ep.h" 00346 #include "h225ras.h" 00347 #include "guid.h" 00348 #include "h235auth.h" 00349 #include "h323pdu.h" 00350 #include "h323trans.h" 00351 00352 #include <ptlib/safecoll.h> 00353 00354 class PASN_Sequence; 00355 class PASN_Choice; 00356 00357 class H225_AliasAddress; 00358 class H225_ArrayOf_TransportAddress; 00359 class H225_GatekeeperIdentifier; 00360 class H225_EndpointIdentifier; 00361 class H225_InfoRequestResponse_perCallInfo_subtype; 00362 class H225_RasUsageInformation; 00363 00364 class H323RegisteredEndPoint; 00365 class H323GatekeeperListener; 00366 class H323GatekeeperServer; 00367 class H323RasPDU; 00368 class H323PeerElement; 00369 00370 00371 class H323GatekeeperRequest : public H323Transaction 00372 { 00373 PCLASSINFO(H323GatekeeperRequest, H323Transaction); 00374 public: 00379 H323GatekeeperRequest( 00380 H323GatekeeperListener & rasChannel, 00381 const H323RasPDU & pdu 00382 ); 00384 00385 virtual H323TransactionPDU * CreateRIP( 00386 unsigned sequenceNumber, 00387 unsigned delay 00388 ) const; 00389 00390 virtual BOOL WritePDU( 00391 H323TransactionPDU & pdu 00392 ); 00393 BOOL CheckCryptoTokens(); 00394 BOOL CheckGatekeeperIdentifier(); 00395 BOOL GetRegisteredEndPoint(); 00396 00397 virtual PString GetGatekeeperIdentifier() const = 0; 00398 virtual unsigned GetGatekeeperRejectTag() const = 0; 00399 virtual PString GetEndpointIdentifier() const = 0; 00400 virtual unsigned GetRegisteredEndPointRejectTag() const = 0; 00401 virtual unsigned GetSecurityRejectTag() const = 0; 00402 00403 H323GatekeeperListener & GetRasChannel() const { return rasChannel; } 00404 00405 PSafePtr<H323RegisteredEndPoint> endpoint; 00406 00407 protected: 00408 H323GatekeeperListener & rasChannel; 00409 }; 00410 00411 00412 class H323GatekeeperGRQ : public H323GatekeeperRequest 00413 { 00414 PCLASSINFO(H323GatekeeperGRQ, H323GatekeeperRequest); 00415 public: 00416 H323GatekeeperGRQ( 00417 H323GatekeeperListener & listener, 00418 const H323RasPDU & pdu 00419 ); 00420 00421 #if PTRACING 00422 virtual const char * GetName() const; 00423 #endif 00424 virtual PString GetGatekeeperIdentifier() const; 00425 virtual unsigned GetGatekeeperRejectTag() const; 00426 virtual PString GetEndpointIdentifier() const; 00427 virtual unsigned GetRegisteredEndPointRejectTag() const; 00428 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00429 virtual unsigned GetSecurityRejectTag() const; 00430 virtual void SetRejectReason( 00431 unsigned reasonCode 00432 ); 00433 00434 H225_GatekeeperRequest & grq; 00435 H225_GatekeeperConfirm & gcf; 00436 H225_GatekeeperReject & grj; 00437 00438 protected: 00439 virtual Response OnHandlePDU(); 00440 }; 00441 00442 00443 class H323GatekeeperRRQ : public H323GatekeeperRequest 00444 { 00445 PCLASSINFO(H323GatekeeperRRQ, H323GatekeeperRequest); 00446 public: 00447 H323GatekeeperRRQ( 00448 H323GatekeeperListener & listener, 00449 const H323RasPDU & pdu 00450 ); 00451 00452 #if PTRACING 00453 virtual const char * GetName() const; 00454 #endif 00455 virtual PString GetGatekeeperIdentifier() const; 00456 virtual unsigned GetGatekeeperRejectTag() const; 00457 virtual PString GetEndpointIdentifier() const; 00458 virtual unsigned GetRegisteredEndPointRejectTag() const; 00459 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00460 virtual unsigned GetSecurityRejectTag() const; 00461 virtual void SetRejectReason( 00462 unsigned reasonCode 00463 ); 00464 00465 H225_RegistrationRequest & rrq; 00466 H225_RegistrationConfirm & rcf; 00467 H225_RegistrationReject & rrj; 00468 00469 protected: 00470 virtual Response OnHandlePDU(); 00471 }; 00472 00473 00474 class H323GatekeeperURQ : public H323GatekeeperRequest 00475 { 00476 PCLASSINFO(H323GatekeeperURQ, H323GatekeeperRequest); 00477 public: 00478 H323GatekeeperURQ( 00479 H323GatekeeperListener & listener, 00480 const H323RasPDU & pdu 00481 ); 00482 00483 #if PTRACING 00484 virtual const char * GetName() const; 00485 #endif 00486 virtual PString GetGatekeeperIdentifier() const; 00487 virtual unsigned GetGatekeeperRejectTag() const; 00488 virtual PString GetEndpointIdentifier() const; 00489 virtual unsigned GetRegisteredEndPointRejectTag() const; 00490 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00491 virtual unsigned GetSecurityRejectTag() const; 00492 virtual void SetRejectReason( 00493 unsigned reasonCode 00494 ); 00495 00496 H225_UnregistrationRequest & urq; 00497 H225_UnregistrationConfirm & ucf; 00498 H225_UnregistrationReject & urj; 00499 00500 protected: 00501 virtual Response OnHandlePDU(); 00502 }; 00503 00504 00505 class H323GatekeeperARQ : public H323GatekeeperRequest 00506 { 00507 PCLASSINFO(H323GatekeeperARQ, H323GatekeeperRequest); 00508 public: 00509 H323GatekeeperARQ( 00510 H323GatekeeperListener & listener, 00511 const H323RasPDU & pdu 00512 ); 00513 00514 #if PTRACING 00515 virtual const char * GetName() const; 00516 #endif 00517 virtual PString GetGatekeeperIdentifier() const; 00518 virtual unsigned GetGatekeeperRejectTag() const; 00519 virtual PString GetEndpointIdentifier() const; 00520 virtual unsigned GetRegisteredEndPointRejectTag() const; 00521 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00522 virtual unsigned GetSecurityRejectTag() const; 00523 virtual void SetRejectReason( 00524 unsigned reasonCode 00525 ); 00526 00527 H225_AdmissionRequest & arq; 00528 H225_AdmissionConfirm & acf; 00529 H225_AdmissionReject & arj; 00530 00531 PString alternateSecurityID; 00532 00533 protected: 00534 virtual Response OnHandlePDU(); 00535 }; 00536 00537 00538 class H323GatekeeperDRQ : public H323GatekeeperRequest 00539 { 00540 PCLASSINFO(H323GatekeeperDRQ, H323GatekeeperRequest); 00541 public: 00542 H323GatekeeperDRQ( 00543 H323GatekeeperListener & listener, 00544 const H323RasPDU & pdu 00545 ); 00546 00547 #if PTRACING 00548 virtual const char * GetName() const; 00549 #endif 00550 virtual PString GetGatekeeperIdentifier() const; 00551 virtual unsigned GetGatekeeperRejectTag() const; 00552 virtual PString GetEndpointIdentifier() const; 00553 virtual unsigned GetRegisteredEndPointRejectTag() const; 00554 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00555 virtual unsigned GetSecurityRejectTag() const; 00556 virtual void SetRejectReason( 00557 unsigned reasonCode 00558 ); 00559 00560 H225_DisengageRequest & drq; 00561 H225_DisengageConfirm & dcf; 00562 H225_DisengageReject & drj; 00563 00564 protected: 00565 virtual Response OnHandlePDU(); 00566 }; 00567 00568 00569 class H323GatekeeperBRQ : public H323GatekeeperRequest 00570 { 00571 PCLASSINFO(H323GatekeeperBRQ, H323GatekeeperRequest); 00572 public: 00573 H323GatekeeperBRQ( 00574 H323GatekeeperListener & listener, 00575 const H323RasPDU & pdu 00576 ); 00577 00578 #if PTRACING 00579 virtual const char * GetName() const; 00580 #endif 00581 virtual PString GetGatekeeperIdentifier() const; 00582 virtual unsigned GetGatekeeperRejectTag() const; 00583 virtual PString GetEndpointIdentifier() const; 00584 virtual unsigned GetRegisteredEndPointRejectTag() const; 00585 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00586 virtual unsigned GetSecurityRejectTag() const; 00587 virtual void SetRejectReason( 00588 unsigned reasonCode 00589 ); 00590 00591 H225_BandwidthRequest & brq; 00592 H225_BandwidthConfirm & bcf; 00593 H225_BandwidthReject & brj; 00594 00595 protected: 00596 virtual Response OnHandlePDU(); 00597 }; 00598 00599 00600 class H323GatekeeperLRQ : public H323GatekeeperRequest 00601 { 00602 PCLASSINFO(H323GatekeeperLRQ, H323GatekeeperRequest); 00603 public: 00604 H323GatekeeperLRQ( 00605 H323GatekeeperListener & listener, 00606 const H323RasPDU & pdu 00607 ); 00608 00609 #if PTRACING 00610 virtual const char * GetName() const; 00611 #endif 00612 virtual PString GetGatekeeperIdentifier() const; 00613 virtual unsigned GetGatekeeperRejectTag() const; 00614 virtual PString GetEndpointIdentifier() const; 00615 virtual unsigned GetRegisteredEndPointRejectTag() const; 00616 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00617 virtual unsigned GetSecurityRejectTag() const; 00618 virtual void SetRejectReason( 00619 unsigned reasonCode 00620 ); 00621 00622 H225_LocationRequest & lrq; 00623 H225_LocationConfirm & lcf; 00624 H225_LocationReject & lrj; 00625 00626 protected: 00627 virtual Response OnHandlePDU(); 00628 }; 00629 00630 00631 class H323GatekeeperIRR : public H323GatekeeperRequest 00632 { 00633 PCLASSINFO(H323GatekeeperIRR, H323GatekeeperRequest); 00634 public: 00635 H323GatekeeperIRR( 00636 H323GatekeeperListener & listener, 00637 const H323RasPDU & pdu 00638 ); 00639 00640 #if PTRACING 00641 virtual const char * GetName() const; 00642 #endif 00643 virtual PString GetGatekeeperIdentifier() const; 00644 virtual unsigned GetGatekeeperRejectTag() const; 00645 virtual PString GetEndpointIdentifier() const; 00646 virtual unsigned GetRegisteredEndPointRejectTag() const; 00647 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00648 virtual unsigned GetSecurityRejectTag() const; 00649 virtual void SetRejectReason( 00650 unsigned reasonCode 00651 ); 00652 00653 H225_InfoRequestResponse & irr; 00654 H225_InfoRequestAck & iack; 00655 H225_InfoRequestNak & inak; 00656 00657 protected: 00658 virtual Response OnHandlePDU(); 00659 }; 00660 00661 00664 class H323GatekeeperCall : public PSafeObject 00665 { 00666 PCLASSINFO(H323GatekeeperCall, PSafeObject); 00667 public: 00670 enum Direction { 00671 AnsweringCall, 00672 OriginatingCall, 00673 UnknownDirection 00674 }; 00675 00678 H323GatekeeperCall( 00679 H323GatekeeperServer & server, 00680 const OpalGloballyUniqueID & callIdentifier, 00681 Direction direction 00682 ); 00683 00686 ~H323GatekeeperCall(); 00688 00693 Comparison Compare( 00694 const PObject & obj 00695 ) const; 00696 00699 void PrintOn( 00700 ostream & strm 00701 ) const; 00703 00711 virtual H323GatekeeperRequest::Response OnAdmission( 00712 H323GatekeeperARQ & request 00713 ); 00714 00718 virtual BOOL Disengage( 00719 int reason = -1 00720 ); 00721 00725 virtual H323GatekeeperRequest::Response OnDisengage( 00726 H323GatekeeperDRQ & request 00727 ); 00728 00733 virtual H323GatekeeperRequest::Response OnBandwidth( 00734 H323GatekeeperBRQ & request 00735 ); 00736 00740 virtual H323GatekeeperRequest::Response OnInfoResponse( 00741 H323GatekeeperIRR & request, 00742 H225_InfoRequestResponse_perCallInfo_subtype & call 00743 ); 00744 00747 virtual void OnAlerting(); 00748 00751 virtual void OnConnected(); 00752 00763 virtual BOOL OnHeartbeat(); 00764 00765 #ifdef H323_H248 00766 00773 virtual PString GetCallCreditAmount() const; 00774 00781 virtual BOOL GetCallCreditMode() const; 00782 00790 virtual unsigned GetDurationLimit() const; 00791 00796 virtual BOOL SendCallCreditServiceControl(); 00797 00800 BOOL AddCallCreditServiceControl( 00801 H225_ArrayOf_ServiceControlSession & serviceControl 00802 ) const; 00803 00808 virtual BOOL SendServiceControlSession( 00809 const H323ServiceControlSession & session 00810 ); 00811 00812 #endif // H323_H248 00813 00819 virtual BOOL TranslateAliasAddress( 00820 const H225_AliasAddress & alias, 00821 H225_ArrayOf_AliasAddress & aliases, 00822 H323TransportAddress & address, 00823 BOOL & isGkRouted 00824 ); 00825 00827 00830 H323GatekeeperServer & GetGatekeeper() const { return gatekeeper; } 00831 H323RegisteredEndPoint & GetEndPoint() const { return *PAssertNULL(endpoint); } 00832 BOOL IsAnsweringCall() const { return direction == AnsweringCall; } 00833 unsigned GetCallReference() const { return callReference; } 00834 const OpalGloballyUniqueID & GetCallIdentifier() const { return callIdentifier; } 00835 const OpalGloballyUniqueID & GetConferenceIdentifier() const { return conferenceIdentifier; } 00836 const PString & GetSourceNumber() const { return srcNumber; } 00837 const PStringArray & GetSourceAliases() const { return srcAliases; } 00838 const H323TransportAddress & GetSourceHost() const { return srcHost; } 00839 PString GetSourceAddress() const; 00840 const PString & GetDestinationNumber() const { return dstNumber; } 00841 const PStringArray & GetDestinationAliases() const { return dstAliases; } 00842 const H323TransportAddress & GetDestinationHost() const { return dstHost; } 00843 PString GetDestinationAddress() const; 00844 unsigned GetBandwidthUsed() const { return bandwidthUsed; } 00845 BOOL SetBandwidthUsed(unsigned bandwidth); 00846 const PTime & GetLastInfoResponseTime() const { return lastInfoResponse; } 00847 const PTime & GetCallStartTime() const { return callStartTime; } 00848 const PTime & GetAlertingTime() const { return alertingTime; } 00849 const PTime & GetConnectedTime() const { return connectedTime; } 00850 const PTime & GetCallEndTime() const { return callEndTime; } 00851 H323Connection::CallEndReason GetCallEndReason() const { return callEndReason; } 00853 00854 protected: 00855 void SetUsageInfo(const H225_RasUsageInformation & usage); 00856 00857 H323GatekeeperServer & gatekeeper; 00858 H323RegisteredEndPoint * endpoint; 00859 H323GatekeeperListener * rasChannel; 00860 00861 Direction direction; 00862 unsigned callReference; 00863 OpalGloballyUniqueID callIdentifier; 00864 OpalGloballyUniqueID conferenceIdentifier; 00865 PString srcNumber; 00866 PStringArray srcAliases; 00867 H323TransportAddress srcHost; 00868 PString dstNumber; 00869 PStringArray dstAliases; 00870 H323TransportAddress dstHost; 00871 unsigned bandwidthUsed; 00872 unsigned infoResponseRate; 00873 PTime lastInfoResponse; 00874 00875 BOOL drqReceived; 00876 PTime callStartTime; 00877 PTime alertingTime; 00878 PTime connectedTime; 00879 PTime callEndTime; 00880 H323Connection::CallEndReason callEndReason; 00881 }; 00882 00883 00889 class H323RegisteredEndPoint : public PSafeObject 00890 { 00891 PCLASSINFO(H323RegisteredEndPoint, PSafeObject); 00892 public: 00897 H323RegisteredEndPoint( 00898 H323GatekeeperServer & server, 00899 const PString & id 00900 ); 00902 00907 Comparison Compare( 00908 const PObject & obj 00909 ) const; 00910 00913 void PrintOn( 00914 ostream & strm 00915 ) const; 00917 00924 virtual void AddCall( 00925 H323GatekeeperCall * call 00926 ); 00927 00932 virtual BOOL RemoveCall( 00933 H323GatekeeperCall * call 00934 ); 00935 00938 PINDEX GetCallCount() const { return activeCalls.GetSize(); } 00939 00942 H323GatekeeperCall & GetCall( 00943 PINDEX idx 00944 ) { return activeCalls[idx]; } 00946 00955 virtual H323GatekeeperRequest::Response OnRegistration( 00956 H323GatekeeperRRQ & request 00957 ); 00958 00968 virtual H323GatekeeperRequest::Response OnFullRegistration( 00969 H323GatekeeperRRQ & request 00970 ); 00971 00980 virtual H323GatekeeperRequest::Response OnSecureRegistration( 00981 H323GatekeeperRRQ & request 00982 ); 00983 00987 virtual H323GatekeeperRequest::Response OnUnregistration( 00988 H323GatekeeperURQ & request 00989 ); 00990 00994 virtual BOOL Unregister( 00995 int reason = -1 00996 ); 00997 01002 virtual H323GatekeeperRequest::Response OnInfoResponse( 01003 H323GatekeeperIRR & request 01004 ); 01005 01016 virtual BOOL OnTimeToLive(); 01017 01018 #ifdef H323_H248 01019 01031 virtual PString GetCallCreditAmount() const; 01032 01040 virtual BOOL GetCallCreditMode() const; 01041 01046 virtual BOOL SendServiceControlSession( 01047 const H323ServiceControlSession & session 01048 ); 01049 01053 virtual BOOL AddServiceControlSession( 01054 const H323ServiceControlSession & session, 01055 H225_ArrayOf_ServiceControlSession & serviceControl 01056 ); 01057 #endif // H323_H248 01058 01059 01064 virtual BOOL SetPassword( 01065 const PString & password, 01066 const PString & username = PString::Empty() 01067 ); 01068 01071 const PString & GetIdentifier() const { return identifier; } 01072 01075 const OpalGloballyUniqueID & GetDescriptorID() const { return descriptorID; } 01076 01079 H323GatekeeperServer & GetGatekeeper() const { return gatekeeper; } 01080 01084 const H323TransportAddressArray & GetRASAddresses() const { return rasAddresses; } 01085 01089 PINDEX GetRASAddressCount() const { return rasAddresses.GetSize(); } 01090 01094 H323TransportAddress GetRASAddress( 01095 PINDEX idx 01096 ) const { return rasAddresses[idx]; } 01097 01101 const H323TransportAddressArray & GetSignalAddresses() const { return signalAddresses; } 01102 01106 PINDEX GetSignalAddressCount() const { return signalAddresses.GetSize(); } 01107 01111 H323TransportAddress GetSignalAddress( 01112 PINDEX idx 01113 ) const { return signalAddresses[idx]; } 01114 01117 const PStringArray & GetAliases() const { return aliases; } 01118 01121 BOOL ContainsAlias( 01122 const PString & alias 01123 ) { return aliases.GetStringsIndex(alias) != P_MAX_INDEX; } 01124 01127 PINDEX GetAliasCount() const { return aliases.GetSize(); } 01128 01131 PString GetAlias( 01132 PINDEX idx 01133 ) const { if (idx < aliases.GetSize()) return aliases[idx]; return PString::Empty(); } 01134 01140 void RemoveAlias( 01141 const PString & alias 01142 ); 01143 01146 virtual const H235Authenticators & GetAuthenticators() const { return authenticators; } 01147 01150 PINDEX GetPrefixCount() const { return voicePrefixes.GetSize(); } 01151 01154 PString GetPrefix( 01155 PINDEX idx 01156 ) const { return voicePrefixes[idx]; } 01157 01160 const PCaselessString & GetApplicationInfo() const { return applicationInfo; } 01161 01164 unsigned GetProtocolVersion() const { return protocolVersion; } 01165 01168 BOOL IsBehindNAT() const { return isBehindNAT; } 01169 01172 BOOL CanDisplayAmountString() const { return canDisplayAmountString; } 01173 01176 BOOL CanEnforceDurationLimit() const { return canEnforceDurationLimit; } 01177 01180 BOOL CanReceiveRIP() const; 01181 01184 BOOL GetH225Version() const { return h225Version; } 01186 01187 #ifdef H323_H501 01188 01197 virtual BOOL OnSendDescriptorForEndpoint( 01198 H225_ArrayOf_AliasAddress & aliases, 01199 H225_EndpointType & terminalType, 01200 H225_ArrayOf_AliasAddress & transportAddresses 01201 ); 01203 #endif 01204 01205 01206 protected: 01207 H323GatekeeperServer & gatekeeper; 01208 H323GatekeeperListener * rasChannel; 01209 01210 PString identifier; 01211 OpalGloballyUniqueID descriptorID; 01212 H323TransportAddressArray rasAddresses; 01213 H323TransportAddressArray signalAddresses; 01214 PStringArray aliases; 01215 PStringArray voicePrefixes; 01216 PCaselessString applicationInfo; 01217 unsigned protocolVersion; 01218 BOOL isBehindNAT; 01219 BOOL canDisplayAmountString; 01220 BOOL canEnforceDurationLimit; 01221 unsigned h225Version; 01222 unsigned timeToLive; 01223 H235Authenticators authenticators; 01224 01225 PTime lastRegistration; 01226 PTime lastInfoResponse; 01227 01228 PSortedList<H323GatekeeperCall> activeCalls; 01229 #ifdef H323_H248 01230 POrdinalDictionary<PString> serviceControlSessions; 01231 #endif 01232 }; 01233 01234 01240 class H323GatekeeperListener : public H225_RAS 01241 { 01242 PCLASSINFO(H323GatekeeperListener, H225_RAS); 01243 public: 01248 H323GatekeeperListener( 01249 H323EndPoint & endpoint, 01250 H323GatekeeperServer & server, 01251 const PString & gatekeeperIdentifier, 01252 H323Transport * transport = NULL 01253 ); 01254 01257 ~H323GatekeeperListener(); 01259 01264 BOOL UnregistrationRequest( 01265 const H323RegisteredEndPoint & ep, 01266 unsigned reason 01267 ); 01268 01271 BOOL DisengageRequest( 01272 const H323GatekeeperCall & call, 01273 unsigned reason 01274 ); 01275 01278 virtual BOOL InfoRequest( 01279 H323RegisteredEndPoint & ep, 01280 H323GatekeeperCall * call = NULL 01281 ); 01282 01283 #ifdef H323_H248 01284 01286 virtual BOOL ServiceControlIndication( 01287 H323RegisteredEndPoint & ep, 01288 const H323ServiceControlSession & session, 01289 H323GatekeeperCall * call = NULL 01290 ); 01291 #endif 01292 01293 01300 virtual H323GatekeeperRequest::Response OnDiscovery( 01301 H323GatekeeperGRQ & request 01302 ); 01303 01308 virtual H323GatekeeperRequest::Response OnRegistration( 01309 H323GatekeeperRRQ & request 01310 ); 01311 01316 virtual H323GatekeeperRequest::Response OnUnregistration( 01317 H323GatekeeperURQ & request 01318 ); 01319 01324 virtual H323GatekeeperRequest::Response OnAdmission( 01325 H323GatekeeperARQ & request 01326 ); 01327 01332 virtual H323GatekeeperRequest::Response OnDisengage( 01333 H323GatekeeperDRQ & request 01334 ); 01335 01340 virtual H323GatekeeperRequest::Response OnBandwidth( 01341 H323GatekeeperBRQ & request 01342 ); 01343 01348 virtual H323GatekeeperRequest::Response OnLocation( 01349 H323GatekeeperLRQ & request 01350 ); 01351 01356 virtual H323GatekeeperRequest::Response OnInfoResponse( 01357 H323GatekeeperIRR & request 01358 ); 01360 01363 BOOL OnReceiveGatekeeperRequest(const H323RasPDU &, const H225_GatekeeperRequest &); 01364 BOOL OnReceiveRegistrationRequest(const H323RasPDU &, const H225_RegistrationRequest &); 01365 BOOL OnReceiveUnregistrationRequest(const H323RasPDU &, const H225_UnregistrationRequest &); 01366 BOOL OnReceiveUnregistrationConfirm(const H225_UnregistrationConfirm &); 01367 BOOL OnReceiveUnregistrationReject(const H225_UnregistrationReject &); 01368 BOOL OnReceiveAdmissionRequest(const H323RasPDU &, const H225_AdmissionRequest &); 01369 BOOL OnReceiveBandwidthRequest(const H323RasPDU &, const H225_BandwidthRequest &); 01370 BOOL OnReceiveBandwidthConfirm(const H225_BandwidthConfirm &); 01371 BOOL OnReceiveBandwidthReject(const H225_BandwidthReject &); 01372 BOOL OnReceiveDisengageRequest(const H323RasPDU &, const H225_DisengageRequest &); 01373 BOOL OnReceiveDisengageConfirm(const H225_DisengageConfirm &); 01374 BOOL OnReceiveDisengageReject(const H225_DisengageReject &); 01375 BOOL OnReceiveLocationRequest(const H323RasPDU &, const H225_LocationRequest &); 01376 BOOL OnReceiveInfoRequestResponse(const H323RasPDU &, const H225_InfoRequestResponse &); 01377 BOOL OnReceiveResourcesAvailableConfirm(const H225_ResourcesAvailableConfirm &); 01378 BOOL OnSendFeatureSet(unsigned, H225_FeatureSet & features) const; 01379 void OnReceiveFeatureSet(unsigned, const H225_FeatureSet & features) const; 01381 01384 H323GatekeeperServer & GetGatekeeper() const { return gatekeeper; } 01386 01387 01388 protected: 01389 H323GatekeeperServer & gatekeeper; 01390 }; 01391 01392 01403 class H323GatekeeperServer : public H323TransactionServer 01404 { 01405 PCLASSINFO(H323GatekeeperServer, H323TransactionServer); 01406 public: 01411 H323GatekeeperServer( 01412 H323EndPoint & endpoint 01413 ); 01414 01417 ~H323GatekeeperServer(); 01419 01420 WORD GetDefaultUdpPort() { return H225_RAS::DefaultRasUdpPort; } 01421 01432 virtual H323Transactor * CreateListener( 01433 H323Transport * transport 01434 ); 01435 01437 01443 virtual H323GatekeeperRequest::Response OnDiscovery( 01444 H323GatekeeperGRQ & request 01445 ); 01446 01454 virtual H323GatekeeperRequest::Response OnRegistration( 01455 H323GatekeeperRRQ & request 01456 ); 01457 01463 virtual H323GatekeeperRequest::Response OnUnregistration( 01464 H323GatekeeperURQ & request 01465 ); 01466 01471 virtual H323GatekeeperRequest::Response OnInfoResponse( 01472 H323GatekeeperIRR & request 01473 ); 01474 01485 virtual void AddEndPoint( 01486 H323RegisteredEndPoint * ep 01487 ); 01488 01491 virtual BOOL RemoveEndPoint( 01492 H323RegisteredEndPoint * ep 01493 ); 01494 01503 virtual H323RegisteredEndPoint * CreateRegisteredEndPoint( 01504 H323GatekeeperRRQ & request 01505 ); 01506 01515 virtual PString CreateEndPointIdentifier(); 01516 01519 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByIdentifier( 01520 const PString & identifier, 01521 PSafetyMode mode = PSafeReference 01522 ); 01523 01526 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointBySignalAddresses( 01527 const H225_ArrayOf_TransportAddress & addresses, 01528 PSafetyMode mode = PSafeReference 01529 ); 01530 01533 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointBySignalAddress( 01534 const H323TransportAddress & address, 01535 PSafetyMode mode = PSafeReference 01536 ); 01537 01540 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByAliasAddress( 01541 const H225_AliasAddress & alias, 01542 PSafetyMode mode = PSafeReadWrite 01543 ); 01544 01547 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByAliasString( 01548 const PString & alias, 01549 PSafetyMode mode = PSafeReference 01550 ); 01551 01554 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByPartialAlias( 01555 const PString & alias, 01556 PSafetyMode mode = PSafeReference 01557 ); 01558 01561 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByPrefixString( 01562 const PString & prefix, 01563 PSafetyMode mode = PSafeReference 01564 ); 01565 01568 PSafePtr<H323RegisteredEndPoint> GetFirstEndPoint( 01569 PSafetyMode mode = PSafeReference 01570 ) { return PSafePtr<H323RegisteredEndPoint>(byIdentifier, mode); } 01572 01573 PSafePtr<H323RegisteredEndPoint> FindDestinationEndPoint( 01574 const OpalGloballyUniqueID & id, 01575 H323GatekeeperCall::Direction direction 01576 ); 01577 01585 virtual H323GatekeeperRequest::Response OnAdmission( 01586 H323GatekeeperARQ & request 01587 ); 01588 01593 virtual H323GatekeeperRequest::Response OnDisengage( 01594 H323GatekeeperDRQ & request 01595 ); 01596 01601 virtual H323GatekeeperRequest::Response OnBandwidth( 01602 H323GatekeeperBRQ & request 01603 ); 01604 01613 virtual H323GatekeeperCall * CreateCall( 01614 const OpalGloballyUniqueID & callIdentifier, 01615 H323GatekeeperCall::Direction direction 01616 ); 01617 01620 virtual void AddCall(H323GatekeeperCall *) 01621 { } 01622 01625 virtual void RemoveCall( 01626 H323GatekeeperCall * call 01627 ); 01628 01631 virtual PSafePtr<H323GatekeeperCall> FindCall( 01632 const PString & description, 01633 PSafetyMode mode = PSafeReference 01634 ); 01635 01638 virtual PSafePtr<H323GatekeeperCall> FindCall( 01639 const OpalGloballyUniqueID & callIdentifier, 01640 BOOL answeringCall, 01641 PSafetyMode mode = PSafeReference 01642 ); 01643 01646 virtual PSafePtr<H323GatekeeperCall> FindCall( 01647 const OpalGloballyUniqueID & callIdentifier, 01648 H323GatekeeperCall::Direction direction, 01649 PSafetyMode mode = PSafeReference 01650 ); 01651 01654 PSafePtr<H323GatekeeperCall> GetFirstCall( 01655 PSafetyMode mode = PSafeReference 01656 ) { return PSafePtr<H323GatekeeperCall>(activeCalls, mode); } 01657 01658 01660 01670 virtual H323GatekeeperRequest::Response OnLocation( 01671 H323GatekeeperLRQ & request 01672 ); 01673 01685 virtual BOOL TranslateAliasAddress( 01686 const H225_AliasAddress & alias, 01687 H225_ArrayOf_AliasAddress & aliases, 01688 H323TransportAddress & address, 01689 BOOL & isGkRouted, 01690 H323GatekeeperCall * call 01691 ); 01692 virtual BOOL TranslateAliasAddressToSignalAddress( 01693 const H225_AliasAddress & alias, 01694 H323TransportAddress & address 01695 ); 01696 01698 01710 virtual BOOL CheckSignalAddressPolicy( 01711 const H323RegisteredEndPoint & ep, 01712 const H225_AdmissionRequest & arq, 01713 const H323TransportAddress & address 01714 ); 01715 01728 virtual BOOL CheckAliasAddressPolicy( 01729 const H323RegisteredEndPoint & ep, 01730 const H225_AdmissionRequest & arq, 01731 const H225_AliasAddress & alias 01732 ); 01733 01746 virtual BOOL CheckAliasStringPolicy( 01747 const H323RegisteredEndPoint & ep, 01748 const H225_AdmissionRequest & arq, 01749 const PString & alias 01750 ); 01751 01757 virtual unsigned AllocateBandwidth( 01758 unsigned newBandwidth, 01759 unsigned oldBandwidth = 0 01760 ); 01762 01774 virtual BOOL GetAdmissionRequestAuthentication( 01775 H323GatekeeperARQ & info, 01776 H235Authenticators & authenticators 01777 ); 01778 01784 virtual BOOL GetUsersPassword( 01785 const PString & alias, 01786 PString & password, 01787 H323RegisteredEndPoint & registeredEndpoint 01788 ) const; 01789 virtual BOOL GetUsersPassword( 01790 const PString & alias, 01791 PString & password 01792 ) const; 01794 01795 #ifdef H323_H501 01796 01801 H323PeerElement * GetPeerElement() const { return peerElement; } 01802 01806 void SetPeerElement( 01807 H323PeerElement * newPeerElement 01808 ); 01809 01815 void CreatePeerElement( 01816 const H323TransportAddress & h501Interface 01817 ); 01818 01824 BOOL OpenPeerElement( 01825 const H323TransportAddress & remotePeer, 01826 BOOL append = FALSE, 01827 BOOL keepTrying = TRUE 01828 ); 01830 01831 #endif // H323_H501 01832 01837 const PString & GetGatekeeperIdentifier() const { return gatekeeperIdentifier; } 01838 01844 void SetGatekeeperIdentifier( 01845 const PString & id, 01846 BOOL adjustListeners = TRUE 01847 ); 01848 01851 unsigned GetAvailableBandwidth() const { return totalBandwidth; } 01852 01855 void SetAvailableBandwidth(unsigned bps100) { totalBandwidth = bps100; } 01856 01859 unsigned GetUsedBandwidth() const { return usedBandwidth; } 01860 01863 unsigned GetDefaultBandwidth() const { return defaultBandwidth; } 01864 01867 unsigned GetTimeToLive() const { return defaultTimeToLive; } 01868 01871 void SetTimeToLive(unsigned seconds) { defaultTimeToLive = seconds; } 01872 01875 unsigned GetInfoResponseRate() const { return defaultInfoResponseRate; } 01876 01879 void SetInfoResponseRate(unsigned seconds) { defaultInfoResponseRate = seconds; } 01880 01883 BOOL IsGatekeeperRouted() const { return isGatekeeperRouted; } 01884 01887 BOOL IsRequiredH235() const { return requireH235; } 01888 01891 unsigned GetActiveRegistrations() const { return byIdentifier.GetSize(); } 01892 01895 unsigned GetPeakRegistrations() const { return peakRegistrations; } 01896 01899 unsigned GetTotalRegistrations() const { return totalRegistrations; } 01900 01903 unsigned GetRejectedRegistrations() const { return rejectedRegistrations; } 01904 01907 unsigned GetActiveCalls() const { return activeCalls.GetSize(); } 01908 01911 unsigned GetPeakCalls() const { return peakCalls; } 01912 01915 unsigned GetTotalCalls() const { return totalCalls; } 01916 01919 unsigned GetRejectedCalls() const { return rejectedCalls; } 01921 01922 // Remove an alias from the server database. 01923 void RemoveAlias( 01924 H323RegisteredEndPoint & ep, 01925 const PString & alias 01926 ); 01927 01928 #ifdef H323_H501 01929 // called when an endpoint needs to send a descriptor to the H.501 peer element 01930 virtual BOOL OnSendDescriptorForEndpoint( 01931 H323RegisteredEndPoint & /*ep*/, 01932 H225_ArrayOf_AliasAddress & /*aliases*/, 01933 H225_EndpointType & /*terminalType*/, 01934 H225_ArrayOf_AliasAddress & /*transportAddresses*/ 01935 ) 01936 { return TRUE; } 01937 #endif 01938 01939 virtual BOOL AllowDuplicateAlias(const H225_ArrayOf_AliasAddress & /*aliases*/) 01940 { return canHaveDuplicateAlias; } 01941 01942 virtual BOOL OnSendFeatureSet(unsigned, H225_FeatureSet & features) const; 01943 virtual void OnReceiveFeatureSet(unsigned, const H225_FeatureSet & features) const; 01944 01945 protected: 01946 01947 PDECLARE_NOTIFIER(PThread, H323GatekeeperServer, MonitorMain); 01948 01949 // Configuration & policy variables 01950 PString gatekeeperIdentifier; 01951 unsigned totalBandwidth; 01952 unsigned usedBandwidth; 01953 unsigned defaultBandwidth; 01954 unsigned maximumBandwidth; 01955 unsigned defaultTimeToLive; 01956 unsigned defaultInfoResponseRate; 01957 BOOL overwriteOnSameSignalAddress; 01958 BOOL canHaveDuplicateAlias; 01959 BOOL canHaveDuplicatePrefix; 01960 BOOL canOnlyCallRegisteredEP; 01961 BOOL canOnlyAnswerRegisteredEP; 01962 BOOL answerCallPreGrantedARQ; 01963 BOOL makeCallPreGrantedARQ; 01964 BOOL isGatekeeperRouted; 01965 BOOL aliasCanBeHostName; 01966 BOOL requireH235; 01967 BOOL disengageOnHearbeatFail; 01968 01969 PStringToString passwords; 01970 01971 // Dynamic variables 01972 PMutex mutex; 01973 time_t identifierBase; 01974 unsigned nextIdentifier; 01975 PThread * monitorThread; 01976 PSyncPoint monitorExit; 01977 01978 PLIST(ListenerList, H323GatekeeperListener); 01979 ListenerList listeners; 01980 01981 H323PeerElement * peerElement; 01982 01983 PSafeDictionary<PString, H323RegisteredEndPoint> byIdentifier; 01984 01985 class StringMap : public PString { 01986 PCLASSINFO(StringMap, PString); 01987 public: 01988 StringMap(const PString & from, const PString & id) 01989 : PString(from), identifier(id) { } 01990 PString identifier; 01991 }; 01992 PSortedStringList byAddress; 01993 PSortedStringList byAlias; 01994 PSortedStringList byVoicePrefix; 01995 01996 PSafeSortedList<H323GatekeeperCall> activeCalls; 01997 01998 PINDEX peakRegistrations; 01999 PINDEX totalRegistrations; 02000 PINDEX rejectedRegistrations; 02001 PINDEX peakCalls; 02002 PINDEX totalCalls; 02003 PINDEX rejectedCalls; 02004 02005 friend class H323GatekeeperRRQ; 02006 friend class H323GatekeeperARQ; 02007 }; 02008 02009 02010 #endif // __OPAL_GKSERVER_H 02011 02012 02014