⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gkclient.cxx

📁 mgcp协议源代码。支持多种编码:g711
💻 CXX
📖 第 1 页 / 共 3 页
字号:
/* * gkclient.cxx * * Gatekeeper client protocol handler * * Open H323 Library * * Copyright (c) 1999-2000 Equivalence Pty. Ltd. * * The contents of this file are subject to the Mozilla Public License * Version 1.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is Open H323 Library. * * The Initial Developer of the Original Code is Equivalence Pty. Ltd. * * Portions of this code were written with the assisance of funding from * iFace In, http://www.iface.com * * Contributor(s): ______________________________________. * * $Log: gkclient.cxx,v $ * Revision 1.28  2000/07/15 09:54:21  robertj * Fixed problem with having empty or unusable assigned aliases. * * Revision 1.27  2000/07/11 19:26:39  robertj * Fixed problem with endpoint identifiers from some gatekeepers not being a string, just binary info. * * Revision 1.26  2000/06/20 03:18:04  robertj * Added function to get name of gatekeeper, subtle difference from getting identifier. * * Revision 1.25  2000/05/09 12:14:32  robertj * Added adjustment of endpoints alias list as approved by gatekeeper. * * Revision 1.24  2000/05/09 08:52:50  robertj * Added support for preGrantedARQ fields on registration. * * Revision 1.23  2000/05/04 10:43:54  robertj * Fixed problem with still trying to RRQ if got a GRJ. * * Revision 1.22  2000/05/02 04:32:26  robertj * Fixed copyright notice comment. * * Revision 1.21  2000/04/27 02:52:58  robertj * Added keepAlive field to RRQ if already registered, * * Revision 1.20  2000/04/12 21:22:16  robertj * Fixed warning in No Trace mode. * * Revision 1.19  2000/04/11 04:00:55  robertj * Filled in destCallSignallingAddress if specified by caller, used for gateway permissions. * * Revision 1.18  2000/04/11 03:11:12  robertj * Added ability to reject reason on gatekeeper requests. * * Revision 1.17  2000/03/29 02:14:43  robertj * Changed TerminationReason to CallEndReason to use correct telephony nomenclature. * Added CallEndReason for capability exchange failure. * * Revision 1.16  2000/03/23 02:45:28  robertj * Changed ClearAllCalls() so will wait for calls to be closed (usefull in endpoint dtors). * * Revision 1.15  2000/03/21 23:17:55  robertj * Changed GK client so does not fill in destCallSignalAddress on outgoing call. * * Revision 1.14  2000/01/28 00:56:48  robertj * Changed ACF to return destination address irrespective of callModel, thanks Chris Gindel. * * Revision 1.13  1999/12/23 23:02:35  robertj * File reorganision for separating RTP from H.323 and creation of LID for VPB support. * * Revision 1.12  1999/12/11 02:20:58  robertj * Added ability to have multiple aliases on local endpoint. * * Revision 1.11  1999/12/10 01:43:25  robertj * Fixed outgoing call Admissionrequestion addresses. * * Revision 1.10  1999/12/09 21:49:18  robertj * Added reregister on unregister and time to live reregistration * * Revision 1.9  1999/11/06 05:37:45  robertj * Complete rewrite of termination of connection to avoid numerous race conditions. * * Revision 1.8  1999/10/16 03:47:48  robertj * Fixed termination of gatekeeper RAS thread problem * * Revision 1.7  1999/10/15 05:55:50  robertj * Fixed crash in responding to InfoRequest * * Revision 1.6  1999/09/23 08:48:45  robertj * Changed register request so cannot do it of have no listeners. * * Revision 1.5  1999/09/21 14:09:19  robertj * Removed warnings when no tracing enabled. * * Revision 1.4  1999/09/14 08:19:37  robertj * Fixed timeout on retry of gatekeeper discover and added more tracing. * * Revision 1.3  1999/09/14 06:52:54  robertj * Added better support for multi-homed client hosts. * * Revision 1.2  1999/09/10 02:45:31  robertj * Added missing binding of address to transport when a specific gatway is used. * * Revision 1.1  1999/08/31 12:34:18  robertj * Added gatekeeper support. * */#include <ptlib.h>#include "gkclient.h"#include "h323pdu.h"class H225RasThread : public PThread{  PCLASSINFO(H225RasThread, PThread)  public:    H225RasThread(H323EndPoint & endpoint,                  H323Gatekeeper & gatekeeper);  protected:    void Main();    H323Gatekeeper & gatekeeper;};#define new PNEW/////////////////////////////////////////////////////////////////////////////H225RasThread::H225RasThread(H323EndPoint & endpoint,                             H323Gatekeeper & g)  : PThread(endpoint.GetRasThreadStackSize(), NoAutoDeleteThread),    gatekeeper(g){  Resume();}void H225RasThread::Main(){  PTRACE(3, "H225\tStarted RAS thread");  gatekeeper.HandleRasChannel();}/////////////////////////////////////////////////////////////////////////////H323Gatekeeper::H323Gatekeeper(H323EndPoint & ep, H323Transport * trans)  : endpoint(ep),    transport(trans){  discoveryComplete = FALSE;  isRegistered = FALSE;  pregrantMakeCall = pregrantAnswerCall = RequireARQ;  autoReregister = TRUE;  timeToLive.SetNotifier(PCREATE_NOTIFIER(RegistrationTimeToLive));  lastSequenceNumber = 0;}H323Gatekeeper::~H323Gatekeeper(){  timeToLive.Stop();  if (transport != NULL) {    transport->CleanUpOnTermination();    delete transport;  }}void H323Gatekeeper::PrintOn(ostream & strm) const{  if (!gatekeeperIdentifier)    strm << gatekeeperIdentifier << "@";  H323TransportAddress addr = transport->GetRemoteAddress();  PIPSocket::Address ip;  WORD port;  if (addr.GetIpAndPort(ip, port)) {    strm << PIPSocket::GetHostName(ip);    if (port != H323TransportUDP::DefaultRasPort)      strm << ':' << port;  }  else    strm << addr;}PString H323Gatekeeper::GetName() const{  PStringStream s;  s << *this;  return s;}void H323Gatekeeper::HandleRasChannel(){  transport->SetReadTimeout(PMaxTimeInterval);  H323RasPDU response;  while (response.Read(*transport)) {    if (HandleRasPDU(response))      responseHandled.Signal();  }}BOOL H323Gatekeeper::HandleRasPDU(const H323RasPDU & response){  switch (response.GetTag()) {    case H225_RasMessage::e_gatekeeperRequest :      OnReceiveGatekeeperRequest(response);      break;    case H225_RasMessage::e_gatekeeperConfirm :      return OnReceiveGatekeeperConfirm(response);    case H225_RasMessage::e_gatekeeperReject :      return OnReceiveGatekeeperReject(response);    case H225_RasMessage::e_registrationRequest :      OnReceiveRegistrationRequest(response);      break;    case H225_RasMessage::e_registrationConfirm :      return OnReceiveRegistrationConfirm(response);    case H225_RasMessage::e_registrationReject :      return OnReceiveRegistrationReject(response);    case H225_RasMessage::e_unregistrationRequest :      OnReceiveUnregistrationRequest(response);      break;    case H225_RasMessage::e_unregistrationConfirm :      return OnReceiveUnregistrationConfirm(response);    case H225_RasMessage::e_unregistrationReject :      return OnReceiveUnregistrationReject(response);    case H225_RasMessage::e_admissionRequest :      OnReceiveAdmissionRequest(response);      break;    case H225_RasMessage::e_admissionConfirm :      return OnReceiveAdmissionConfirm(response);    case H225_RasMessage::e_admissionReject :      return OnReceiveAdmissionReject(response);    case H225_RasMessage::e_bandwidthRequest :      OnReceiveBandwidthRequest(response);      break;    case H225_RasMessage::e_bandwidthConfirm :      return OnReceiveBandwidthConfirm(response);    case H225_RasMessage::e_bandwidthReject :      return OnReceiveBandwidthReject(response);    case H225_RasMessage::e_disengageRequest :      OnReceiveDisengageRequest(response);      break;    case H225_RasMessage::e_disengageConfirm :      return OnReceiveDisengageConfirm(response);    case H225_RasMessage::e_disengageReject :      return OnReceiveDisengageReject(response);    case H225_RasMessage::e_locationRequest :      OnReceiveLocationRequest(response);      break;    case H225_RasMessage::e_locationConfirm :      return OnReceiveLocationConfirm(response);    case H225_RasMessage::e_locationReject :      return OnReceiveLocationReject(response);    case H225_RasMessage::e_infoRequest :      OnReceiveInfoRequest(response);      break;    case H225_RasMessage::e_infoRequestResponse :      return OnReceiveInfoRequestResponse(response);    case H225_RasMessage::e_nonStandardMessage :      OnReceiveNonStandardMessage(response);      break;    case H225_RasMessage::e_unknownMessageResponse :      OnReceiveUnknownMessageResponse(response);      break;    case H225_RasMessage::e_requestInProgress :      OnReceiveRequestInProgress(response);      break;    case H225_RasMessage::e_resourcesAvailableIndicate :      OnReceiveResourcesAvailableIndicate(response);      break;    case H225_RasMessage::e_resourcesAvailableConfirm :      return OnReceiveResourcesAvailableConfirm(response);    case H225_RasMessage::e_infoRequestAck :      return OnReceiveInfoRequestAck(response);    case H225_RasMessage::e_infoRequestNak :      return OnReceiveInfoRequestNak(response);    default :      OnReceiveUnkown(response);  }  return FALSE;}BOOL H323Gatekeeper::MakeRequest(const H323RasPDU & request){  PTRACE(3, "RAS\tMaking request: " << request.GetTagName());  // Assume a confirm, reject callbacks will set to RejectReceived  responseResult = ConfirmReceived;  // Set request code for determining response  requestTag = request.GetTag();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -