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

gkclient.h

Go to the documentation of this file.
00001 /* 00002 * gkclient.h 00003 * 00004 * Gatekeeper client 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 * Portions of this code were written with the assisance of funding from 00025 * iFace, Inc. http://www.iface.com 00026 * 00027 * Contributor(s): ______________________________________. 00028 * 00029 * $Log: gkclient.h,v $ 00030 * Revision 1.52 2004/03/04 04:49:34 csoutheren 00031 * Added access function for gatekeeper routed address 00032 * 00033 * Revision 1.51 2003/03/26 00:46:25 robertj 00034 * Had another go at making H323Transactor being able to be created 00035 * without having a listener running. 00036 * 00037 * Revision 1.50 2003/02/12 23:59:22 robertj 00038 * Fixed adding missing endpoint identifer in SETUP packet when gatekeeper 00039 * routed, pointed out by Stefan Klein 00040 * Also fixed correct rutrn of gk routing in IRR packet. 00041 * 00042 * Revision 1.49 2003/02/07 06:37:42 robertj 00043 * Changed registration state to an enum so can determine why the RRQ failed. 00044 * 00045 * Revision 1.48 2003/01/06 07:09:28 robertj 00046 * Further fixes for alternate gatekeeper, thanks Kevin Bouchard 00047 * 00048 * Revision 1.47 2002/12/23 22:46:38 robertj 00049 * Changed gatekeeper discovery so an GRJ does not indicate "discovered". 00050 * Added trace output of alternate gatekeepers list. 00051 * 00052 * Revision 1.46 2002/11/28 04:41:44 robertj 00053 * Added support for RAS ServiceControlIndication command. 00054 * 00055 * Revision 1.45 2002/11/27 06:54:52 robertj 00056 * Added Service Control Session management as per Annex K/H.323 via RAS 00057 * only at this stage. 00058 * Added H.248 ASN and very primitive infrastructure for linking into the 00059 * Service Control Session management system. 00060 * Added basic infrastructure for Annex K/H.323 HTTP transport system. 00061 * Added Call Credit Service Control to display account balances. 00062 * 00063 * Revision 1.44 2002/11/21 07:21:46 robertj 00064 * Improvements to alternate gatekeeper client code, thanks Kevin Bouchard 00065 * 00066 * Revision 1.43 2002/09/18 06:58:29 robertj 00067 * Fixed setting of IRR frequency, an RCF could reset timer so it did not time 00068 * out correctly and send IRR in time causing problems with gatekeeper. 00069 * 00070 * Revision 1.42 2002/09/16 01:14:15 robertj 00071 * Added #define so can select if #pragma interface/implementation is used on 00072 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00073 * 00074 * Revision 1.41 2002/09/03 06:19:36 robertj 00075 * Normalised the multi-include header prevention ifdef/define symbol. 00076 * 00077 * Revision 1.40 2002/08/15 04:13:21 robertj 00078 * Fixed correct status of isRegistered flag on various reject/errors. 00079 * 00080 * Revision 1.39 2002/08/12 05:38:20 robertj 00081 * Changes to the RAS subsystem to support ability to make requests to client 00082 * from gkserver without causing bottlenecks and race conditions. 00083 * 00084 * Revision 1.38 2002/08/05 05:17:36 robertj 00085 * Fairly major modifications to support different authentication credentials 00086 * in ARQ to the logged in ones on RRQ. For both client and server. 00087 * Various other H.235 authentication bugs and anomalies fixed on the way. 00088 * 00089 * Revision 1.37 2002/07/18 03:03:38 robertj 00090 * Fixed bug with continually doing lightweight RRQ if no timeToLive present 00091 * and it should not be doing it at all, ditto for unsolicited IRR. 00092 * 00093 * Revision 1.36 2002/07/16 11:06:21 robertj 00094 * Added more alternate gatekeeper implementation, thanks Kevin Bouchard 00095 * 00096 * Revision 1.35 2002/06/26 03:47:45 robertj 00097 * Added support for alternate gatekeepers. 00098 * 00099 * Revision 1.34 2002/05/29 00:03:15 robertj 00100 * Fixed unsolicited IRR support in gk client and server, 00101 * including support for IACK and INAK. 00102 * 00103 * Revision 1.33 2002/05/17 04:12:38 robertj 00104 * Added support for unsolicited IRR transmission in background (heartbeat). 00105 * 00106 * Revision 1.32 2002/03/19 05:17:11 robertj 00107 * Normalised ACF destExtraCallIInfo to be same as other parameters. 00108 * Added ability to get multiple endpoint addresses and tokens from ACF. 00109 * 00110 * Revision 1.31 2001/09/26 07:02:49 robertj 00111 * Added needed mutex for SeparateAuthenticationInARQ mode, thanks Nick Hoath 00112 * 00113 * Revision 1.30 2001/09/18 10:36:54 robertj 00114 * Allowed multiple overlapping requests in RAS channel. 00115 * 00116 * Revision 1.29 2001/09/13 03:21:16 robertj 00117 * Added ability to override authentication credentials for ARQ, thanks Nick Hoath 00118 * 00119 * Revision 1.28 2001/09/12 06:57:58 robertj 00120 * Added support for iNow Access Token from gk, thanks Nick Hoath 00121 * 00122 * Revision 1.27 2001/09/12 06:04:36 robertj 00123 * Added support for sending UUIE's to gk on request, thanks Nick Hoath 00124 * 00125 * Revision 1.26 2001/09/06 02:32:26 robertj 00126 * Added overloaded AdmissionRequest for backward compatibility. 00127 * 00128 * Revision 1.25 2001/08/14 04:26:46 robertj 00129 * Completed the Cisco compatible MD5 authentications, thanks Wolfgang Platzer. 00130 * 00131 * Revision 1.24 2001/08/13 01:27:00 robertj 00132 * Changed GK admission so can return multiple aliases to be used in 00133 * setup packet, thanks Nick Hoath. 00134 * 00135 * Revision 1.23 2001/08/10 11:03:49 robertj 00136 * Major changes to H.235 support in RAS to support server. 00137 * 00138 * Revision 1.22 2001/08/06 07:44:52 robertj 00139 * Fixed problems with building without SSL 00140 * 00141 * Revision 1.21 2001/08/06 03:18:35 robertj 00142 * Fission of h323.h to h323ep.h & h323con.h, h323.h now just includes files. 00143 * Improved access to H.235 secure RAS functionality. 00144 * Changes to H.323 secure RAS contexts to help use with gk server. 00145 * 00146 * Revision 1.20 2001/08/02 04:30:09 robertj 00147 * Added ability for AdmissionRequest to alter destination alias used in 00148 * the outgoing call. 00149 * 00150 * Revision 1.19 2001/06/18 06:23:47 robertj 00151 * Split raw H.225 RAS protocol out of gatekeeper client class. 00152 * 00153 * Revision 1.18 2001/04/05 03:39:42 robertj 00154 * Fixed deadlock if tried to do discovery in time to live timeout. 00155 * 00156 * Revision 1.17 2001/03/28 07:12:56 robertj 00157 * Changed RAS thread interlock to allow for what should not happen, the 00158 * syncpoint being signalled before receiving any packets. 00159 * 00160 * Revision 1.16 2001/03/27 02:18:41 robertj 00161 * Changed to send gk a GRQ if it gives a discoveryRequired error on RRQ. 00162 * 00163 * Revision 1.15 2001/03/17 00:05:52 robertj 00164 * Fixed problems with Gatekeeper RIP handling. 00165 * 00166 * Revision 1.14 2001/02/28 00:20:15 robertj 00167 * Added DiscoverByNameAndAddress() function, thanks Chris Purvis. 00168 * 00169 * Revision 1.13 2001/02/09 05:16:24 robertj 00170 * Added #pragma interface for GNU C++. 00171 * 00172 * Revision 1.12 2000/09/25 06:47:54 robertj 00173 * Removed use of alias if there is no alias present, ie only have transport address. 00174 * 00175 * Revision 1.11 2000/09/01 02:12:54 robertj 00176 * Added ability to select a gatekeeper on LAN via it's identifier name. 00177 * 00178 * Revision 1.10 2000/07/11 19:20:02 robertj 00179 * Fixed problem with endpoint identifiers from some gatekeepers not being a string, just binary info. 00180 * 00181 * Revision 1.9 2000/06/20 03:17:56 robertj 00182 * Added function to get name of gatekeeper, subtle difference from getting identifier. 00183 * 00184 * Revision 1.8 2000/05/18 11:53:33 robertj 00185 * Changes to support doc++ documentation generation. 00186 * 00187 * Revision 1.7 2000/05/09 08:52:36 robertj 00188 * Added support for preGrantedARQ fields on registration. 00189 * 00190 * Revision 1.6 2000/05/02 04:32:24 robertj 00191 * Fixed copyright notice comment. 00192 * 00193 * Revision 1.5 2000/04/11 03:10:40 robertj 00194 * Added ability to reject reason on gatekeeper requests. 00195 * Added ability to get the transport being used to talk to the gatekeeper. 00196 * 00197 * Revision 1.4 2000/04/10 17:37:13 robertj 00198 * Added access function to get the gatekeeper identification string. 00199 * 00200 * Revision 1.3 1999/12/09 21:49:17 robertj 00201 * Added reregister on unregister and time to live reregistration 00202 * 00203 * Revision 1.2 1999/09/14 06:52:54 robertj 00204 * Added better support for multi-homed client hosts. 00205 * 00206 * Revision 1.1 1999/08/31 12:34:18 robertj 00207 * Added gatekeeper support. 00208 * 00209 */ 00210 00211 #ifndef __OPAL_GKCLIENT_H 00212 #define __OPAL_GKCLIENT_H 00213 00214 00215 #include "h225ras.h" 00216 #include "h235auth.h" 00217 00218 #ifdef P_USE_PRAGMA 00219 #pragma interface 00220 #endif 00221 00222 00223 class H225_ArrayOf_AliasAddress; 00224 class H225_H323_UU_PDU; 00225 class H225_AlternateGK; 00226 class H225_ArrayOf_AlternateGK; 00227 class H225_ArrayOf_ServiceControlSession; 00228 00229 00231 00234 class H323Gatekeeper : public H225_RAS 00235 { 00236 PCLASSINFO(H323Gatekeeper, H225_RAS); 00237 public: 00242 H323Gatekeeper( 00243 H323EndPoint & endpoint, 00244 H323Transport * transport 00245 ); 00246 00249 ~H323Gatekeeper(); 00251 00254 BOOL OnReceiveGatekeeperConfirm(const H225_GatekeeperConfirm & gcf); 00255 BOOL OnReceiveGatekeeperReject(const H225_GatekeeperReject & grj); 00256 BOOL OnReceiveRegistrationConfirm(const H225_RegistrationConfirm & rcf); 00257 BOOL OnReceiveRegistrationReject(const H225_RegistrationReject & rrj); 00258 BOOL OnReceiveUnregistrationRequest(const H225_UnregistrationRequest & urq); 00259 BOOL OnReceiveUnregistrationConfirm(const H225_UnregistrationConfirm & ucf); 00260 BOOL OnReceiveUnregistrationReject(const H225_UnregistrationReject & urj); 00261 BOOL OnReceiveAdmissionConfirm(const H225_AdmissionConfirm & acf); 00262 BOOL OnReceiveAdmissionReject(const H225_AdmissionReject & arj); 00263 BOOL OnReceiveDisengageRequest(const H225_DisengageRequest & drq); 00264 BOOL OnReceiveBandwidthConfirm(const H225_BandwidthConfirm & bcf); 00265 BOOL OnReceiveBandwidthRequest(const H225_BandwidthRequest & brq); 00266 BOOL OnReceiveInfoRequest(const H225_InfoRequest & irq); 00267 BOOL OnReceiveServiceControlIndication(const H225_ServiceControlIndication &); 00268 void OnSendGatekeeperRequest(H225_GatekeeperRequest & grq); 00269 void OnSendAdmissionRequest(H225_AdmissionRequest & arq); 00271 00276 BOOL DiscoverAny(); 00277 00282 BOOL DiscoverByName( 00283 const PString & identifier 00284 ); 00285 00290 BOOL DiscoverByAddress( 00291 const H323TransportAddress & address 00292 ); 00293 00297 BOOL DiscoverByNameAndAddress( 00298 const PString & identifier, 00299 const H323TransportAddress & address 00300 ); 00301 00304 BOOL RegistrationRequest( 00305 BOOL autoReregister = TRUE 00306 ); 00307 00310 BOOL UnregistrationRequest( 00311 int reason 00312 ); 00313 00316 BOOL LocationRequest( 00317 const PString & alias, 00318 H323TransportAddress & address 00319 ); 00320 00323 BOOL LocationRequest( 00324 const PStringList & aliases, 00325 H323TransportAddress & address 00326 ); 00327 00328 struct AdmissionResponse { 00329 AdmissionResponse(); 00330 00331 unsigned rejectReason; 00332 00333 BOOL gatekeeperRouted; 00334 PINDEX endpointCount; 00335 H323TransportAddress * transportAddress; 00336 PBYTEArray * accessTokenData; 00337 00338 H225_ArrayOf_AliasAddress * aliasAddresses; 00339 H225_ArrayOf_AliasAddress * destExtraCallInfo; 00340 }; 00341 00344 BOOL AdmissionRequest( 00345 H323Connection & connection, 00346 AdmissionResponse & response, 00347 BOOL ignorePreGrantedARQ = FALSE 00348 ); 00349 00352 BOOL DisengageRequest( 00353 const H323Connection & connection, 00354 unsigned reason 00355 ); 00356 00359 BOOL BandwidthRequest( 00360 H323Connection & connection, 00361 unsigned requestedBandwidth 00362 ); 00363 00366 void InfoRequestResponse(); 00367 00370 void InfoRequestResponse( 00371 const H323Connection & connection 00372 ); 00373 00376 void InfoRequestResponse( 00377 const H323Connection & connection, 00378 const H225_H323_UU_PDU & pdu, 00379 BOOL sent 00380 ); 00381 00384 virtual void OnServiceControlSessions( 00385 const H225_ArrayOf_ServiceControlSession & serviceControl, 00386 H323Connection * connection 00387 ); 00389 00394 BOOL IsDiscoveryComplete() const { return discoveryComplete; } 00395 00398 BOOL IsRegistered() const { return registrationFailReason == RegistrationSuccessful; } 00399 00400 enum RegistrationFailReasons { 00401 RegistrationSuccessful, 00402 UnregisteredLocally, 00403 UnregisteredByGatekeeper, 00404 GatekeeperLostRegistration, 00405 InvalidListener, 00406 DuplicateAlias, 00407 SecurityDenied, 00408 TransportError, 00409 NumRegistrationFailReasons, 00410 RegistrationRejectReasonMask = 0x8000 00411 }; 00414 RegistrationFailReasons GetRegistrationFailReason() const { return registrationFailReason; } 00415 00424 PString GetName() const; 00425 00428 const PString & GetEndpointIdentifier() const { return endpointIdentifier; } 00429 00434 void SetPassword( 00435 const PString & password, 00436 const PString & username = PString() 00437 ); 00438 00439 /* 00440 * Return the call signalling address for the gatekeeper (if present) 00441 */ 00442 H323TransportAddress GetGatekeeperRouteAddress() const 00443 { return gkRouteAddress; } 00445 00446 00447 protected: 00448 BOOL StartDiscovery(const H323TransportAddress & address); 00449 unsigned SetupGatekeeperRequest(H323RasPDU & request); 00450 00451 void Connect(const H323TransportAddress & address, const PString & gatekeeperIdentifier); 00452 PDECLARE_NOTIFIER(PThread, H323Gatekeeper, MonitorMain); 00453 PDECLARE_NOTIFIER(PTimer, H323Gatekeeper, TickleMonitor); 00454 void RegistrationTimeToLive(); 00455 00456 void SetInfoRequestRate( 00457 const PTimeInterval & rate 00458 ); 00459 void ClearInfoRequestRate(); 00460 H225_InfoRequestResponse & BuildInfoRequestResponse( 00461 H323RasPDU & response, 00462 unsigned seqNum 00463 ); 00464 BOOL SendUnsolicitedIRR( 00465 H225_InfoRequestResponse & irr, 00466 H323RasPDU & response 00467 ); 00468 00469 void SetAlternates( 00470 const H225_ArrayOf_AlternateGK & alts, 00471 BOOL permanent 00472 ); 00473 00474 virtual BOOL MakeRequest( 00475 Request & request 00476 ); 00477 BOOL MakeRequestWithReregister( 00478 Request & request, 00479 unsigned unregisteredTag 00480 ); 00481 00482 00483 // Gatekeeper registration state variables 00484 BOOL discoveryComplete; 00485 PString endpointIdentifier; 00486 RegistrationFailReasons registrationFailReason; 00487 00488 class AlternateInfo : public PObject { 00489 PCLASSINFO(AlternateInfo, PObject); 00490 public: 00491 AlternateInfo(H225_AlternateGK & alt); 00492 ~AlternateInfo(); 00493 Comparison Compare(const PObject & obj); 00494 void PrintOn(ostream & strm) const; 00495 00496 H323TransportAddress rasAddress; 00497 PString gatekeeperIdentifier; 00498 unsigned priority; 00499 enum { 00500 NoRegistrationNeeded, 00501 NeedToRegister, 00502 Register, 00503 IsRegistered, 00504 RegistrationFailed 00505 } registrationState; 00506 00507 private: 00508 // Disable copy constructor and assignment 00509 AlternateInfo(const AlternateInfo &) { } 00510 AlternateInfo & operator=(const AlternateInfo &) { return *this; } 00511 }; 00512 PSortedList<AlternateInfo> alternates; 00513 BOOL alternatePermanent; 00514 PSemaphore requestMutex; 00515 H235Authenticators authenticators; 00516 00517 enum { 00518 RequireARQ, 00519 PregrantARQ, 00520 PreGkRoutedARQ 00521 } pregrantMakeCall, pregrantAnswerCall; 00522 H323TransportAddress gkRouteAddress; 00523 00524 // Gatekeeper operation variables 00525 BOOL autoReregister; 00526 BOOL reregisterNow; 00527 PTimer timeToLive; 00528 BOOL requiresDiscovery; 00529 PTimer infoRequestRate; 00530 BOOL willRespondToIRR; 00531 PThread * monitor; 00532 BOOL monitorStop; 00533 PSyncPoint monitorTickle; 00534 00535 PDictionary<POrdinalKey, H323ServiceControlSession> serviceControlSessions; 00536 }; 00537 00538 00539 PLIST(H323GatekeeperList, H323Gatekeeper); 00540 00541 00542 00543 #endif // __OPAL_GKCLIENT_H 00544 00545

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