00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
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
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
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
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
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