Utilise new MergeSym feature to no longer overwrite the source .DEF file when buildin...
[openh323.git] / src / h225ras.cxx
blobde4b925e02b9287f11465439c7d9bc4141e65ae6
1 /*
2 * H225_RAS.cxx
4 * H.225 RAS protocol handler
6 * Open H323 Library
8 * Copyright (c) 2001 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
18 * under the License.
20 * The Original Code is Open H323 Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Portions of this code were written with the assisance of funding from
25 * iFace In, http://www.iface.com
27 * Contributor(s): ______________________________________.
29 * $Log$
30 * Revision 1.60 2006/06/23 20:19:39 shorne
31 * More H460 support
33 * Revision 1.59 2006/05/30 11:14:56 hfriederich
34 * Switch from DISABLE_H460 to H323_H460
36 * Revision 1.58 2005/01/03 14:03:21 csoutheren
37 * Added new configure options and ability to disable/enable modules
39 * Revision 1.57 2005/01/03 06:25:55 csoutheren
40 * Added extensive support for disabling code modules at compile time
42 * Revision 1.56 2004/09/07 22:50:55 rjongbloed
43 * Changed usage of template function as MSVC6 will not compile it.
45 * Revision 1.55 2004/09/03 01:06:10 csoutheren
46 * Added initial hooks for H.460 GEF
47 * Thanks to Simon Horne and ISVO (Asia) Pte Ltd. for this contribution
49 * Revision 1.54 2003/04/09 03:08:10 robertj
50 * Fixed race condition in shutting down transactor (pure virtual call)
52 * Revision 1.53 2003/04/01 01:05:17 robertj
53 * Split service control handlers from H.225 RAS header.
55 * Revision 1.52 2003/03/26 00:46:28 robertj
56 * Had another go at making H323Transactor being able to be created
57 * without having a listener running.
59 * Revision 1.51 2003/03/21 05:25:47 robertj
60 * Added setting of remote port in UDP transport constructor.
62 * Revision 1.50 2003/03/20 01:51:11 robertj
63 * More abstraction of H.225 RAS and H.501 protocols transaction handling.
65 * Revision 1.49 2003/03/01 00:21:01 craigs
66 * Fixed spelling mistake!
68 * Revision 1.48 2003/02/21 05:25:45 craigs
69 * Abstracted out underlying transports for use with peerelements
71 * Revision 1.47 2003/02/10 04:18:55 robertj
72 * Made RAS read loop more robust.
74 * Revision 1.46 2003/02/01 13:31:21 robertj
75 * Changes to support CAT authentication in RAS.
77 * Revision 1.45 2002/12/18 06:24:52 robertj
78 * Improved logging around the RAS poll function, on timeouts etc
80 * Revision 1.44 2002/12/13 02:52:19 robertj
81 * Fixed failure to release mutex on call confirm/reject.
83 * Revision 1.43 2002/11/28 23:39:36 robertj
84 * Fixed race condition for if RAS reply arrives very VERY quickly after
85 * sending packet. Introduced in previous change.
87 * Revision 1.42 2002/11/28 04:41:48 robertj
88 * Added support for RAS ServiceControlIndication command.
90 * Revision 1.41 2002/11/28 02:13:28 robertj
91 * Fixed copy and paste errors.
93 * Revision 1.40 2002/11/28 02:10:26 robertj
94 * Changed order of function so OnSendXXX(pdu) can change the security
95 * credentials in descendant classes.
97 * Revision 1.39 2002/11/27 06:54:56 robertj
98 * Added Service Control Session management as per Annex K/H.323 via RAS
99 * only at this stage.
100 * Added H.248 ASN and very primitive infrastructure for linking into the
101 * Service Control Session management system.
102 * Added basic infrastructure for Annex K/H.323 HTTP transport system.
103 * Added Call Credit Service Control to display account balances.
105 * Revision 1.38 2002/11/21 22:26:20 robertj
106 * Changed promiscuous mode to be three way. Fixes race condition in gkserver
107 * which can cause crashes or more PDUs to be sent to the wrong place.
109 * Revision 1.37 2002/11/21 07:21:49 robertj
110 * Improvements to alternate gatekeeper client code, thanks Kevin Bouchard
112 * Revision 1.36 2002/11/11 08:13:40 robertj
113 * Fixed GNU warning
115 * Revision 1.35 2002/11/11 07:20:12 robertj
116 * Minor clean up of API for doing RAS requests suing authentication.
118 * Revision 1.34 2002/11/10 08:10:43 robertj
119 * Moved constants for "well known" ports to better place (OPAL change).
121 * Revision 1.33 2002/10/17 02:10:55 robertj
122 * Backed out previous change for including PDU tag, doesn't work!
124 * Revision 1.32 2002/10/16 03:46:05 robertj
125 * Added PDU tag to cache look up key.
127 * Revision 1.31 2002/10/09 05:38:50 robertj
128 * Fixed correct mutexing of response cache buffer.
129 * Fixed correct setting of remote address when cached response transmitted.
131 * Revision 1.30 2002/09/19 09:16:01 robertj
132 * Fixed problem with making (and assuring with multi-threading) IRQ and DRQ
133 * requests are sent to the correct endpoint address, thanks Martijn Roest.
135 * Revision 1.29 2002/08/29 06:58:37 robertj
136 * Fixed (again) cached response age timeout adjusted to RIP time.
138 * Revision 1.28 2002/08/12 06:29:42 robertj
139 * Fixed problem with cached responses being aged before the RIP time which
140 * made retries by client appear as "new" requests when they were not.
142 * Revision 1.27 2002/08/12 05:35:48 robertj
143 * Changes to the RAS subsystem to support ability to make requests to client
144 * from gkserver without causing bottlenecks and race conditions.
146 * Revision 1.26 2002/08/05 10:03:47 robertj
147 * Cosmetic changes to normalise the usage of pragma interface/implementation.
149 * Revision 1.25 2002/08/05 05:17:41 robertj
150 * Fairly major modifications to support different authentication credentials
151 * in ARQ to the logged in ones on RRQ. For both client and server.
152 * Various other H.235 authentication bugs and anomalies fixed on the way.
154 * Revision 1.24 2002/07/29 11:36:08 robertj
155 * Fixed race condition if RIP is followed very quickly by actual response.
157 * Revision 1.23 2002/07/16 04:18:38 robertj
158 * Fixed incorrect check for GRQ in reject processing, thanks Thien Nguyen
160 * Revision 1.22 2002/06/28 03:34:28 robertj
161 * Fixed issues with address translation on gatekeeper RAS channel.
163 * Revision 1.21 2002/06/24 00:11:21 robertj
164 * Clarified error message during GRQ authentication.
166 * Revision 1.20 2002/06/12 03:50:25 robertj
167 * Added PrintOn function for trace output of RAS channel.
169 * Revision 1.19 2002/05/29 00:03:19 robertj
170 * Fixed unsolicited IRR support in gk client and server,
171 * including support for IACK and INAK.
173 * Revision 1.18 2002/05/17 03:41:00 robertj
174 * Fixed problems with H.235 authentication on RAS for server and client.
176 * Revision 1.17 2002/05/03 09:18:49 robertj
177 * Added automatic retransmission of RAS responses to retried requests.
179 * Revision 1.16 2002/03/10 19:34:13 robertj
180 * Added random starting point for sequence numbers, thanks Chris Purvis
182 * Revision 1.15 2002/01/29 02:38:31 robertj
183 * Fixed nasty race condition when getting RIP, end up with wrong timeout.
184 * Improved tracing (included sequence numbers)
186 * Revision 1.14 2002/01/24 01:02:04 robertj
187 * Removed trace when authenticator not used, implied error when wasn't one.
189 * Revision 1.13 2001/10/09 12:03:30 robertj
190 * Fixed uninitialised variable for H.235 authentication checking.
192 * Revision 1.12 2001/10/09 08:04:59 robertj
193 * Fixed unregistration so still unregisters if gk goes offline, thanks Chris Purvis
195 * Revision 1.11 2001/09/18 10:36:57 robertj
196 * Allowed multiple overlapping requests in RAS channel.
198 * Revision 1.10 2001/09/12 07:48:05 robertj
199 * Fixed various problems with tracing.
201 * Revision 1.9 2001/09/12 03:12:38 robertj
202 * Added ability to disable the checking of RAS responses against
203 * security authenticators.
204 * Fixed bug in having multiple authentications if have a retry.
206 * Revision 1.8 2001/08/10 11:03:52 robertj
207 * Major changes to H.235 support in RAS to support server.
209 * Revision 1.7 2001/08/06 07:44:55 robertj
210 * Fixed problems with building without SSL
212 * Revision 1.6 2001/08/06 03:18:38 robertj
213 * Fission of h323.h to h323ep.h & h323con.h, h323.h now just includes files.
214 * Improved access to H.235 secure RAS functionality.
215 * Changes to H.323 secure RAS contexts to help use with gk server.
217 * Revision 1.5 2001/08/03 05:56:04 robertj
218 * Fixed RAS read of UDP when get ICMP error for host unreachabe.
220 * Revision 1.4 2001/06/25 01:06:40 robertj
221 * Fixed resolution of RAS timeout so not rounded down to second.
223 * Revision 1.3 2001/06/22 00:21:10 robertj
224 * Fixed bug in H.225 RAS protocol with 16 versus 32 bit sequence numbers.
226 * Revision 1.2 2001/06/18 07:44:21 craigs
227 * Made to compile with h225ras.cxx under Linux
229 * Revision 1.1 2001/06/18 06:23:50 robertj
230 * Split raw H.225 RAS protocol out of gatekeeper client class.
234 #include <ptlib.h>
236 #ifdef __GNUC__
237 #pragma implementation "h225ras.h"
238 #endif
240 #include "h323.h"
242 #include "h225ras.h"
244 #include "h323ep.h"
245 #include "h323pdu.h"
246 #include "h235auth.h"
248 #ifdef H323_H460
249 #include "h460.h"
250 #endif
252 #define new PNEW
255 /////////////////////////////////////////////////////////////////////////////
257 H225_RAS::H225_RAS(H323EndPoint & ep, H323Transport * trans)
258 : H323Transactor(ep, trans, DefaultRasUdpPort, DefaultRasUdpPort)
263 H225_RAS::~H225_RAS()
265 StopChannel();
269 void H225_RAS::PrintOn(ostream & strm) const
271 if (gatekeeperIdentifier.IsEmpty())
272 strm << "H225-RAS@";
273 else
274 strm << gatekeeperIdentifier << '@';
275 H323Transactor::PrintOn(strm);
279 H323TransactionPDU * H225_RAS::CreateTransactionPDU() const
281 return new H323RasPDU;
285 BOOL H225_RAS::HandleTransaction(const PASN_Object & rawPDU)
287 const H323RasPDU & pdu = (const H323RasPDU &)rawPDU;
289 switch (pdu.GetTag()) {
290 case H225_RasMessage::e_gatekeeperRequest :
291 if (SendCachedResponse(pdu))
292 return FALSE;
293 OnReceiveGatekeeperRequest(pdu, pdu);
294 break;
296 case H225_RasMessage::e_gatekeeperConfirm :
297 return OnReceiveGatekeeperConfirm(pdu, pdu);
299 case H225_RasMessage::e_gatekeeperReject :
300 return OnReceiveGatekeeperReject(pdu, pdu);
302 case H225_RasMessage::e_registrationRequest :
303 if (SendCachedResponse(pdu))
304 return FALSE;
305 OnReceiveRegistrationRequest(pdu, pdu);
306 break;
308 case H225_RasMessage::e_registrationConfirm :
309 return OnReceiveRegistrationConfirm(pdu, pdu);
311 case H225_RasMessage::e_registrationReject :
312 return OnReceiveRegistrationReject(pdu, pdu);
314 case H225_RasMessage::e_unregistrationRequest :
315 if (SendCachedResponse(pdu))
316 return FALSE;
317 OnReceiveUnregistrationRequest(pdu, pdu);
318 break;
320 case H225_RasMessage::e_unregistrationConfirm :
321 return OnReceiveUnregistrationConfirm(pdu, pdu);
323 case H225_RasMessage::e_unregistrationReject :
324 return OnReceiveUnregistrationReject(pdu, pdu);
326 case H225_RasMessage::e_admissionRequest :
327 if (SendCachedResponse(pdu))
328 return FALSE;
329 OnReceiveAdmissionRequest(pdu, pdu);
330 break;
332 case H225_RasMessage::e_admissionConfirm :
333 return OnReceiveAdmissionConfirm(pdu, pdu);
335 case H225_RasMessage::e_admissionReject :
336 return OnReceiveAdmissionReject(pdu, pdu);
338 case H225_RasMessage::e_bandwidthRequest :
339 if (SendCachedResponse(pdu))
340 return FALSE;
341 OnReceiveBandwidthRequest(pdu, pdu);
342 break;
344 case H225_RasMessage::e_bandwidthConfirm :
345 return OnReceiveBandwidthConfirm(pdu, pdu);
347 case H225_RasMessage::e_bandwidthReject :
348 return OnReceiveBandwidthReject(pdu, pdu);
350 case H225_RasMessage::e_disengageRequest :
351 if (SendCachedResponse(pdu))
352 return FALSE;
353 OnReceiveDisengageRequest(pdu, pdu);
354 break;
356 case H225_RasMessage::e_disengageConfirm :
357 return OnReceiveDisengageConfirm(pdu, pdu);
359 case H225_RasMessage::e_disengageReject :
360 return OnReceiveDisengageReject(pdu, pdu);
362 case H225_RasMessage::e_locationRequest :
363 if (SendCachedResponse(pdu))
364 return FALSE;
365 OnReceiveLocationRequest(pdu, pdu);
366 break;
368 case H225_RasMessage::e_locationConfirm :
369 return OnReceiveLocationConfirm(pdu, pdu);
371 case H225_RasMessage::e_locationReject :
372 return OnReceiveLocationReject(pdu, pdu);
374 case H225_RasMessage::e_infoRequest :
375 if (SendCachedResponse(pdu))
376 return FALSE;
377 OnReceiveInfoRequest(pdu, pdu);
378 break;
380 case H225_RasMessage::e_infoRequestResponse :
381 return OnReceiveInfoRequestResponse(pdu, pdu);
383 case H225_RasMessage::e_nonStandardMessage :
384 OnReceiveNonStandardMessage(pdu, pdu);
385 break;
387 case H225_RasMessage::e_unknownMessageResponse :
388 OnReceiveUnknownMessageResponse(pdu, pdu);
389 break;
391 case H225_RasMessage::e_requestInProgress :
392 return OnReceiveRequestInProgress(pdu, pdu);
394 case H225_RasMessage::e_resourcesAvailableIndicate :
395 if (SendCachedResponse(pdu))
396 return FALSE;
397 OnReceiveResourcesAvailableIndicate(pdu, pdu);
398 break;
400 case H225_RasMessage::e_resourcesAvailableConfirm :
401 return OnReceiveResourcesAvailableConfirm(pdu, pdu);
403 case H225_RasMessage::e_infoRequestAck :
404 return OnReceiveInfoRequestAck(pdu, pdu);
406 case H225_RasMessage::e_infoRequestNak :
407 return OnReceiveInfoRequestNak(pdu, pdu);
409 #ifdef H323_H248
410 case H225_RasMessage::e_serviceControlIndication :
411 if (SendCachedResponse(pdu))
412 return FALSE;
413 OnReceiveServiceControlIndication(pdu, pdu);
414 break;
416 case H225_RasMessage::e_serviceControlResponse :
417 return OnReceiveServiceControlResponse(pdu, pdu);
418 #endif
420 default :
421 OnReceiveUnknown(pdu);
424 return FALSE;
428 void H225_RAS::OnSendingPDU(PASN_Object & rawPDU)
430 H323RasPDU & pdu = (H323RasPDU &)rawPDU;
432 switch (pdu.GetTag()) {
433 case H225_RasMessage::e_gatekeeperRequest :
434 OnSendGatekeeperRequest(pdu, pdu);
435 break;
437 case H225_RasMessage::e_gatekeeperConfirm :
438 OnSendGatekeeperConfirm(pdu, pdu);
439 break;
441 case H225_RasMessage::e_gatekeeperReject :
442 OnSendGatekeeperReject(pdu, pdu);
443 break;
445 case H225_RasMessage::e_registrationRequest :
446 OnSendRegistrationRequest(pdu, pdu);
447 break;
449 case H225_RasMessage::e_registrationConfirm :
450 OnSendRegistrationConfirm(pdu, pdu);
451 break;
453 case H225_RasMessage::e_registrationReject :
454 OnSendRegistrationReject(pdu, pdu);
455 break;
457 case H225_RasMessage::e_unregistrationRequest :
458 OnSendUnregistrationRequest(pdu, pdu);
459 break;
461 case H225_RasMessage::e_unregistrationConfirm :
462 OnSendUnregistrationConfirm(pdu, pdu);
463 break;
465 case H225_RasMessage::e_unregistrationReject :
466 OnSendUnregistrationReject(pdu, pdu);
467 break;
469 case H225_RasMessage::e_admissionRequest :
470 OnSendAdmissionRequest(pdu, pdu);
471 break;
473 case H225_RasMessage::e_admissionConfirm :
474 OnSendAdmissionConfirm(pdu, pdu);
475 break;
477 case H225_RasMessage::e_admissionReject :
478 OnSendAdmissionReject(pdu, pdu);
479 break;
481 case H225_RasMessage::e_bandwidthRequest :
482 OnSendBandwidthRequest(pdu, pdu);
483 break;
485 case H225_RasMessage::e_bandwidthConfirm :
486 OnSendBandwidthConfirm(pdu, pdu);
487 break;
489 case H225_RasMessage::e_bandwidthReject :
490 OnSendBandwidthReject(pdu, pdu);
491 break;
493 case H225_RasMessage::e_disengageRequest :
494 OnSendDisengageRequest(pdu, pdu);
495 break;
497 case H225_RasMessage::e_disengageConfirm :
498 OnSendDisengageConfirm(pdu, pdu);
499 break;
501 case H225_RasMessage::e_disengageReject :
502 OnSendDisengageReject(pdu, pdu);
503 break;
505 case H225_RasMessage::e_locationRequest :
506 OnSendLocationRequest(pdu, pdu);
507 break;
509 case H225_RasMessage::e_locationConfirm :
510 OnSendLocationConfirm(pdu, pdu);
511 break;
513 case H225_RasMessage::e_locationReject :
514 OnSendLocationReject(pdu, pdu);
515 break;
517 case H225_RasMessage::e_infoRequest :
518 OnSendInfoRequest(pdu, pdu);
519 break;
521 case H225_RasMessage::e_infoRequestResponse :
522 OnSendInfoRequestResponse(pdu, pdu);
523 break;
525 case H225_RasMessage::e_nonStandardMessage :
526 OnSendNonStandardMessage(pdu, pdu);
527 break;
529 case H225_RasMessage::e_unknownMessageResponse :
530 OnSendUnknownMessageResponse(pdu, pdu);
531 break;
533 case H225_RasMessage::e_requestInProgress :
534 OnSendRequestInProgress(pdu, pdu);
535 break;
537 case H225_RasMessage::e_resourcesAvailableIndicate :
538 OnSendResourcesAvailableIndicate(pdu, pdu);
539 break;
541 case H225_RasMessage::e_resourcesAvailableConfirm :
542 OnSendResourcesAvailableConfirm(pdu, pdu);
543 break;
545 case H225_RasMessage::e_infoRequestAck :
546 OnSendInfoRequestAck(pdu, pdu);
547 break;
549 case H225_RasMessage::e_infoRequestNak :
550 OnSendInfoRequestNak(pdu, pdu);
551 break;
553 #ifdef H323_H248
554 case H225_RasMessage::e_serviceControlIndication :
555 OnSendServiceControlIndication(pdu, pdu);
556 break;
558 case H225_RasMessage::e_serviceControlResponse :
559 OnSendServiceControlResponse(pdu, pdu);
560 break;
561 #endif
563 default :
564 break;
569 BOOL H225_RAS::OnReceiveRequestInProgress(const H323RasPDU & pdu, const H225_RequestInProgress & rip)
571 if (!HandleRequestInProgress(pdu, rip.m_delay))
572 return FALSE;
574 return OnReceiveRequestInProgress(rip);
578 BOOL H225_RAS::OnReceiveRequestInProgress(const H225_RequestInProgress & /*rip*/)
580 return TRUE;
584 template <typename PDUType>
585 static void SendFeatureSet(const H225_RAS * ras, unsigned code, PDUType & pdu)
588 H225_FeatureSet fs;
589 if (!ras->OnSendFeatureSet(code,fs))
590 return;
592 switch (code) {
593 case H460_MessageType::e_gatekeeperRequest:
594 case H460_MessageType::e_gatekeeperConfirm:
595 case H460_MessageType::e_gatekeeperReject:
596 case H460_MessageType::e_registrationRequest:
597 case H460_MessageType::e_registrationConfirm:
598 case H460_MessageType::e_registrationReject:
599 case H460_MessageType::e_setup:
600 case H460_MessageType::e_callProceeding:
601 pdu.IncludeOptionalField(PDUType::e_featureSet);
602 pdu.m_featureSet = fs;
603 break;
604 default:
605 if (fs.HasOptionalField(H225_FeatureSet::e_supportedFeatures)) {
606 pdu.IncludeOptionalField(PDUType::e_genericData);
608 H225_ArrayOf_FeatureDescriptor & fsn = fs.m_supportedFeatures;
609 H225_ArrayOf_GenericData & data = pdu.m_genericData;
611 for (PINDEX i=0; i < fsn.GetSize(); i++) {
612 PINDEX lastPos = data.GetSize();
613 data.SetSize(lastPos+1);
614 data[lastPos] = fsn[i];
617 break;
622 void H225_RAS::OnSendGatekeeperRequest(H323RasPDU &, H225_GatekeeperRequest & grq)
624 if (!gatekeeperIdentifier) {
625 grq.IncludeOptionalField(H225_GatekeeperRequest::e_gatekeeperIdentifier);
626 grq.m_gatekeeperIdentifier = gatekeeperIdentifier;
629 #ifdef H323_H460
630 SendFeatureSet<H225_GatekeeperRequest>(this, H460_MessageType::e_gatekeeperRequest, grq);
631 #endif
633 OnSendGatekeeperRequest(grq);
637 void H225_RAS::OnSendGatekeeperRequest(H225_GatekeeperRequest & /*grq*/)
642 void H225_RAS::OnSendGatekeeperConfirm(H323RasPDU &, H225_GatekeeperConfirm & gcf)
644 if (!gatekeeperIdentifier) {
645 gcf.IncludeOptionalField(H225_GatekeeperConfirm::e_gatekeeperIdentifier);
646 gcf.m_gatekeeperIdentifier = gatekeeperIdentifier;
649 #ifdef H323_H460
650 SendFeatureSet<H225_GatekeeperConfirm>(this, H460_MessageType::e_gatekeeperConfirm, gcf);
651 #endif
653 OnSendGatekeeperConfirm(gcf);
657 void H225_RAS::OnSendGatekeeperConfirm(H225_GatekeeperConfirm & /*gcf*/)
662 void H225_RAS::OnSendGatekeeperReject(H323RasPDU &, H225_GatekeeperReject & grj)
664 if (!gatekeeperIdentifier) {
665 grj.IncludeOptionalField(H225_GatekeeperReject::e_gatekeeperIdentifier);
666 grj.m_gatekeeperIdentifier = gatekeeperIdentifier;
669 #ifdef H323_H460
670 SendFeatureSet<H225_GatekeeperReject>(this, H460_MessageType::e_gatekeeperReject, grj);
671 #endif
673 OnSendGatekeeperReject(grj);
677 void H225_RAS::OnSendGatekeeperReject(H225_GatekeeperReject & /*grj*/)
682 template <typename PDUType>
683 static void ReceiveFeatureSet(const H225_RAS * ras, unsigned code, const PDUType & pdu)
685 if (pdu.HasOptionalField(PDUType::e_featureSet))
686 ras->OnReceiveFeatureSet(code, pdu.m_featureSet);
688 if (pdu.HasOptionalField(PDUType::e_genericData)) {
689 H225_FeatureSet fs;
690 fs.IncludeOptionalField(H225_FeatureSet::e_supportedFeatures);
691 H225_ArrayOf_FeatureDescriptor & fsn = fs.m_supportedFeatures;
692 const H225_ArrayOf_GenericData & data = pdu.m_genericData;
693 for (PINDEX i=0; i < data.GetSize(); i++) {
694 PINDEX lastPos = fsn.GetSize();
695 fsn.SetSize(lastPos+1);
696 fsn[lastPos] = (H225_FeatureDescriptor &)data[i];
698 ras->OnReceiveFeatureSet(code, fs);
703 BOOL H225_RAS::OnReceiveGatekeeperRequest(const H323RasPDU &, const H225_GatekeeperRequest & grq)
705 #ifdef H323_H460
706 ReceiveFeatureSet<H225_GatekeeperRequest>(this, H460_MessageType::e_gatekeeperRequest, grq);
707 #endif
709 return OnReceiveGatekeeperRequest(grq);
713 BOOL H225_RAS::OnReceiveGatekeeperRequest(const H225_GatekeeperRequest &)
715 return TRUE;
719 BOOL H225_RAS::OnReceiveGatekeeperConfirm(const H323RasPDU &, const H225_GatekeeperConfirm & gcf)
721 if (!CheckForResponse(H225_RasMessage::e_gatekeeperRequest, gcf.m_requestSeqNum))
722 return FALSE;
724 if (gatekeeperIdentifier.IsEmpty())
725 gatekeeperIdentifier = gcf.m_gatekeeperIdentifier;
726 else {
727 PString gkid = gcf.m_gatekeeperIdentifier;
728 if (gatekeeperIdentifier *= gkid)
729 gatekeeperIdentifier = gkid;
730 else {
731 PTRACE(2, "RAS\tReceived a GCF from " << gkid
732 << " but wanted it from " << gatekeeperIdentifier);
733 return FALSE;
737 #ifdef H323_H460
738 ReceiveFeatureSet<H225_GatekeeperConfirm>(this, H460_MessageType::e_gatekeeperConfirm, gcf);
739 #endif
741 return OnReceiveGatekeeperConfirm(gcf);
745 BOOL H225_RAS::OnReceiveGatekeeperConfirm(const H225_GatekeeperConfirm & /*gcf*/)
747 return TRUE;
751 BOOL H225_RAS::OnReceiveGatekeeperReject(const H323RasPDU &, const H225_GatekeeperReject & grj)
753 if (!CheckForResponse(H225_RasMessage::e_gatekeeperRequest, grj.m_requestSeqNum, &grj.m_rejectReason))
754 return FALSE;
756 #ifdef H323_H460
757 ReceiveFeatureSet<H225_GatekeeperReject>(this, H460_MessageType::e_gatekeeperReject, grj);
758 #endif
760 return OnReceiveGatekeeperReject(grj);
764 BOOL H225_RAS::OnReceiveGatekeeperReject(const H225_GatekeeperReject & /*grj*/)
766 return TRUE;
770 void H225_RAS::OnSendRegistrationRequest(H323RasPDU & pdu, H225_RegistrationRequest & rrq)
772 OnSendRegistrationRequest(rrq);
774 #ifdef H323_H460
775 SendFeatureSet<H225_RegistrationRequest>(this, H460_MessageType::e_registrationRequest, rrq);
776 #endif
778 pdu.Prepare(rrq.m_tokens, H225_RegistrationRequest::e_tokens,
779 rrq.m_cryptoTokens, H225_RegistrationRequest::e_cryptoTokens);
784 void H225_RAS::OnSendRegistrationRequest(H225_RegistrationRequest & /*rrq*/)
789 void H225_RAS::OnSendRegistrationConfirm(H323RasPDU & pdu, H225_RegistrationConfirm & rcf)
791 if (!gatekeeperIdentifier) {
792 rcf.IncludeOptionalField(H225_RegistrationConfirm::e_gatekeeperIdentifier);
793 rcf.m_gatekeeperIdentifier = gatekeeperIdentifier;
796 OnSendRegistrationConfirm(rcf);
798 #ifdef H323_H460
799 SendFeatureSet<H225_RegistrationConfirm>(this, H460_MessageType::e_registrationConfirm, rcf);
800 #endif
802 pdu.Prepare(rcf.m_tokens, H225_RegistrationConfirm::e_tokens,
803 rcf.m_cryptoTokens, H225_RegistrationConfirm::e_cryptoTokens);
808 void H225_RAS::OnSendRegistrationConfirm(H225_RegistrationConfirm & /*rcf*/)
813 void H225_RAS::OnSendRegistrationReject(H323RasPDU & pdu, H225_RegistrationReject & rrj)
815 if (!gatekeeperIdentifier) {
816 rrj.IncludeOptionalField(H225_RegistrationReject::e_gatekeeperIdentifier);
817 rrj.m_gatekeeperIdentifier = gatekeeperIdentifier;
820 OnSendRegistrationReject(rrj);
822 #ifdef H323_H460
823 SendFeatureSet<H225_RegistrationReject>(this, H460_MessageType::e_registrationReject, rrj);
824 #endif
826 pdu.Prepare(rrj.m_tokens, H225_RegistrationReject::e_tokens,
827 rrj.m_cryptoTokens, H225_RegistrationReject::e_cryptoTokens);
831 void H225_RAS::OnSendRegistrationReject(H225_RegistrationReject & /*rrj*/)
836 BOOL H225_RAS::OnReceiveRegistrationRequest(const H323RasPDU &, const H225_RegistrationRequest & rrq)
838 #ifdef H323_H460
839 ReceiveFeatureSet<H225_RegistrationRequest>(this, H460_MessageType::e_registrationRequest, rrq);
840 #endif
842 return OnReceiveRegistrationRequest(rrq);
846 BOOL H225_RAS::OnReceiveRegistrationRequest(const H225_RegistrationRequest &)
848 return TRUE;
852 BOOL H225_RAS::OnReceiveRegistrationConfirm(const H323RasPDU & pdu, const H225_RegistrationConfirm & rcf)
854 if (!CheckForResponse(H225_RasMessage::e_registrationRequest, rcf.m_requestSeqNum))
855 return FALSE;
857 if (lastRequest != NULL) {
858 PString endpointIdentifier = rcf.m_endpointIdentifier;
859 const H235Authenticators & authenticators = lastRequest->requestPDU.GetAuthenticators();
860 for (PINDEX i = 0; i < authenticators.GetSize(); i++) {
861 H235Authenticator & authenticator = authenticators[i];
862 if (authenticator.UseGkAndEpIdentifiers())
863 authenticator.SetLocalId(endpointIdentifier);
867 if (!CheckCryptoTokens(pdu,
868 rcf.m_tokens, H225_RegistrationConfirm::e_tokens,
869 rcf.m_cryptoTokens, H225_RegistrationConfirm::e_cryptoTokens))
870 return FALSE;
872 #ifdef H323_H460
873 ReceiveFeatureSet<H225_RegistrationConfirm>(this, H460_MessageType::e_registrationConfirm, rcf);
874 #endif
876 return OnReceiveRegistrationConfirm(rcf);
880 BOOL H225_RAS::OnReceiveRegistrationConfirm(const H225_RegistrationConfirm & /*rcf*/)
882 return TRUE;
886 BOOL H225_RAS::OnReceiveRegistrationReject(const H323RasPDU & pdu, const H225_RegistrationReject & rrj)
888 if (!CheckForResponse(H225_RasMessage::e_registrationRequest, rrj.m_requestSeqNum, &rrj.m_rejectReason))
889 return FALSE;
891 if (!CheckCryptoTokens(pdu,
892 rrj.m_tokens, H225_RegistrationReject::e_tokens,
893 rrj.m_cryptoTokens, H225_RegistrationReject::e_cryptoTokens))
894 return FALSE;
896 #ifdef H323_H460
897 ReceiveFeatureSet<H225_RegistrationReject>(this, H460_MessageType::e_registrationReject, rrj);
898 #endif
900 return OnReceiveRegistrationReject(rrj);
904 BOOL H225_RAS::OnReceiveRegistrationReject(const H225_RegistrationReject & /*rrj*/)
906 return TRUE;
910 void H225_RAS::OnSendUnregistrationRequest(H323RasPDU & pdu, H225_UnregistrationRequest & urq)
912 OnSendUnregistrationRequest(urq);
913 pdu.Prepare(urq.m_tokens, H225_UnregistrationRequest::e_tokens,
914 urq.m_cryptoTokens, H225_UnregistrationRequest::e_cryptoTokens);
918 void H225_RAS::OnSendUnregistrationRequest(H225_UnregistrationRequest & /*urq*/)
923 void H225_RAS::OnSendUnregistrationConfirm(H323RasPDU & pdu, H225_UnregistrationConfirm & ucf)
925 OnSendUnregistrationConfirm(ucf);
926 pdu.Prepare(ucf.m_tokens, H225_UnregistrationConfirm::e_tokens,
927 ucf.m_cryptoTokens, H225_UnregistrationConfirm::e_cryptoTokens);
931 void H225_RAS::OnSendUnregistrationConfirm(H225_UnregistrationConfirm & /*ucf*/)
936 void H225_RAS::OnSendUnregistrationReject(H323RasPDU & pdu, H225_UnregistrationReject & urj)
938 OnSendUnregistrationReject(urj);
939 pdu.Prepare(urj.m_tokens, H225_UnregistrationReject::e_tokens,
940 urj.m_cryptoTokens, H225_UnregistrationReject::e_cryptoTokens);
944 void H225_RAS::OnSendUnregistrationReject(H225_UnregistrationReject & /*urj*/)
949 BOOL H225_RAS::OnReceiveUnregistrationRequest(const H323RasPDU & pdu, const H225_UnregistrationRequest & urq)
951 if (!CheckCryptoTokens(pdu,
952 urq.m_tokens, H225_UnregistrationRequest::e_tokens,
953 urq.m_cryptoTokens, H225_UnregistrationRequest::e_cryptoTokens))
954 return FALSE;
956 return OnReceiveUnregistrationRequest(urq);
960 BOOL H225_RAS::OnReceiveUnregistrationRequest(const H225_UnregistrationRequest & /*urq*/)
962 return TRUE;
966 BOOL H225_RAS::OnReceiveUnregistrationConfirm(const H323RasPDU & pdu, const H225_UnregistrationConfirm & ucf)
968 if (!CheckForResponse(H225_RasMessage::e_unregistrationRequest, ucf.m_requestSeqNum))
969 return FALSE;
971 if (!CheckCryptoTokens(pdu,
972 ucf.m_tokens, H225_UnregistrationConfirm::e_tokens,
973 ucf.m_cryptoTokens, H225_UnregistrationConfirm::e_cryptoTokens))
974 return FALSE;
976 return OnReceiveUnregistrationConfirm(ucf);
980 BOOL H225_RAS::OnReceiveUnregistrationConfirm(const H225_UnregistrationConfirm & /*ucf*/)
982 return TRUE;
986 BOOL H225_RAS::OnReceiveUnregistrationReject(const H323RasPDU & pdu, const H225_UnregistrationReject & urj)
988 if (!CheckForResponse(H225_RasMessage::e_unregistrationRequest, urj.m_requestSeqNum, &urj.m_rejectReason))
989 return FALSE;
991 if (!CheckCryptoTokens(pdu,
992 urj.m_tokens, H225_UnregistrationReject::e_tokens,
993 urj.m_cryptoTokens, H225_UnregistrationReject::e_cryptoTokens))
994 return FALSE;
996 return OnReceiveUnregistrationReject(urj);
1000 BOOL H225_RAS::OnReceiveUnregistrationReject(const H225_UnregistrationReject & /*urj*/)
1002 return TRUE;
1006 void H225_RAS::OnSendAdmissionRequest(H323RasPDU & pdu, H225_AdmissionRequest & arq)
1008 OnSendAdmissionRequest(arq);
1010 #ifdef H323_H460
1011 SendFeatureSet<H225_AdmissionRequest>(this, H460_MessageType::e_admissionRequest, arq);
1012 #endif
1014 pdu.Prepare(arq.m_tokens, H225_AdmissionRequest::e_tokens,
1015 arq.m_cryptoTokens, H225_AdmissionRequest::e_cryptoTokens);
1019 void H225_RAS::OnSendAdmissionRequest(H225_AdmissionRequest & /*arq*/)
1024 void H225_RAS::OnSendAdmissionConfirm(H323RasPDU & pdu, H225_AdmissionConfirm & acf)
1026 OnSendAdmissionConfirm(acf);
1028 #ifdef H323_H460
1029 SendFeatureSet<H225_AdmissionConfirm>(this, H460_MessageType::e_admissionConfirm, acf);
1030 #endif
1032 pdu.Prepare(acf.m_tokens, H225_AdmissionConfirm::e_tokens,
1033 acf.m_cryptoTokens, H225_AdmissionConfirm::e_cryptoTokens);
1037 void H225_RAS::OnSendAdmissionConfirm(H225_AdmissionConfirm & /*acf*/)
1042 void H225_RAS::OnSendAdmissionReject(H323RasPDU & pdu, H225_AdmissionReject & arj)
1044 OnSendAdmissionReject(arj);
1046 #ifdef H323_H460
1047 SendFeatureSet<H225_AdmissionReject>(this, H460_MessageType::e_admissionReject, arj);
1048 #endif
1050 pdu.Prepare(arj.m_tokens, H225_AdmissionReject::e_tokens,
1051 arj.m_cryptoTokens, H225_AdmissionReject::e_cryptoTokens);
1055 void H225_RAS::OnSendAdmissionReject(H225_AdmissionReject & /*arj*/)
1060 BOOL H225_RAS::OnReceiveAdmissionRequest(const H323RasPDU & pdu, const H225_AdmissionRequest & arq)
1062 if (!CheckCryptoTokens(pdu,
1063 arq.m_tokens, H225_AdmissionRequest::e_tokens,
1064 arq.m_cryptoTokens, H225_AdmissionRequest::e_cryptoTokens))
1065 return FALSE;
1067 #ifdef H323_H460
1068 ReceiveFeatureSet<H225_AdmissionRequest>(this, H460_MessageType::e_admissionRequest, arq);
1069 #endif
1071 return OnReceiveAdmissionRequest(arq);
1075 BOOL H225_RAS::OnReceiveAdmissionRequest(const H225_AdmissionRequest & /*arq*/)
1077 return TRUE;
1081 BOOL H225_RAS::OnReceiveAdmissionConfirm(const H323RasPDU & pdu, const H225_AdmissionConfirm & acf)
1083 if (!CheckForResponse(H225_RasMessage::e_admissionRequest, acf.m_requestSeqNum))
1084 return FALSE;
1086 if (!CheckCryptoTokens(pdu,
1087 acf.m_tokens, H225_AdmissionConfirm::e_tokens,
1088 acf.m_cryptoTokens, H225_AdmissionConfirm::e_cryptoTokens))
1089 return FALSE;
1091 #ifdef H323_H460
1092 ReceiveFeatureSet<H225_AdmissionConfirm>(this, H460_MessageType::e_admissionConfirm, acf);
1093 #endif
1095 return OnReceiveAdmissionConfirm(acf);
1099 BOOL H225_RAS::OnReceiveAdmissionConfirm(const H225_AdmissionConfirm & /*acf*/)
1101 return TRUE;
1105 BOOL H225_RAS::OnReceiveAdmissionReject(const H323RasPDU & pdu, const H225_AdmissionReject & arj)
1107 if (!CheckForResponse(H225_RasMessage::e_admissionRequest, arj.m_requestSeqNum, &arj.m_rejectReason))
1108 return FALSE;
1110 if (!CheckCryptoTokens(pdu,
1111 arj.m_tokens, H225_AdmissionReject::e_tokens,
1112 arj.m_cryptoTokens, H225_AdmissionReject::e_cryptoTokens))
1113 return FALSE;
1115 #ifdef H323_H460
1116 ReceiveFeatureSet<H225_AdmissionReject>(this, H460_MessageType::e_admissionReject, arj);
1117 #endif
1119 return OnReceiveAdmissionReject(arj);
1123 BOOL H225_RAS::OnReceiveAdmissionReject(const H225_AdmissionReject & /*arj*/)
1125 return TRUE;
1129 void H225_RAS::OnSendBandwidthRequest(H323RasPDU & pdu, H225_BandwidthRequest & brq)
1131 OnSendBandwidthRequest(brq);
1132 pdu.Prepare(brq.m_tokens, H225_BandwidthRequest::e_tokens,
1133 brq.m_cryptoTokens, H225_BandwidthRequest::e_cryptoTokens);
1137 void H225_RAS::OnSendBandwidthRequest(H225_BandwidthRequest & /*brq*/)
1142 BOOL H225_RAS::OnReceiveBandwidthRequest(const H323RasPDU & pdu, const H225_BandwidthRequest & brq)
1144 if (!CheckCryptoTokens(pdu,
1145 brq.m_tokens, H225_BandwidthRequest::e_tokens,
1146 brq.m_cryptoTokens, H225_BandwidthRequest::e_cryptoTokens))
1147 return FALSE;
1149 return OnReceiveBandwidthRequest(brq);
1153 BOOL H225_RAS::OnReceiveBandwidthRequest(const H225_BandwidthRequest & /*brq*/)
1155 return TRUE;
1159 void H225_RAS::OnSendBandwidthConfirm(H323RasPDU & pdu, H225_BandwidthConfirm & bcf)
1161 OnSendBandwidthConfirm(bcf);
1162 pdu.Prepare(bcf.m_tokens, H225_BandwidthConfirm::e_tokens,
1163 bcf.m_cryptoTokens, H225_BandwidthConfirm::e_cryptoTokens);
1167 void H225_RAS::OnSendBandwidthConfirm(H225_BandwidthConfirm & /*bcf*/)
1172 BOOL H225_RAS::OnReceiveBandwidthConfirm(const H323RasPDU & pdu, const H225_BandwidthConfirm & bcf)
1174 if (!CheckForResponse(H225_RasMessage::e_bandwidthRequest, bcf.m_requestSeqNum))
1175 return FALSE;
1177 if (!CheckCryptoTokens(pdu,
1178 bcf.m_tokens, H225_BandwidthConfirm::e_tokens,
1179 bcf.m_cryptoTokens, H225_BandwidthConfirm::e_cryptoTokens))
1180 return FALSE;
1182 return OnReceiveBandwidthConfirm(bcf);
1186 BOOL H225_RAS::OnReceiveBandwidthConfirm(const H225_BandwidthConfirm & /*bcf*/)
1188 return TRUE;
1192 void H225_RAS::OnSendBandwidthReject(H323RasPDU & pdu, H225_BandwidthReject & brj)
1194 OnSendBandwidthReject(brj);
1195 pdu.Prepare(brj.m_tokens, H225_BandwidthReject::e_tokens,
1196 brj.m_cryptoTokens, H225_BandwidthReject::e_cryptoTokens);
1200 void H225_RAS::OnSendBandwidthReject(H225_BandwidthReject & /*brj*/)
1205 BOOL H225_RAS::OnReceiveBandwidthReject(const H323RasPDU & pdu, const H225_BandwidthReject & brj)
1207 if (!CheckForResponse(H225_RasMessage::e_bandwidthRequest, brj.m_requestSeqNum, &brj.m_rejectReason))
1208 return FALSE;
1210 if (!CheckCryptoTokens(pdu,
1211 brj.m_tokens, H225_BandwidthReject::e_tokens,
1212 brj.m_cryptoTokens, H225_BandwidthReject::e_cryptoTokens))
1213 return FALSE;
1215 return OnReceiveBandwidthReject(brj);
1219 BOOL H225_RAS::OnReceiveBandwidthReject(const H225_BandwidthReject & /*brj*/)
1221 return TRUE;
1225 void H225_RAS::OnSendDisengageRequest(H323RasPDU & pdu, H225_DisengageRequest & drq)
1227 OnSendDisengageRequest(drq);
1228 pdu.Prepare(drq.m_tokens, H225_DisengageRequest::e_tokens,
1229 drq.m_cryptoTokens, H225_DisengageRequest::e_cryptoTokens);
1233 void H225_RAS::OnSendDisengageRequest(H225_DisengageRequest & /*drq*/)
1238 BOOL H225_RAS::OnReceiveDisengageRequest(const H323RasPDU & pdu, const H225_DisengageRequest & drq)
1240 if (!CheckCryptoTokens(pdu,
1241 drq.m_tokens, H225_DisengageRequest::e_tokens,
1242 drq.m_cryptoTokens, H225_DisengageRequest::e_cryptoTokens))
1243 return FALSE;
1245 return OnReceiveDisengageRequest(drq);
1249 BOOL H225_RAS::OnReceiveDisengageRequest(const H225_DisengageRequest & /*drq*/)
1251 return TRUE;
1255 void H225_RAS::OnSendDisengageConfirm(H323RasPDU & pdu, H225_DisengageConfirm & dcf)
1257 OnSendDisengageConfirm(dcf);
1258 pdu.Prepare(dcf.m_tokens, H225_DisengageConfirm::e_tokens,
1259 dcf.m_cryptoTokens, H225_DisengageConfirm::e_cryptoTokens);
1263 void H225_RAS::OnSendDisengageConfirm(H225_DisengageConfirm & /*dcf*/)
1268 BOOL H225_RAS::OnReceiveDisengageConfirm(const H323RasPDU & pdu, const H225_DisengageConfirm & dcf)
1270 if (!CheckForResponse(H225_RasMessage::e_disengageRequest, dcf.m_requestSeqNum))
1271 return FALSE;
1273 if (!CheckCryptoTokens(pdu,
1274 dcf.m_tokens, H225_DisengageConfirm::e_tokens,
1275 dcf.m_cryptoTokens, H225_DisengageConfirm::e_cryptoTokens))
1276 return FALSE;
1278 return OnReceiveDisengageConfirm(dcf);
1282 BOOL H225_RAS::OnReceiveDisengageConfirm(const H225_DisengageConfirm & /*dcf*/)
1284 return TRUE;
1288 void H225_RAS::OnSendDisengageReject(H323RasPDU & pdu, H225_DisengageReject & drj)
1290 OnSendDisengageReject(drj);
1291 pdu.Prepare(drj.m_tokens, H225_DisengageReject::e_tokens,
1292 drj.m_cryptoTokens, H225_DisengageReject::e_cryptoTokens);
1296 void H225_RAS::OnSendDisengageReject(H225_DisengageReject & /*drj*/)
1301 BOOL H225_RAS::OnReceiveDisengageReject(const H323RasPDU & pdu, const H225_DisengageReject & drj)
1303 if (!CheckForResponse(H225_RasMessage::e_disengageRequest, drj.m_requestSeqNum, &drj.m_rejectReason))
1304 return FALSE;
1306 if (!CheckCryptoTokens(pdu,
1307 drj.m_tokens, H225_DisengageReject::e_tokens,
1308 drj.m_cryptoTokens, H225_DisengageReject::e_cryptoTokens))
1309 return FALSE;
1311 return OnReceiveDisengageReject(drj);
1315 BOOL H225_RAS::OnReceiveDisengageReject(const H225_DisengageReject & /*drj*/)
1317 return TRUE;
1321 void H225_RAS::OnSendLocationRequest(H323RasPDU & pdu, H225_LocationRequest & lrq)
1323 OnSendLocationRequest(lrq);
1325 #ifdef H323_H460
1326 SendFeatureSet<H225_LocationRequest>(this, H460_MessageType::e_locationRequest, lrq);
1327 #endif
1329 pdu.Prepare(lrq.m_tokens, H225_LocationRequest::e_tokens,
1330 lrq.m_cryptoTokens, H225_LocationRequest::e_cryptoTokens);
1334 void H225_RAS::OnSendLocationRequest(H225_LocationRequest & /*lrq*/)
1339 BOOL H225_RAS::OnReceiveLocationRequest(const H323RasPDU & pdu, const H225_LocationRequest & lrq)
1341 if (!CheckCryptoTokens(pdu,
1342 lrq.m_tokens, H225_LocationRequest::e_tokens,
1343 lrq.m_cryptoTokens, H225_LocationRequest::e_cryptoTokens))
1344 return FALSE;
1346 #ifdef H323_H460
1347 ReceiveFeatureSet<H225_LocationRequest>(this, H460_MessageType::e_locationRequest, lrq);
1348 #endif
1350 return OnReceiveLocationRequest(lrq);
1354 BOOL H225_RAS::OnReceiveLocationRequest(const H225_LocationRequest & /*lrq*/)
1356 return TRUE;
1360 void H225_RAS::OnSendLocationConfirm(H323RasPDU & pdu, H225_LocationConfirm & lcf)
1362 OnSendLocationConfirm(lcf);
1364 #ifdef H323_H460
1365 SendFeatureSet<H225_LocationConfirm>(this, H460_MessageType::e_locationConfirm, lcf);
1366 #endif
1368 pdu.Prepare(lcf.m_tokens, H225_LocationRequest::e_tokens,
1369 lcf.m_cryptoTokens, H225_LocationRequest::e_cryptoTokens);
1373 void H225_RAS::OnSendLocationConfirm(H225_LocationConfirm & /*lcf*/)
1378 BOOL H225_RAS::OnReceiveLocationConfirm(const H323RasPDU &, const H225_LocationConfirm & lcf)
1380 if (!CheckForResponse(H225_RasMessage::e_locationRequest, lcf.m_requestSeqNum))
1381 return FALSE;
1383 if (lastRequest->responseInfo != NULL) {
1384 H323TransportAddress & locatedAddress = *(H323TransportAddress *)lastRequest->responseInfo;
1385 locatedAddress = lcf.m_callSignalAddress;
1388 #ifdef H323_H460
1389 ReceiveFeatureSet<H225_LocationConfirm>(this, H460_MessageType::e_locationConfirm, lcf);
1390 #endif
1392 return OnReceiveLocationConfirm(lcf);
1396 BOOL H225_RAS::OnReceiveLocationConfirm(const H225_LocationConfirm & /*lcf*/)
1398 return TRUE;
1402 void H225_RAS::OnSendLocationReject(H323RasPDU & pdu, H225_LocationReject & lrj)
1404 OnSendLocationReject(lrj);
1406 #ifdef H323_H460
1407 SendFeatureSet<H225_LocationReject>(this, H460_MessageType::e_locationReject, lrj);
1408 #endif
1410 pdu.Prepare(lrj.m_tokens, H225_LocationReject::e_tokens,
1411 lrj.m_cryptoTokens, H225_LocationReject::e_cryptoTokens);
1415 void H225_RAS::OnSendLocationReject(H225_LocationReject & /*lrj*/)
1420 BOOL H225_RAS::OnReceiveLocationReject(const H323RasPDU & pdu, const H225_LocationReject & lrj)
1422 if (!CheckForResponse(H225_RasMessage::e_locationRequest, lrj.m_requestSeqNum, &lrj.m_rejectReason))
1423 return FALSE;
1425 if (!CheckCryptoTokens(pdu,
1426 lrj.m_tokens, H225_LocationReject::e_tokens,
1427 lrj.m_cryptoTokens, H225_LocationReject::e_cryptoTokens))
1428 return FALSE;
1430 #ifdef H323_H460
1431 ReceiveFeatureSet<H225_LocationReject>(this, H460_MessageType::e_locationReject, lrj);
1432 #endif
1434 return OnReceiveLocationReject(lrj);
1438 BOOL H225_RAS::OnReceiveLocationReject(const H225_LocationReject & /*lrj*/)
1440 return TRUE;
1444 void H225_RAS::OnSendInfoRequest(H323RasPDU & pdu, H225_InfoRequest & irq)
1446 OnSendInfoRequest(irq);
1447 pdu.Prepare(irq.m_tokens, H225_InfoRequest::e_tokens,
1448 irq.m_cryptoTokens, H225_InfoRequest::e_cryptoTokens);
1452 void H225_RAS::OnSendInfoRequest(H225_InfoRequest & /*irq*/)
1457 BOOL H225_RAS::OnReceiveInfoRequest(const H323RasPDU & pdu, const H225_InfoRequest & irq)
1459 if (!CheckCryptoTokens(pdu,
1460 irq.m_tokens, H225_InfoRequest::e_tokens,
1461 irq.m_cryptoTokens, H225_InfoRequest::e_cryptoTokens))
1462 return FALSE;
1464 return OnReceiveInfoRequest(irq);
1468 BOOL H225_RAS::OnReceiveInfoRequest(const H225_InfoRequest & /*irq*/)
1470 return TRUE;
1474 void H225_RAS::OnSendInfoRequestResponse(H323RasPDU & pdu, H225_InfoRequestResponse & irr)
1476 OnSendInfoRequestResponse(irr);
1477 pdu.Prepare(irr.m_tokens, H225_InfoRequestResponse::e_tokens,
1478 irr.m_cryptoTokens, H225_InfoRequestResponse::e_cryptoTokens);
1482 void H225_RAS::OnSendInfoRequestResponse(H225_InfoRequestResponse & /*irr*/)
1487 BOOL H225_RAS::OnReceiveInfoRequestResponse(const H323RasPDU & pdu, const H225_InfoRequestResponse & irr)
1489 if (!CheckForResponse(H225_RasMessage::e_infoRequest, irr.m_requestSeqNum))
1490 return FALSE;
1492 if (!CheckCryptoTokens(pdu,
1493 irr.m_tokens, H225_InfoRequestResponse::e_tokens,
1494 irr.m_cryptoTokens, H225_InfoRequestResponse::e_cryptoTokens))
1495 return FALSE;
1497 return OnReceiveInfoRequestResponse(irr);
1501 BOOL H225_RAS::OnReceiveInfoRequestResponse(const H225_InfoRequestResponse & /*irr*/)
1503 return TRUE;
1507 void H225_RAS::OnSendNonStandardMessage(H323RasPDU & pdu, H225_NonStandardMessage & nsm)
1509 OnSendNonStandardMessage(nsm);
1511 #ifdef H323_H460
1512 SendFeatureSet<H225_NonStandardMessage>(this, H460_MessageType::e_nonStandardMessage, nsm);
1513 #endif
1515 pdu.Prepare(nsm.m_tokens, H225_InfoRequestResponse::e_tokens,
1516 nsm.m_cryptoTokens, H225_InfoRequestResponse::e_cryptoTokens);
1520 void H225_RAS::OnSendNonStandardMessage(H225_NonStandardMessage & /*nsm*/)
1525 BOOL H225_RAS::OnReceiveNonStandardMessage(const H323RasPDU & pdu, const H225_NonStandardMessage & nsm)
1527 if (!CheckCryptoTokens(pdu,
1528 nsm.m_tokens, H225_NonStandardMessage::e_tokens,
1529 nsm.m_cryptoTokens, H225_NonStandardMessage::e_cryptoTokens))
1530 return FALSE;
1532 #ifdef H323_H460
1533 ReceiveFeatureSet<H225_NonStandardMessage>(this, H460_MessageType::e_nonStandardMessage, nsm);
1534 #endif
1536 return OnReceiveNonStandardMessage(nsm);
1540 BOOL H225_RAS::OnReceiveNonStandardMessage(const H225_NonStandardMessage & /*nsm*/)
1542 return TRUE;
1546 void H225_RAS::OnSendUnknownMessageResponse(H323RasPDU & pdu, H225_UnknownMessageResponse & umr)
1548 OnSendUnknownMessageResponse(umr);
1549 pdu.Prepare(umr.m_tokens, H225_UnknownMessageResponse::e_tokens,
1550 umr.m_cryptoTokens, H225_UnknownMessageResponse::e_cryptoTokens);
1554 void H225_RAS::OnSendUnknownMessageResponse(H225_UnknownMessageResponse & /*umr*/)
1559 BOOL H225_RAS::OnReceiveUnknownMessageResponse(const H323RasPDU & pdu, const H225_UnknownMessageResponse & umr)
1561 if (!CheckCryptoTokens(pdu,
1562 umr.m_tokens, H225_UnknownMessageResponse::e_tokens,
1563 umr.m_cryptoTokens, H225_UnknownMessageResponse::e_cryptoTokens))
1564 return FALSE;
1566 return OnReceiveUnknownMessageResponse(umr);
1570 BOOL H225_RAS::OnReceiveUnknownMessageResponse(const H225_UnknownMessageResponse & /*umr*/)
1572 return TRUE;
1576 void H225_RAS::OnSendRequestInProgress(H323RasPDU & pdu, H225_RequestInProgress & rip)
1578 OnSendRequestInProgress(rip);
1579 pdu.Prepare(rip.m_tokens, H225_RequestInProgress::e_tokens,
1580 rip.m_cryptoTokens, H225_RequestInProgress::e_cryptoTokens);
1584 void H225_RAS::OnSendRequestInProgress(H225_RequestInProgress & /*rip*/)
1589 void H225_RAS::OnSendResourcesAvailableIndicate(H323RasPDU & pdu, H225_ResourcesAvailableIndicate & rai)
1591 OnSendResourcesAvailableIndicate(rai);
1592 pdu.Prepare(rai.m_tokens, H225_ResourcesAvailableIndicate::e_tokens,
1593 rai.m_cryptoTokens, H225_ResourcesAvailableIndicate::e_cryptoTokens);
1597 void H225_RAS::OnSendResourcesAvailableIndicate(H225_ResourcesAvailableIndicate & /*rai*/)
1602 BOOL H225_RAS::OnReceiveResourcesAvailableIndicate(const H323RasPDU & pdu, const H225_ResourcesAvailableIndicate & rai)
1604 if (!CheckCryptoTokens(pdu,
1605 rai.m_tokens, H225_ResourcesAvailableIndicate::e_tokens,
1606 rai.m_cryptoTokens, H225_ResourcesAvailableIndicate::e_cryptoTokens))
1607 return FALSE;
1609 return OnReceiveResourcesAvailableIndicate(rai);
1613 BOOL H225_RAS::OnReceiveResourcesAvailableIndicate(const H225_ResourcesAvailableIndicate & /*rai*/)
1615 return TRUE;
1619 void H225_RAS::OnSendResourcesAvailableConfirm(H323RasPDU & pdu, H225_ResourcesAvailableConfirm & rac)
1621 OnSendResourcesAvailableConfirm(rac);
1622 pdu.Prepare(rac.m_tokens, H225_ResourcesAvailableConfirm::e_tokens,
1623 rac.m_cryptoTokens, H225_ResourcesAvailableConfirm::e_cryptoTokens);
1627 void H225_RAS::OnSendResourcesAvailableConfirm(H225_ResourcesAvailableConfirm & /*rac*/)
1632 BOOL H225_RAS::OnReceiveResourcesAvailableConfirm(const H323RasPDU & pdu, const H225_ResourcesAvailableConfirm & rac)
1634 if (!CheckForResponse(H225_RasMessage::e_resourcesAvailableIndicate, rac.m_requestSeqNum))
1635 return FALSE;
1637 if (!CheckCryptoTokens(pdu,
1638 rac.m_tokens, H225_ResourcesAvailableConfirm::e_tokens,
1639 rac.m_cryptoTokens, H225_ResourcesAvailableConfirm::e_cryptoTokens))
1640 return FALSE;
1642 return OnReceiveResourcesAvailableConfirm(rac);
1646 BOOL H225_RAS::OnReceiveResourcesAvailableConfirm(const H225_ResourcesAvailableConfirm & /*rac*/)
1648 return TRUE;
1651 #ifdef H323_H248
1653 void H225_RAS::OnSendServiceControlIndication(H323RasPDU & pdu, H225_ServiceControlIndication & sci)
1655 OnSendServiceControlIndication(sci);
1657 #ifdef H323_H460
1658 SendFeatureSet<H225_ServiceControlIndication>(this, H460_MessageType::e_serviceControlIndication, sci);
1659 #endif
1661 pdu.Prepare(sci.m_tokens, H225_ServiceControlIndication::e_tokens,
1662 sci.m_cryptoTokens, H225_ServiceControlIndication::e_cryptoTokens);
1666 void H225_RAS::OnSendServiceControlIndication(H225_ServiceControlIndication & /*sci*/)
1671 BOOL H225_RAS::OnReceiveServiceControlIndication(const H323RasPDU & pdu, const H225_ServiceControlIndication & sci)
1673 if (!CheckCryptoTokens(pdu,
1674 sci.m_tokens, H225_ServiceControlIndication::e_tokens,
1675 sci.m_cryptoTokens, H225_ServiceControlIndication::e_cryptoTokens))
1676 return FALSE;
1678 #ifdef H323_H460
1679 ReceiveFeatureSet<H225_ServiceControlIndication>(this, H460_MessageType::e_serviceControlIndication, sci);
1680 #endif
1682 return OnReceiveServiceControlIndication(sci);
1686 BOOL H225_RAS::OnReceiveServiceControlIndication(const H225_ServiceControlIndication & /*sci*/)
1688 return TRUE;
1692 void H225_RAS::OnSendServiceControlResponse(H323RasPDU & pdu, H225_ServiceControlResponse & scr)
1694 OnSendServiceControlResponse(scr);
1696 #ifdef H323_H460
1697 SendFeatureSet<H225_ServiceControlResponse>(this, H460_MessageType::e_serviceControlResponse, scr);
1698 #endif
1700 pdu.Prepare(scr.m_tokens, H225_ResourcesAvailableConfirm::e_tokens,
1701 scr.m_cryptoTokens, H225_ResourcesAvailableConfirm::e_cryptoTokens);
1705 void H225_RAS::OnSendServiceControlResponse(H225_ServiceControlResponse & /*scr*/)
1710 BOOL H225_RAS::OnReceiveServiceControlResponse(const H323RasPDU & pdu, const H225_ServiceControlResponse & scr)
1712 if (!CheckForResponse(H225_RasMessage::e_serviceControlIndication, scr.m_requestSeqNum))
1713 return FALSE;
1715 if (!CheckCryptoTokens(pdu,
1716 scr.m_tokens, H225_ServiceControlResponse::e_tokens,
1717 scr.m_cryptoTokens, H225_ServiceControlResponse::e_cryptoTokens))
1718 return FALSE;
1720 #ifdef H323_H460
1721 ReceiveFeatureSet<H225_ServiceControlResponse>(this, H460_MessageType::e_serviceControlResponse, scr);
1722 #endif
1724 return OnReceiveServiceControlResponse(scr);
1728 BOOL H225_RAS::OnReceiveServiceControlResponse(const H225_ServiceControlResponse & /*scr*/)
1730 return TRUE;
1733 #endif // H323_H248
1736 void H225_RAS::OnSendInfoRequestAck(H323RasPDU & pdu, H225_InfoRequestAck & iack)
1738 OnSendInfoRequestAck(iack);
1739 pdu.Prepare(iack.m_tokens, H225_InfoRequestAck::e_tokens,
1740 iack.m_cryptoTokens, H225_InfoRequestAck::e_cryptoTokens);
1744 void H225_RAS::OnSendInfoRequestAck(H225_InfoRequestAck & /*iack*/)
1749 BOOL H225_RAS::OnReceiveInfoRequestAck(const H323RasPDU & pdu, const H225_InfoRequestAck & iack)
1751 if (!CheckForResponse(H225_RasMessage::e_infoRequestResponse, iack.m_requestSeqNum))
1752 return FALSE;
1754 if (!CheckCryptoTokens(pdu,
1755 iack.m_tokens, H225_InfoRequestAck::e_tokens,
1756 iack.m_cryptoTokens, H225_InfoRequestAck::e_cryptoTokens))
1757 return FALSE;
1759 return OnReceiveInfoRequestAck(iack);
1763 BOOL H225_RAS::OnReceiveInfoRequestAck(const H225_InfoRequestAck & /*iack*/)
1765 return TRUE;
1769 void H225_RAS::OnSendInfoRequestNak(H323RasPDU & pdu, H225_InfoRequestNak & inak)
1771 OnSendInfoRequestNak(inak);
1772 pdu.Prepare(inak.m_tokens, H225_InfoRequestAck::e_tokens,
1773 inak.m_cryptoTokens, H225_InfoRequestAck::e_cryptoTokens);
1777 void H225_RAS::OnSendInfoRequestNak(H225_InfoRequestNak & /*inak*/)
1782 BOOL H225_RAS::OnReceiveInfoRequestNak(const H323RasPDU & pdu, const H225_InfoRequestNak & inak)
1784 if (!CheckForResponse(H225_RasMessage::e_infoRequestResponse, inak.m_requestSeqNum, &inak.m_nakReason))
1785 return FALSE;
1787 if (!CheckCryptoTokens(pdu,
1788 inak.m_tokens, H225_InfoRequestNak::e_tokens,
1789 inak.m_cryptoTokens, H225_InfoRequestNak::e_cryptoTokens))
1790 return FALSE;
1792 return OnReceiveInfoRequestNak(inak);
1796 BOOL H225_RAS::OnReceiveInfoRequestNak(const H225_InfoRequestNak & /*inak*/)
1798 return TRUE;
1802 BOOL H225_RAS::OnReceiveUnknown(const H323RasPDU &)
1804 H323RasPDU response;
1805 response.BuildUnknownMessageResponse(0);
1806 return response.Write(*transport);
1810 /////////////////////////////////////////////////////////////////////////////