Main Page | Class Hierarchy | Class List | File List | 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.81 2004/06/15 03:30:45 csoutheren 00031 * Adde guard to function to prevent crash if no aliases on an endpoint 00032 * 00033 * Revision 1.80 2004/06/04 07:05:07 csoutheren 00034 * Fixed obvious typos 00035 * 00036 * Revision 1.79 2004/04/25 01:52:46 rjongbloed 00037 * Fixed GCC 3.4 warnings 00038 * 00039 * Revision 1.78 2004/04/21 01:39:05 csoutheren 00040 * Added new overrides to GatekeeperServer to provide virtuals when calls and endpoints are created and destroyed 00041 * 00042 * Revision 1.77 2004/04/15 07:43:36 csoutheren 00043 * Allow gatekeeper to make a decision on multiple alias registrations for each registration 00044 * 00045 * Revision 1.76 2004/04/14 01:41:59 csoutheren 00046 * Added access to endpoint information for GetUserPassword 00047 * 00048 * Revision 1.75 2004/03/31 07:16:22 csoutheren 00049 * Added virtual to provide access to H.501 descriptor sent by GK 00050 * 00051 * Revision 1.74 2004/02/15 03:36:30 rjongbloed 00052 * Fixed bug in removing prefixes, plus added ability to have multiple endpoints 00053 * with the same profix, thanks Rossano Ravelli 00054 * 00055 * Revision 1.73 2004/02/07 11:43:59 rjongbloed 00056 * Fixed deadlocks caused under high load by failure to check locking 00057 * success. Also added functions to find destination endpoint. 00058 * Thanks Federico Pinna and the gang at Reitek S.p.A. 00059 * 00060 * Revision 1.72 2003/12/24 07:08:47 csoutheren 00061 * Added TranslateAliasAddress on H323GatekeeperCall 00062 * 00063 * Revision 1.71 2003/12/11 05:39:04 csoutheren 00064 * Added storage of H.225 version in endpoint structure 00065 * Disabled sending RIPs to endpoints that cannot handle them 00066 * 00067 * Revision 1.70 2003/12/11 02:18:17 csoutheren 00068 * More fixes for NM deregistration problems. Seems to be fixed now :) 00069 * 00070 * Revision 1.69 2003/12/09 00:58:46 csoutheren 00071 * Fixed problem with endpoints deregistering 00072 * 00073 * Revision 1.68 2003/12/09 00:33:17 csoutheren 00074 * Added patch to prevent crash when NM unregisters from GK 00075 * Abject apologies to Rossano Ravelli for taking so long to add this 00076 * 00077 * Revision 1.67 2003/04/30 00:28:50 robertj 00078 * Redesigned the alternate credentials in ARQ system as old implementation 00079 * was fraught with concurrency issues, most importantly it can cause false 00080 * detection of replay attacks taking out an endpoint completely. 00081 * 00082 * Revision 1.66 2003/04/02 06:58:10 robertj 00083 * Added support for (optional) duplicate aliases in gatekeeper server, necessitating 00084 * the removal of AddAlias and RemoveAlias functions. 00085 * 00086 * Revision 1.65 2003/04/02 06:07:12 robertj 00087 * Added H.323 Annex G Peer Element support to gatekeeper server. 00088 * 00089 * Revision 1.64 2003/04/01 07:30:52 robertj 00090 * Added function to translate alias into alias list and transport to make 00091 * use of full information returned by peer element. 00092 * 00093 * Revision 1.63 2003/04/01 04:47:48 robertj 00094 * Abstracted H.225 RAS transaction processing (RIP and secondary thread) in 00095 * server environment for use by H.501 peer elements. 00096 * 00097 * Revision 1.62 2003/03/26 07:10:03 robertj 00098 * Added more access functions. 00099 * 00100 * Revision 1.61 2003/03/17 22:52:06 craigs 00101 * Improvided useability of AddAlias and RemoveAlias 00102 * 00103 * Revision 1.60 2003/03/04 05:34:13 robertj 00104 * Fixed GNU warnings 00105 * 00106 * Revision 1.59 2003/03/04 05:27:51 robertj 00107 * Added statistics for rejected registrations and call admissions. 00108 * 00109 * Revision 1.58 2003/03/03 06:59:26 robertj 00110 * Fixed call SetBandwidth function so adjusts global bandwidth as well. 00111 * 00112 * Revision 1.57 2003/02/21 07:21:40 robertj 00113 * Fixed incorrect ancestor in PCLASSINFO() 00114 * 00115 * Revision 1.56 2003/02/21 05:28:39 craigs 00116 * Factored out code for user with peer elements 00117 * 00118 * Revision 1.55 2003/02/06 04:43:14 robertj 00119 * Changes to help with endpoints behind NAT. 00120 * 00121 * Revision 1.54 2003/02/03 03:58:06 robertj 00122 * Fixed use of local password database with ep's that have multiple aliases. 00123 * 00124 * Revision 1.53 2003/02/01 13:31:14 robertj 00125 * Changes to support CAT authentication in RAS. 00126 * 00127 * Revision 1.52 2002/12/17 01:25:23 robertj 00128 * Added call backs on gk server when ep indicates alerting or connect. 00129 * 00130 * Revision 1.51 2002/11/28 05:45:46 robertj 00131 * Fixed bug so can set total bandwidth while calls are in progress. 00132 * 00133 * Revision 1.50 2002/11/28 04:41:44 robertj 00134 * Added support for RAS ServiceControlIndication command. 00135 * 00136 * Revision 1.49 2002/11/27 06:54:52 robertj 00137 * Added Service Control Session management as per Annex K/H.323 via RAS 00138 * only at this stage. 00139 * Added H.248 ASN and very primitive infrastructure for linking into the 00140 * Service Control Session management system. 00141 * Added basic infrastructure for Annex K/H.323 HTTP transport system. 00142 * Added Call Credit Service Control to display account balances. 00143 * 00144 * Revision 1.48 2002/11/22 00:11:29 robertj 00145 * Added call start time. 00146 * 00147 * Revision 1.47 2002/11/18 23:40:45 robertj 00148 * Changed to use the H323EndPoint::CreateAuthenticators() function, we 00149 * should use only one. 00150 * 00151 * Revision 1.46 2002/11/12 11:36:03 robertj 00152 * Added function to find endpoint by partial alias. 00153 * Optimised endpoint "indexes" to use sorted lists instead of dictionaries. 00154 * 00155 * Revision 1.45 2002/11/06 23:23:48 robertj 00156 * Fixed minor error in parameter, should be reference not value 00157 * 00158 * Revision 1.44 2002/10/29 00:12:02 robertj 00159 * Changed template classes so things like PSafeList actually creates the 00160 * base collection class as well. 00161 * Improved setting of usage info, included getting it from BRQ etc. 00162 * 00163 * Revision 1.43 2002/10/21 00:54:47 robertj 00164 * Added function to unregister an endpoint via user interface. 00165 * Added reason code to call disengage. 00166 * Added ability to find call by a description string. 00167 * 00168 * Revision 1.42 2002/10/17 05:26:33 robertj 00169 * Added function to get at registered endpoints protocol version. 00170 * 00171 * Revision 1.41 2002/10/16 07:22:50 robertj 00172 * Added support for endpoints that do not support RRQ timeToLive parameter, 00173 * will actively go see if ep is there using IRQ before expiring the ep. 00174 * 00175 * Revision 1.40 2002/10/01 08:17:34 robertj 00176 * Fixed (benign) race condition between client and server both wanting to do 00177 * a DRQ of a call at the same time. Caused an Assert, but no crash. 00178 * 00179 * Revision 1.39 2002/09/26 01:27:31 robertj 00180 * Changed appliation info name in registered endpoint to be caseless string. 00181 * 00182 * Revision 1.38 2002/09/24 08:03:51 robertj 00183 * Added H.225 RAS protocol version number to registered endpoint structure. 00184 * 00185 * Revision 1.37 2002/09/19 09:15:56 robertj 00186 * Fixed problem with making (and assuring with multi-threading) IRQ and DRQ 00187 * requests are sent to the correct endpoint address, thanks Martijn Roest. 00188 * 00189 * Revision 1.36 2002/09/16 01:14:15 robertj 00190 * Added #define so can select if #pragma interface/implementation is used on 00191 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00192 * 00193 * Revision 1.35 2002/09/03 06:19:36 robertj 00194 * Normalised the multi-include header prevention ifdef/define symbol. 00195 * 00196 * Revision 1.34 2002/08/29 07:57:08 robertj 00197 * Added some statistics to gatekeeper server. 00198 * 00199 * Revision 1.33 2002/08/29 06:54:52 robertj 00200 * Removed redundent thread member variable from request info. 00201 * 00202 * Revision 1.32 2002/08/12 08:12:45 robertj 00203 * Added extra hint to help with ARQ using separate credentials from RRQ. 00204 * 00205 * Revision 1.31 2002/08/12 05:38:20 robertj 00206 * Changes to the RAS subsystem to support ability to make requests to client 00207 * from gkserver without causing bottlenecks and race conditions. 00208 * 00209 * Revision 1.30 2002/08/05 10:03:47 robertj 00210 * Cosmetic changes to normalise the usage of pragma interface/implementation. 00211 * 00212 * Revision 1.29 2002/08/05 05:17:37 robertj 00213 * Fairly major modifications to support different authentication credentials 00214 * in ARQ to the logged in ones on RRQ. For both client and server. 00215 * Various other H.235 authentication bugs and anomalies fixed on the way. 00216 * 00217 * Revision 1.28 2002/07/16 13:49:22 robertj 00218 * Added missing lock when removing call from endpoint. 00219 * 00220 * Revision 1.27 2002/07/11 09:33:56 robertj 00221 * Added access functions to various call statistics member variables. 00222 * 00223 * Revision 1.26 2002/07/11 07:01:37 robertj 00224 * Added Disengage() function to force call drop from gk server. 00225 * Added InfoRequest() function to force client to send an IRR. 00226 * Added ability to automatically clear calls if do not get IRR for it. 00227 * 00228 * Revision 1.25 2002/06/21 02:52:44 robertj 00229 * Fixed problem with double checking H.235 hashing, this causes failure as 00230 * the authenticator thinks it is a replay attack. 00231 * 00232 * Revision 1.24 2002/06/19 05:03:08 robertj 00233 * Changed gk code to allow for H.235 security on an endpoint by endpoint basis. 00234 * 00235 * Revision 1.23 2002/06/12 03:55:21 robertj 00236 * Added function to add/remove multiple listeners in one go comparing against 00237 * what is already running so does not interrupt unchanged listeners. 00238 * 00239 * Revision 1.22 2002/05/29 00:03:15 robertj 00240 * Fixed unsolicited IRR support in gk client and server, 00241 * including support for IACK and INAK. 00242 * 00243 * Revision 1.21 2002/05/21 06:30:31 robertj 00244 * Changed GRQ to the same as all the other xRQ request handlers. 00245 * 00246 * Revision 1.20 2002/05/17 03:42:08 robertj 00247 * Fixed problems with H.235 authentication on RAS for server and client. 00248 * 00249 * Revision 1.19 2002/05/07 03:18:12 robertj 00250 * Added application info (name/version etc) into registered endpoint data. 00251 * 00252 * Revision 1.18 2002/05/06 00:56:37 robertj 00253 * Sizeable rewrite of gatekeeper server code to make more bulletproof against 00254 * multithreaded operation. Especially when using slow response/RIP feature. 00255 * Also changed the call indexing to use call id and direction as key. 00256 * 00257 * Revision 1.17 2002/04/30 23:19:00 dereks 00258 * Fix documentation typos. 00259 * 00260 * Revision 1.16 2002/03/06 02:01:31 robertj 00261 * Fixed race condition when starting slow server response thread. 00262 * 00263 * Revision 1.15 2002/03/05 00:36:01 craigs 00264 * Added GetReplyAddress for H323GatekeeperRequest 00265 * 00266 * Revision 1.14 2002/03/03 21:34:50 robertj 00267 * Added gatekeeper monitor thread. 00268 * 00269 * Revision 1.13 2002/03/02 05:58:57 robertj 00270 * Fixed possible bandwidth leak (thanks Francisco Olarte Sanz) and in 00271 * the process added OnBandwidth function to H323GatekeeperCall class. 00272 * 00273 * Revision 1.12 2002/03/01 04:09:09 robertj 00274 * Fixed problems with keeping track of calls. Calls are now indexed by call-id 00275 * alone and maintain both endpoints of call in its structure. Fixes problem 00276 * with calls form an endpoint to itself, and having two objects being tracked 00277 * where there is really only one call. 00278 * 00279 * Revision 1.11 2002/02/04 05:21:13 robertj 00280 * Lots of changes to fix multithreaded slow response code (RIP). 00281 * Fixed problem with having two entries for same call in call list. 00282 * 00283 * Revision 1.10 2002/01/31 06:45:44 robertj 00284 * Added more checking for invalid list processing in calls database. 00285 * 00286 * Revision 1.9 2002/01/31 00:16:15 robertj 00287 * Removed const to allow things to compile! 00288 * 00289 * Revision 1.8 2001/12/15 08:08:52 robertj 00290 * Added alerting, connect and end of call times to be sent to RAS server. 00291 * 00292 * Revision 1.7 2001/12/14 06:40:47 robertj 00293 * Added call end reason codes in DisengageRequest for GK server use. 00294 * 00295 * Revision 1.6 2001/12/13 11:08:45 robertj 00296 * Significant changes to support slow request handling, automatically sending 00297 * RIP and spawning thread to handle time consuming operation. 00298 * 00299 * Revision 1.5 2001/11/19 06:56:44 robertj 00300 * Added prefix strings for gateways registered with this gk, thanks Mikael Stolt 00301 * 00302 * Revision 1.4 2001/08/10 11:03:49 robertj 00303 * Major changes to H.235 support in RAS to support server. 00304 * 00305 * Revision 1.3 2001/08/06 07:44:52 robertj 00306 * Fixed problems with building without SSL 00307 * 00308 * Revision 1.2 2001/08/06 03:18:35 robertj 00309 * Fission of h323.h to h323ep.h & h323con.h, h323.h now just includes files. 00310 * Improved access to H.235 secure RAS functionality. 00311 * Changes to H.323 secure RAS contexts to help use with gk server. 00312 * 00313 * Revision 1.1 2001/07/24 02:30:55 robertj 00314 * Added gatekeeper RAS protocol server classes. 00315 * 00316 */ 00317 00318 #ifndef __OPAL_GKSERVER_H 00319 #define __OPAL_GKSERVER_H 00320 00321 #ifdef P_USE_PRAGMA 00322 #pragma interface 00323 #endif 00324 00325 00326 #include "h323ep.h" 00327 #include "h225ras.h" 00328 #include "guid.h" 00329 #include "h235auth.h" 00330 #include "h323pdu.h" 00331 #include "h323trans.h" 00332 00333 #include <ptlib/safecoll.h> 00334 00335 00336 class PASN_Sequence; 00337 class PASN_Choice; 00338 00339 class H225_AliasAddress; 00340 class H225_ArrayOf_TransportAddress; 00341 class H225_GatekeeperIdentifier; 00342 class H225_EndpointIdentifier; 00343 class H225_InfoRequestResponse_perCallInfo_subtype; 00344 class H225_RasUsageInformation; 00345 00346 class H323RegisteredEndPoint; 00347 class H323GatekeeperListener; 00348 class H323GatekeeperServer; 00349 class H323RasPDU; 00350 class H323PeerElement; 00351 00352 00353 class H323GatekeeperRequest : public H323Transaction 00354 { 00355 PCLASSINFO(H323GatekeeperRequest, H323Transaction); 00356 public: 00361 H323GatekeeperRequest( 00362 H323GatekeeperListener & rasChannel, 00363 const H323RasPDU & pdu 00364 ); 00366 00367 virtual H323TransactionPDU * CreateRIP( 00368 unsigned sequenceNumber, 00369 unsigned delay 00370 ) const; 00371 00372 virtual BOOL WritePDU( 00373 H323TransactionPDU & pdu 00374 ); 00375 BOOL CheckCryptoTokens(); 00376 BOOL CheckGatekeeperIdentifier(); 00377 BOOL GetRegisteredEndPoint(); 00378 00379 virtual PString GetGatekeeperIdentifier() const = 0; 00380 virtual unsigned GetGatekeeperRejectTag() const = 0; 00381 virtual PString GetEndpointIdentifier() const = 0; 00382 virtual unsigned GetRegisteredEndPointRejectTag() const = 0; 00383 virtual unsigned GetSecurityRejectTag() const = 0; 00384 00385 H323GatekeeperListener & GetRasChannel() const { return rasChannel; } 00386 00387 PSafePtr<H323RegisteredEndPoint> endpoint; 00388 00389 protected: 00390 H323GatekeeperListener & rasChannel; 00391 }; 00392 00393 00394 class H323GatekeeperGRQ : public H323GatekeeperRequest 00395 { 00396 PCLASSINFO(H323GatekeeperGRQ, H323GatekeeperRequest); 00397 public: 00398 H323GatekeeperGRQ( 00399 H323GatekeeperListener & listener, 00400 const H323RasPDU & pdu 00401 ); 00402 00403 #if PTRACING 00404 virtual const char * GetName() const; 00405 #endif 00406 virtual PString GetGatekeeperIdentifier() const; 00407 virtual unsigned GetGatekeeperRejectTag() const; 00408 virtual PString GetEndpointIdentifier() const; 00409 virtual unsigned GetRegisteredEndPointRejectTag() const; 00410 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00411 virtual unsigned GetSecurityRejectTag() const; 00412 virtual void SetRejectReason( 00413 unsigned reasonCode 00414 ); 00415 00416 H225_GatekeeperRequest & grq; 00417 H225_GatekeeperConfirm & gcf; 00418 H225_GatekeeperReject & grj; 00419 00420 protected: 00421 virtual Response OnHandlePDU(); 00422 }; 00423 00424 00425 class H323GatekeeperRRQ : public H323GatekeeperRequest 00426 { 00427 PCLASSINFO(H323GatekeeperRRQ, H323GatekeeperRequest); 00428 public: 00429 H323GatekeeperRRQ( 00430 H323GatekeeperListener & listener, 00431 const H323RasPDU & pdu 00432 ); 00433 00434 #if PTRACING 00435 virtual const char * GetName() const; 00436 #endif 00437 virtual PString GetGatekeeperIdentifier() const; 00438 virtual unsigned GetGatekeeperRejectTag() const; 00439 virtual PString GetEndpointIdentifier() const; 00440 virtual unsigned GetRegisteredEndPointRejectTag() const; 00441 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00442 virtual unsigned GetSecurityRejectTag() const; 00443 virtual void SetRejectReason( 00444 unsigned reasonCode 00445 ); 00446 00447 H225_RegistrationRequest & rrq; 00448 H225_RegistrationConfirm & rcf; 00449 H225_RegistrationReject & rrj; 00450 00451 protected: 00452 virtual Response OnHandlePDU(); 00453 }; 00454 00455 00456 class H323GatekeeperURQ : public H323GatekeeperRequest 00457 { 00458 PCLASSINFO(H323GatekeeperURQ, H323GatekeeperRequest); 00459 public: 00460 H323GatekeeperURQ( 00461 H323GatekeeperListener & listener, 00462 const H323RasPDU & pdu 00463 ); 00464 00465 #if PTRACING 00466 virtual const char * GetName() const; 00467 #endif 00468 virtual PString GetGatekeeperIdentifier() const; 00469 virtual unsigned GetGatekeeperRejectTag() const; 00470 virtual PString GetEndpointIdentifier() const; 00471 virtual unsigned GetRegisteredEndPointRejectTag() const; 00472 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00473 virtual unsigned GetSecurityRejectTag() const; 00474 virtual void SetRejectReason( 00475 unsigned reasonCode 00476 ); 00477 00478 H225_UnregistrationRequest & urq; 00479 H225_UnregistrationConfirm & ucf; 00480 H225_UnregistrationReject & urj; 00481 00482 protected: 00483 virtual Response OnHandlePDU(); 00484 }; 00485 00486 00487 class H323GatekeeperARQ : public H323GatekeeperRequest 00488 { 00489 PCLASSINFO(H323GatekeeperARQ, H323GatekeeperRequest); 00490 public: 00491 H323GatekeeperARQ( 00492 H323GatekeeperListener & listener, 00493 const H323RasPDU & pdu 00494 ); 00495 00496 #if PTRACING 00497 virtual const char * GetName() const; 00498 #endif 00499 virtual PString GetGatekeeperIdentifier() const; 00500 virtual unsigned GetGatekeeperRejectTag() const; 00501 virtual PString GetEndpointIdentifier() const; 00502 virtual unsigned GetRegisteredEndPointRejectTag() const; 00503 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00504 virtual unsigned GetSecurityRejectTag() const; 00505 virtual void SetRejectReason( 00506 unsigned reasonCode 00507 ); 00508 00509 H225_AdmissionRequest & arq; 00510 H225_AdmissionConfirm & acf; 00511 H225_AdmissionReject & arj; 00512 00513 PString alternateSecurityID; 00514 00515 protected: 00516 virtual Response OnHandlePDU(); 00517 }; 00518 00519 00520 class H323GatekeeperDRQ : public H323GatekeeperRequest 00521 { 00522 PCLASSINFO(H323GatekeeperDRQ, H323GatekeeperRequest); 00523 public: 00524 H323GatekeeperDRQ( 00525 H323GatekeeperListener & listener, 00526 const H323RasPDU & pdu 00527 ); 00528 00529 #if PTRACING 00530 virtual const char * GetName() const; 00531 #endif 00532 virtual PString GetGatekeeperIdentifier() const; 00533 virtual unsigned GetGatekeeperRejectTag() const; 00534 virtual PString GetEndpointIdentifier() const; 00535 virtual unsigned GetRegisteredEndPointRejectTag() const; 00536 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00537 virtual unsigned GetSecurityRejectTag() const; 00538 virtual void SetRejectReason( 00539 unsigned reasonCode 00540 ); 00541 00542 H225_DisengageRequest & drq; 00543 H225_DisengageConfirm & dcf; 00544 H225_DisengageReject & drj; 00545 00546 protected: 00547 virtual Response OnHandlePDU(); 00548 }; 00549 00550 00551 class H323GatekeeperBRQ : public H323GatekeeperRequest 00552 { 00553 PCLASSINFO(H323GatekeeperBRQ, H323GatekeeperRequest); 00554 public: 00555 H323GatekeeperBRQ( 00556 H323GatekeeperListener & listener, 00557 const H323RasPDU & pdu 00558 ); 00559 00560 #if PTRACING 00561 virtual const char * GetName() const; 00562 #endif 00563 virtual PString GetGatekeeperIdentifier() const; 00564 virtual unsigned GetGatekeeperRejectTag() const; 00565 virtual PString GetEndpointIdentifier() const; 00566 virtual unsigned GetRegisteredEndPointRejectTag() const; 00567 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00568 virtual unsigned GetSecurityRejectTag() const; 00569 virtual void SetRejectReason( 00570 unsigned reasonCode 00571 ); 00572 00573 H225_BandwidthRequest & brq; 00574 H225_BandwidthConfirm & bcf; 00575 H225_BandwidthReject & brj; 00576 00577 protected: 00578 virtual Response OnHandlePDU(); 00579 }; 00580 00581 00582 class H323GatekeeperLRQ : public H323GatekeeperRequest 00583 { 00584 PCLASSINFO(H323GatekeeperLRQ, H323GatekeeperRequest); 00585 public: 00586 H323GatekeeperLRQ( 00587 H323GatekeeperListener & listener, 00588 const H323RasPDU & pdu 00589 ); 00590 00591 #if PTRACING 00592 virtual const char * GetName() const; 00593 #endif 00594 virtual PString GetGatekeeperIdentifier() const; 00595 virtual unsigned GetGatekeeperRejectTag() const; 00596 virtual PString GetEndpointIdentifier() const; 00597 virtual unsigned GetRegisteredEndPointRejectTag() const; 00598 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00599 virtual unsigned GetSecurityRejectTag() const; 00600 virtual void SetRejectReason( 00601 unsigned reasonCode 00602 ); 00603 00604 H225_LocationRequest & lrq; 00605 H225_LocationConfirm & lcf; 00606 H225_LocationReject & lrj; 00607 00608 protected: 00609 virtual Response OnHandlePDU(); 00610 }; 00611 00612 00613 class H323GatekeeperIRR : public H323GatekeeperRequest 00614 { 00615 PCLASSINFO(H323GatekeeperIRR, H323GatekeeperRequest); 00616 public: 00617 H323GatekeeperIRR( 00618 H323GatekeeperListener & listener, 00619 const H323RasPDU & pdu 00620 ); 00621 00622 #if PTRACING 00623 virtual const char * GetName() const; 00624 #endif 00625 virtual PString GetGatekeeperIdentifier() const; 00626 virtual unsigned GetGatekeeperRejectTag() const; 00627 virtual PString GetEndpointIdentifier() const; 00628 virtual unsigned GetRegisteredEndPointRejectTag() const; 00629 virtual H235Authenticator::ValidationResult ValidatePDU() const; 00630 virtual unsigned GetSecurityRejectTag() const; 00631 virtual void SetRejectReason( 00632 unsigned reasonCode 00633 ); 00634 00635 H225_InfoRequestResponse & irr; 00636 H225_InfoRequestAck & iack; 00637 H225_InfoRequestNak & inak; 00638 00639 protected: 00640 virtual Response OnHandlePDU(); 00641 }; 00642 00643 00646 class H323GatekeeperCall : public PSafeObject 00647 { 00648 PCLASSINFO(H323GatekeeperCall, PSafeObject); 00649 public: 00652 enum Direction { 00653 AnsweringCall, 00654 OriginatingCall, 00655 UnknownDirection 00656 }; 00657 00660 H323GatekeeperCall( 00661 H323GatekeeperServer & server, 00662 const OpalGloballyUniqueID & callIdentifier, 00663 Direction direction 00664 ); 00665 00668 ~H323GatekeeperCall(); 00670 00675 Comparison Compare( 00676 const PObject & obj 00677 ) const; 00678 00681 void PrintOn( 00682 ostream & strm 00683 ) const; 00685 00693 virtual H323GatekeeperRequest::Response OnAdmission( 00694 H323GatekeeperARQ & request 00695 ); 00696 00700 virtual BOOL Disengage( 00701 int reason = -1 // Reason for disengage 00702 ); 00703 00707 virtual H323GatekeeperRequest::Response OnDisengage( 00708 H323GatekeeperDRQ & request 00709 ); 00710 00715 virtual H323GatekeeperRequest::Response OnBandwidth( 00716 H323GatekeeperBRQ & request 00717 ); 00718 00722 virtual H323GatekeeperRequest::Response OnInfoResponse( 00723 H323GatekeeperIRR & request, 00724 H225_InfoRequestResponse_perCallInfo_subtype & call 00725 ); 00726 00729 virtual void OnAlerting(); 00730 00733 virtual void OnConnected(); 00734 00745 virtual BOOL OnHeartbeat(); 00746 00753 virtual PString GetCallCreditAmount() const; 00754 00761 virtual BOOL GetCallCreditMode() const; 00762 00770 virtual unsigned GetDurationLimit() const; 00771 00776 virtual BOOL SendCallCreditServiceControl(); 00777 00780 BOOL AddCallCreditServiceControl( 00781 H225_ArrayOf_ServiceControlSession & serviceControl 00782 ) const; 00783 00788 virtual BOOL SendServiceControlSession( 00789 const H323ServiceControlSession & session 00790 ); 00791 00797 virtual BOOL TranslateAliasAddress( 00798 const H225_AliasAddress & alias, 00799 H225_ArrayOf_AliasAddress & aliases, 00800 H323TransportAddress & address 00801 ); 00802 00804 00807 H323GatekeeperServer & GetGatekeeper() const { return gatekeeper; } 00808 H323RegisteredEndPoint & GetEndPoint() const { return *PAssertNULL(endpoint); } 00809 BOOL IsAnsweringCall() const { return direction == AnsweringCall; } 00810 unsigned GetCallReference() const { return callReference; } 00811 const OpalGloballyUniqueID & GetCallIdentifier() const { return callIdentifier; } 00812 const OpalGloballyUniqueID & GetConferenceIdentifier() const { return conferenceIdentifier; } 00813 const PString & GetSourceNumber() const { return srcNumber; } 00814 const PStringArray & GetSourceAliases() const { return srcAliases; } 00815 const H323TransportAddress & GetSourceHost() const { return srcHost; } 00816 PString GetSourceAddress() const; 00817 const PString & GetDestinationNumber() const { return dstNumber; } 00818 const PStringArray & GetDestinationAliases() const { return dstAliases; } 00819 const H323TransportAddress & GetDestinationHost() const { return dstHost; } 00820 PString GetDestinationAddress() const; 00821 unsigned GetBandwidthUsed() const { return bandwidthUsed; } 00822 BOOL SetBandwidthUsed(unsigned bandwidth); 00823 const PTime & GetLastInfoResponseTime() const { return lastInfoResponse; } 00824 const PTime & GetCallStartTime() const { return callStartTime; } 00825 const PTime & GetAlertingTime() const { return alertingTime; } 00826 const PTime & GetConnectedTime() const { return connectedTime; } 00827 const PTime & GetCallEndTime() const { return callEndTime; } 00828 H323Connection::CallEndReason GetCallEndReason() const { return callEndReason; } 00830 00831 protected: 00832 void SetUsageInfo(const H225_RasUsageInformation & usage); 00833 00834 H323GatekeeperServer & gatekeeper; 00835 H323RegisteredEndPoint * endpoint; 00836 H323GatekeeperListener * rasChannel; 00837 00838 Direction direction; 00839 unsigned callReference; 00840 OpalGloballyUniqueID callIdentifier; 00841 OpalGloballyUniqueID conferenceIdentifier; 00842 PString srcNumber; 00843 PStringArray srcAliases; 00844 H323TransportAddress srcHost; 00845 PString dstNumber; 00846 PStringArray dstAliases; 00847 H323TransportAddress dstHost; 00848 unsigned bandwidthUsed; 00849 unsigned infoResponseRate; 00850 PTime lastInfoResponse; 00851 00852 BOOL drqReceived; 00853 PTime callStartTime; 00854 PTime alertingTime; 00855 PTime connectedTime; 00856 PTime callEndTime; 00857 H323Connection::CallEndReason callEndReason; 00858 }; 00859 00860 00866 class H323RegisteredEndPoint : public PSafeObject 00867 { 00868 PCLASSINFO(H323RegisteredEndPoint, PSafeObject); 00869 public: 00874 H323RegisteredEndPoint( 00875 H323GatekeeperServer & server, 00876 const PString & id 00877 ); 00879 00884 Comparison Compare( 00885 const PObject & obj 00886 ) const; 00887 00890 void PrintOn( 00891 ostream & strm 00892 ) const; 00894 00901 virtual void AddCall( 00902 H323GatekeeperCall * call 00903 ); 00904 00909 virtual BOOL RemoveCall( 00910 H323GatekeeperCall * call 00911 ); 00912 00915 PINDEX GetCallCount() const { return activeCalls.GetSize(); } 00916 00919 H323GatekeeperCall & GetCall( 00920 PINDEX idx 00921 ) { return activeCalls[idx]; } 00923 00932 virtual H323GatekeeperRequest::Response OnRegistration( 00933 H323GatekeeperRRQ & request 00934 ); 00935 00945 virtual H323GatekeeperRequest::Response OnFullRegistration( 00946 H323GatekeeperRRQ & request 00947 ); 00948 00957 virtual H323GatekeeperRequest::Response OnSecureRegistration( 00958 H323GatekeeperRRQ & request 00959 ); 00960 00964 virtual H323GatekeeperRequest::Response OnUnregistration( 00965 H323GatekeeperURQ & request 00966 ); 00967 00971 virtual BOOL Unregister( 00972 int reason = -1 // Reason for unregistration 00973 ); 00974 00979 virtual H323GatekeeperRequest::Response OnInfoResponse( 00980 H323GatekeeperIRR & request 00981 ); 00982 00993 virtual BOOL OnTimeToLive(); 00994 01006 virtual PString GetCallCreditAmount() const; 01007 01015 virtual BOOL GetCallCreditMode() const; 01016 01021 virtual BOOL SendServiceControlSession( 01022 const H323ServiceControlSession & session 01023 ); 01024 01028 virtual BOOL AddServiceControlSession( 01029 const H323ServiceControlSession & session, 01030 H225_ArrayOf_ServiceControlSession & serviceControl 01031 ); 01033 01038 virtual BOOL SetPassword( 01039 const PString & password, 01040 const PString & username = PString::Empty() 01041 ); 01042 01045 const PString & GetIdentifier() const { return identifier; } 01046 01049 const OpalGloballyUniqueID & GetDescriptorID() const { return descriptorID; } 01050 01053 H323GatekeeperServer & GetGatekeeper() const { return gatekeeper; } 01054 01058 const H323TransportAddressArray & GetRASAddresses() const { return rasAddresses; } 01059 01063 PINDEX GetRASAddressCount() const { return rasAddresses.GetSize(); } 01064 01068 H323TransportAddress GetRASAddress( 01069 PINDEX idx 01070 ) const { return rasAddresses[idx]; } 01071 01075 const H323TransportAddressArray & GetSignalAddresses() const { return signalAddresses; } 01076 01080 PINDEX GetSignalAddressCount() const { return signalAddresses.GetSize(); } 01081 01085 H323TransportAddress GetSignalAddress( 01086 PINDEX idx 01087 ) const { return signalAddresses[idx]; } 01088 01091 const PStringArray & GetAliases() const { return aliases; } 01092 01095 BOOL ContainsAlias( 01096 const PString & alias 01097 ) { return aliases.GetStringsIndex(alias) != P_MAX_INDEX; } 01098 01101 PINDEX GetAliasCount() const { return aliases.GetSize(); } 01102 01105 PString GetAlias( 01106 PINDEX idx 01107 ) const { if (idx < aliases.GetSize()) return aliases[idx]; return PString::Empty(); } 01108 01114 void RemoveAlias( 01115 const PString & alias 01116 ); 01117 01120 virtual const H235Authenticators & GetAuthenticators() const { return authenticators; } 01121 01124 PINDEX GetPrefixCount() const { return voicePrefixes.GetSize(); } 01125 01128 PString GetPrefix( 01129 PINDEX idx 01130 ) const { return voicePrefixes[idx]; } 01131 01134 const PCaselessString & GetApplicationInfo() const { return applicationInfo; } 01135 01138 unsigned GetProtocolVersion() const { return protocolVersion; } 01139 01142 BOOL IsBehindNAT() const { return isBehindNAT; } 01143 01146 BOOL CanDisplayAmountString() const { return canDisplayAmountString; } 01147 01150 BOOL CanEnforceDurationLimit() const { return canEnforceDurationLimit; } 01151 01154 BOOL CanReceiveRIP() const; 01155 01158 BOOL GetH225Version() const { return h225Version; } 01160 01170 virtual BOOL OnSendDescriptorForEndpoint( 01171 H225_ArrayOf_AliasAddress & aliases, // aliases for the enndpoint 01172 H225_EndpointType & terminalType, // terminal type 01173 H225_ArrayOf_AliasAddress & transportAddresses // transport addresses 01174 ); 01176 01177 01178 protected: 01179 H323GatekeeperServer & gatekeeper; 01180 H323GatekeeperListener * rasChannel; 01181 01182 PString identifier; 01183 OpalGloballyUniqueID descriptorID; 01184 H323TransportAddressArray rasAddresses; 01185 H323TransportAddressArray signalAddresses; 01186 PStringArray aliases; 01187 PStringArray voicePrefixes; 01188 PCaselessString applicationInfo; 01189 unsigned protocolVersion; 01190 BOOL isBehindNAT; 01191 BOOL canDisplayAmountString; 01192 BOOL canEnforceDurationLimit; 01193 unsigned h225Version; 01194 unsigned timeToLive; 01195 H235Authenticators authenticators; 01196 01197 PTime lastRegistration; 01198 PTime lastInfoResponse; 01199 01200 PSortedList<H323GatekeeperCall> activeCalls; 01201 POrdinalDictionary<PString> serviceControlSessions; 01202 }; 01203 01204 01210 class H323GatekeeperListener : public H225_RAS 01211 { 01212 PCLASSINFO(H323GatekeeperListener, H225_RAS); 01213 public: 01218 H323GatekeeperListener( 01219 H323EndPoint & endpoint, 01220 H323GatekeeperServer & server, 01221 const PString & gatekeeperIdentifier, 01222 H323Transport * transport = NULL 01223 ); 01224 01227 ~H323GatekeeperListener(); 01229 01234 BOOL UnregistrationRequest( 01235 const H323RegisteredEndPoint & ep, 01236 unsigned reason 01237 ); 01238 01241 BOOL DisengageRequest( 01242 const H323GatekeeperCall & call, 01243 unsigned reason 01244 ); 01245 01248 virtual BOOL InfoRequest( 01249 H323RegisteredEndPoint & ep, 01250 H323GatekeeperCall * call = NULL 01251 ); 01252 01255 virtual BOOL ServiceControlIndication( 01256 H323RegisteredEndPoint & ep, 01257 const H323ServiceControlSession & session, 01258 H323GatekeeperCall * call = NULL 01259 ); 01261 01268 virtual H323GatekeeperRequest::Response OnDiscovery( 01269 H323GatekeeperGRQ & request 01270 ); 01271 01276 virtual H323GatekeeperRequest::Response OnRegistration( 01277 H323GatekeeperRRQ & request 01278 ); 01279 01284 virtual H323GatekeeperRequest::Response OnUnregistration( 01285 H323GatekeeperURQ & request 01286 ); 01287 01292 virtual H323GatekeeperRequest::Response OnAdmission( 01293 H323GatekeeperARQ & request 01294 ); 01295 01300 virtual H323GatekeeperRequest::Response OnDisengage( 01301 H323GatekeeperDRQ & request 01302 ); 01303 01308 virtual H323GatekeeperRequest::Response OnBandwidth( 01309 H323GatekeeperBRQ & request 01310 ); 01311 01316 virtual H323GatekeeperRequest::Response OnLocation( 01317 H323GatekeeperLRQ & request 01318 ); 01319 01324 virtual H323GatekeeperRequest::Response OnInfoResponse( 01325 H323GatekeeperIRR & request 01326 ); 01328 01331 virtual BOOL OnReceiveGatekeeperRequest(const H323RasPDU &, const H225_GatekeeperRequest &); 01332 virtual BOOL OnReceiveRegistrationRequest(const H323RasPDU &, const H225_RegistrationRequest &); 01333 virtual BOOL OnReceiveUnregistrationRequest(const H323RasPDU &, const H225_UnregistrationRequest &); 01334 virtual BOOL OnReceiveUnregistrationConfirm(const H225_UnregistrationConfirm &); 01335 virtual BOOL OnReceiveUnregistrationReject(const H225_UnregistrationReject &); 01336 virtual BOOL OnReceiveAdmissionRequest(const H323RasPDU &, const H225_AdmissionRequest &); 01337 virtual BOOL OnReceiveBandwidthRequest(const H323RasPDU &, const H225_BandwidthRequest &); 01338 virtual BOOL OnReceiveBandwidthConfirm(const H225_BandwidthConfirm &); 01339 virtual BOOL OnReceiveBandwidthReject(const H225_BandwidthReject &); 01340 virtual BOOL OnReceiveDisengageRequest(const H323RasPDU &, const H225_DisengageRequest &); 01341 virtual BOOL OnReceiveDisengageConfirm(const H225_DisengageConfirm &); 01342 virtual BOOL OnReceiveDisengageReject(const H225_DisengageReject &); 01343 virtual BOOL OnReceiveLocationRequest(const H323RasPDU &, const H225_LocationRequest &); 01344 virtual BOOL OnReceiveInfoRequestResponse(const H323RasPDU &, const H225_InfoRequestResponse &); 01345 virtual BOOL OnReceiveResourcesAvailableConfirm(const H225_ResourcesAvailableConfirm &); 01347 01350 H323GatekeeperServer & GetGatekeeper() const { return gatekeeper; } 01352 01353 01354 protected: 01355 H323GatekeeperServer & gatekeeper; 01356 }; 01357 01358 01369 class H323GatekeeperServer : public H323TransactionServer 01370 { 01371 PCLASSINFO(H323GatekeeperServer, H323TransactionServer); 01372 public: 01377 H323GatekeeperServer( 01378 H323EndPoint & endpoint 01379 ); 01380 01383 ~H323GatekeeperServer(); 01385 01386 WORD GetDefaultUdpPort() { return H225_RAS::DefaultRasUdpPort; } 01387 01398 virtual H323Transactor * CreateListener( 01399 H323Transport * transport // Transport for listener 01400 ); 01401 01403 01409 virtual H323GatekeeperRequest::Response OnDiscovery( 01410 H323GatekeeperGRQ & request 01411 ); 01412 01420 virtual H323GatekeeperRequest::Response OnRegistration( 01421 H323GatekeeperRRQ & request 01422 ); 01423 01429 virtual H323GatekeeperRequest::Response OnUnregistration( 01430 H323GatekeeperURQ & request 01431 ); 01432 01437 virtual H323GatekeeperRequest::Response OnInfoResponse( 01438 H323GatekeeperIRR & request 01439 ); 01440 01451 virtual void AddEndPoint( 01452 H323RegisteredEndPoint * ep 01453 ); 01454 01457 virtual BOOL RemoveEndPoint( 01458 H323RegisteredEndPoint * ep 01459 ); 01460 01469 virtual H323RegisteredEndPoint * CreateRegisteredEndPoint( 01470 H323GatekeeperRRQ & request 01471 ); 01472 01481 virtual PString CreateEndPointIdentifier(); 01482 01485 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByIdentifier( 01486 const PString & identifier, 01487 PSafetyMode mode = PSafeReference 01488 ); 01489 01492 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointBySignalAddresses( 01493 const H225_ArrayOf_TransportAddress & addresses, 01494 PSafetyMode mode = PSafeReference 01495 ); 01496 01499 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointBySignalAddress( 01500 const H323TransportAddress & address, 01501 PSafetyMode mode = PSafeReference 01502 ); 01503 01506 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByAliasAddress( 01507 const H225_AliasAddress & alias, 01508 PSafetyMode mode = PSafeReadWrite 01509 ); 01510 01513 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByAliasString( 01514 const PString & alias, 01515 PSafetyMode mode = PSafeReference 01516 ); 01517 01520 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByPartialAlias( 01521 const PString & alias, 01522 PSafetyMode mode = PSafeReference 01523 ); 01524 01527 virtual PSafePtr<H323RegisteredEndPoint> FindEndPointByPrefixString( 01528 const PString & prefix, 01529 PSafetyMode mode = PSafeReference 01530 ); 01531 01534 PSafePtr<H323RegisteredEndPoint> GetFirstEndPoint( 01535 PSafetyMode mode = PSafeReference 01536 ) { return PSafePtr<H323RegisteredEndPoint>(byIdentifier, mode); } 01538 01539 PSafePtr<H323RegisteredEndPoint> FindDestinationEndPoint( 01540 const OpalGloballyUniqueID & id, 01541 H323GatekeeperCall::Direction direction 01542 ); 01543 01551 virtual H323GatekeeperRequest::Response OnAdmission( 01552 H323GatekeeperARQ & request 01553 ); 01554 01559 virtual H323GatekeeperRequest::Response OnDisengage( 01560 H323GatekeeperDRQ & request 01561 ); 01562 01567 virtual H323GatekeeperRequest::Response OnBandwidth( 01568 H323GatekeeperBRQ & request 01569 ); 01570 01579 virtual H323GatekeeperCall * CreateCall( 01580 const OpalGloballyUniqueID & callIdentifier, 01581 H323GatekeeperCall::Direction direction 01582 ); 01583 01586 virtual void AddCall(H323GatekeeperCall *) 01587 { } 01588 01591 virtual void RemoveCall( 01592 H323GatekeeperCall * call 01593 ); 01594 01597 virtual PSafePtr<H323GatekeeperCall> FindCall( 01598 const PString & description, 01599 PSafetyMode mode = PSafeReference 01600 ); 01601 01604 virtual PSafePtr<H323GatekeeperCall> FindCall( 01605 const OpalGloballyUniqueID & callIdentifier, 01606 BOOL answeringCall, 01607 PSafetyMode mode = PSafeReference 01608 ); 01609 01612 virtual PSafePtr<H323GatekeeperCall> FindCall( 01613 const OpalGloballyUniqueID & callIdentifier, 01614 H323GatekeeperCall::Direction direction, 01615 PSafetyMode mode = PSafeReference 01616 ); 01617 01620 PSafePtr<H323GatekeeperCall> GetFirstCall( 01621 PSafetyMode mode = PSafeReference 01622 ) { return PSafePtr<H323GatekeeperCall>(activeCalls, mode); } 01623 01624 01626 01636 virtual H323GatekeeperRequest::Response OnLocation( 01637 H323GatekeeperLRQ & request 01638 ); 01639 01650 virtual BOOL TranslateAliasAddress( 01651 const H225_AliasAddress & alias, 01652 H225_ArrayOf_AliasAddress & aliases, 01653 H323TransportAddress & address 01654 ); 01655 01675 virtual BOOL TranslateAliasAddressToSignalAddress( 01676 const H225_AliasAddress & alias, 01677 H323TransportAddress & address 01678 ); 01680 01692 virtual BOOL CheckSignalAddressPolicy( 01693 const H323RegisteredEndPoint & ep, 01694 const H225_AdmissionRequest & arq, 01695 const H323TransportAddress & address 01696 ); 01697 01710 virtual BOOL CheckAliasAddressPolicy( 01711 const H323RegisteredEndPoint & ep, 01712 const H225_AdmissionRequest & arq, 01713 const H225_AliasAddress & alias 01714 ); 01715 01728 virtual BOOL CheckAliasStringPolicy( 01729 const H323RegisteredEndPoint & ep, 01730 const H225_AdmissionRequest & arq, 01731 const PString & alias 01732 ); 01733 01739 virtual unsigned AllocateBandwidth( 01740 unsigned newBandwidth, 01741 unsigned oldBandwidth = 0 01742 ); 01744 01756 virtual BOOL GetAdmissionRequestAuthentication( 01757 H323GatekeeperARQ & info, 01758 H235Authenticators & authenticators 01759 ); 01760 01766 virtual BOOL GetUsersPassword( 01767 const PString & alias, 01768 PString & password, 01769 H323RegisteredEndPoint & registeredEndpoint 01770 ) const; 01771 virtual BOOL GetUsersPassword( 01772 const PString & alias, 01773 PString & password 01774 ) const; 01776 01781 H323PeerElement * GetPeerElement() const { return peerElement; } 01782 01786 void SetPeerElement( 01787 H323PeerElement * newPeerElement 01788 ); 01789 01795 void CreatePeerElement( 01796 const H323TransportAddress & h501Interface 01797 ); 01798 01804 BOOL OpenPeerElement( 01805 const H323TransportAddress & remotePeer, 01806 BOOL append = FALSE, 01807 BOOL keepTrying = TRUE 01808 ); 01810 01815 const PString & GetGatekeeperIdentifier() const { return gatekeeperIdentifier; } 01816 01822 void SetGatekeeperIdentifier( 01823 const PString & id, 01824 BOOL adjustListeners = TRUE 01825 ); 01826 01829 unsigned GetAvailableBandwidth() const { return totalBandwidth; } 01830 01833 void SetAvailableBandwidth(unsigned bps100) { totalBandwidth = bps100; } 01834 01837 unsigned GetUsedBandwidth() const { return usedBandwidth; } 01838 01841 unsigned GetDefaultBandwidth() const { return defaultBandwidth; } 01842 01845 unsigned GetTimeToLive() const { return defaultTimeToLive; } 01846 01849 void SetTimeToLive(unsigned seconds) { defaultTimeToLive = seconds; } 01850 01853 unsigned GetInfoResponseRate() const { return defaultInfoResponseRate; } 01854 01857 void SetInfoResponseRate(unsigned seconds) { defaultInfoResponseRate = seconds; } 01858 01861 BOOL IsGatekeeperRouted() const { return isGatekeeperRouted; } 01862 01865 BOOL IsRequiredH235() const { return requireH235; } 01866 01869 unsigned GetActiveRegistrations() const { return byIdentifier.GetSize(); } 01870 01873 unsigned GetPeakRegistrations() const { return peakRegistrations; } 01874 01877 unsigned GetTotalRegistrations() const { return totalRegistrations; } 01878 01881 unsigned GetRejectedRegistrations() const { return rejectedRegistrations; } 01882 01885 unsigned GetActiveCalls() const { return activeCalls.GetSize(); } 01886 01889 unsigned GetPeakCalls() const { return peakCalls; } 01890 01893 unsigned GetTotalCalls() const { return totalCalls; } 01894 01897 unsigned GetRejectedCalls() const { return rejectedCalls; } 01899 01900 // Remove an alias from the server database. 01901 void RemoveAlias( 01902 H323RegisteredEndPoint & ep, 01903 const PString & alias 01904 ); 01905 01906 // called when an endpoint needs to send a descriptor to the H.501 peer element 01907 virtual BOOL OnSendDescriptorForEndpoint( 01908 H323RegisteredEndPoint & /*ep*/, // endpoint 01909 H225_ArrayOf_AliasAddress & /*aliases*/, // aliases for the enndpoint 01910 H225_EndpointType & /*terminalType*/, // terminal type 01911 H225_ArrayOf_AliasAddress & /*transportAddresses*/ // transport addresses 01912 ) 01913 { return TRUE; } 01914 01915 virtual BOOL AllowDuplicateAlias(const H225_ArrayOf_AliasAddress & /*aliases*/) 01916 { return canHaveDuplicateAlias; } 01917 01918 protected: 01919 01920 PDECLARE_NOTIFIER(PThread, H323GatekeeperServer, MonitorMain); 01921 01922 // Configuration & policy variables 01923 PString gatekeeperIdentifier; 01924 unsigned totalBandwidth; 01925 unsigned usedBandwidth; 01926 unsigned defaultBandwidth; 01927 unsigned maximumBandwidth; 01928 unsigned defaultTimeToLive; 01929 unsigned defaultInfoResponseRate; 01930 BOOL overwriteOnSameSignalAddress; 01931 BOOL canHaveDuplicateAlias; 01932 BOOL canHaveDuplicatePrefix; 01933 BOOL canOnlyCallRegisteredEP; 01934 BOOL canOnlyAnswerRegisteredEP; 01935 BOOL answerCallPreGrantedARQ; 01936 BOOL makeCallPreGrantedARQ; 01937 BOOL isGatekeeperRouted; 01938 BOOL aliasCanBeHostName; 01939 BOOL requireH235; 01940 BOOL disengageOnHearbeatFail; 01941 01942 PStringToString passwords; 01943 01944 // Dynamic variables 01945 PMutex mutex; 01946 time_t identifierBase; 01947 unsigned nextIdentifier; 01948 PThread * monitorThread; 01949 PSyncPoint monitorExit; 01950 01951 PLIST(ListenerList, H323GatekeeperListener); 01952 ListenerList listeners; 01953 01954 H323PeerElement * peerElement; 01955 01956 PSafeDictionary<PString, H323RegisteredEndPoint> byIdentifier; 01957 01958 class StringMap : public PString { 01959 PCLASSINFO(StringMap, PString); 01960 public: 01961 StringMap(const PString & from, const PString & id) 01962 : PString(from), identifier(id) { } 01963 PString identifier; 01964 }; 01965 PSortedStringList byAddress; 01966 PSortedStringList byAlias; 01967 PSortedStringList byVoicePrefix; 01968 01969 PSafeSortedList<H323GatekeeperCall> activeCalls; 01970 01971 PINDEX peakRegistrations; 01972 PINDEX totalRegistrations; 01973 PINDEX rejectedRegistrations; 01974 PINDEX peakCalls; 01975 PINDEX totalCalls; 01976 PINDEX rejectedCalls; 01977 01978 friend class H323GatekeeperRRQ; 01979 friend class H323GatekeeperARQ; 01980 }; 01981 01982 01983 #endif // __OPAL_GKSERVER_H 01984 01985 01987

Generated on Sat Jul 24 17:03:08 2004 for OpenH323 by doxygen 1.3.7