rasstuff.cpp
资源名称:h323.zip [点击查看]
上传用户:hnnddl
上传日期:2007-01-06
资源大小:3580k
文件大小:22k
源码类别:
IP电话/视频会议
开发平台:
WINDOWS
- /*
- * $Revision: 1.2 $
- * $Date: 1998/10/14 22:48:28 $
- */
- ////////////////////////////////////////////////////////////////
- // Copyright (c) 1996-98 Lucent Technologies //
- // All Rights Reserved //
- // //
- // THIS IS UNPUBLISHED //
- // PROPRIETARY SOURCE //
- // CODE OF Lucent Technologies //
- // AND elemedia //
- // //
- ////////////////////////////////////////////////////////////////
- //
- ////////////////////////////////////////////////////////////////
- // Example programs are provided soley to demonstrate one //
- // possible use of the stack libraries and are included for //
- // instructional purposes only. You are free to use, modify //
- // and/or redistribute any portion of code in the example //
- // programs. However, such examples are not intended to //
- // represent production quality code. //
- // //
- // THE COPYRIGHT HOLDERS PROVIDE THESE EXAMPLE PROGRAMS //
- // "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED //
- // OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
- // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A //
- // PARTICULAR PURPOSE. //
- ////////////////////////////////////////////////////////////////
- #if defined(USE_RAS)
- #include "exchange.h"
- #include "call.h"
- #include "msg.h"
- #include <api/h225rastypes.h>
- #include <api/h225raserr.h>
- //#include "config.h"
- ProtReturnCode
- Exchange::SendGRQ(int seq_num, struct sockaddr *dst_addr)
- {
- LOG("SendGRQn");
- H225RASMsgGRQ *msg;
- H225RASMessage *m;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_GRQ, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new GRQ messagen");
- return(ret);
- }
- msg = (H225RASMsgGRQ *)m;
- msg->SetSequenceNumber(seq_num);
- msg->SetRASAddr(GetLocalRASAddr());
- // get the endpointType info from Exchange
- H225CSEndpointType et;
- ((H225RASProtocol *)this)->GetEndpointType(et);
- // now set the appropriate mandatory endpointType field of the message
- ret = ((ItemEndpointType *)msg)->SetEndpointType(et);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetEndpointType() failure, ret = %xn", ret);
- }
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send GRQ message 0x%xn", ret);
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendRRQ(int seq_num, struct sockaddr *dst_addr)
- {
- LOG("SendRRQn");
- H225RASMsgRRQ *msg;
- H225RASMessage *m;
- H225CSAliasAddress aa;
- ProtReturnCode ret;
- ret = H225RASMessage::Factory(m, MSG_RRQ, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new RRQ messagen");
- return(ret);
- }
- msg = (H225RASMsgRRQ *)m;
- msg->SetSequenceNumber(seq_num);
- msg->SetDiscoveryComplete(FALSE) ;
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetDiscoveryComplete() failure, ret = %xn", ret);
- }
- // call signalling address is mandatory
- ret = msg->AddCallSigAddr(GetLocalSigAddr()) ;
- if(!PROT_IS_SUCCESS(ret)) {
- LOG("msg->AddCallSigAddr() failure, ret = %xn", ret);
- }
- // ras address is mandatory
- ret = msg->AddRASAddr(GetLocalRASAddr());
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->AddRASAddr() failure, ret = %xn", ret);
- }
- // get the endpointType and vendorID info from Exchange
- H225CSEndpointType et;
- H225CSVendorID vendor_id;
- ((H225RASProtocol *)this)->GetVendorID(vendor_id);
- ((H225RASProtocol *)this)->GetEndpointType(et);
- // now set the appropriate mandatory vendorID and endpointType fields of the message
- ret = ((ItemVendorID *)msg)->SetVendorID(vendor_id);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetVendorID() failure, ret = %xn", ret);
- }
- ret = ((ItemEndpointType *)msg)->SetEndpointType(et);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetEndpointType() failure, ret = %xn", ret);
- }
- char display_str[256];
- sprintf(display_str, "%s", config->h323IDsrc);
- if (display_str != NULL)
- {
- #if 0
- H225CSAliasAddress alias;
- WCHAR h323_id[128];
- int h323_id_len;
- h323_id_len = MultiByteToWideChar(
- CP_ACP,
- MB_ERR_INVALID_CHARS,
- display_str,
- strlen(display_str),
- h323_id,
- 128);
- alias.SetH323ID(h323_id,h323_id_len);
- ret = msg->AddEndpointAlias(alias);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->AddEndpointAlias() failure, ret = %xn", ret);
- }
- #endif
- }
- // set the phone numbers we want to register as aliases
- for (int i=0; i< NUM_LINES; i++) {
- char e164[128];
- sprintf(e164, "%s%0004d",
- config->e164src, i);
- ret = aa.SetE164(e164,(unsigned short)strlen(e164));
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("aa.SetE164() failure, ret = %xn", ret);
- }
- ret = msg->AddEndpointAlias(aa);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->AddEndpointAlias() failure, ret = %xn", ret);
- }
- }
- int count;
- ret = msg->GetNumEndpointAliases(count);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->GetNumEndpointAliases() failure, ret = %xn", ret);
- }
- #if 0
- // the gatekeeperIdentifier is optional
- unsigned short ep_id[128];
- int len;
- char *mystring = "elemediaGK";
- for(len = 0; len < 128; len++) {
- if(mystring[len] != ' ') {
- ep_id[len] = (short)mystring[len];
- } else {
- ep_id[len] = 0;
- break;
- }
- }
- ret = msg->SetGKID(ep_id,len);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetGKID() failure, ret = %xn", ret);
- }
- unsigned short id[128];
- unsigned short *ptr = id;
- char rcvstring[128];
- int len2 = 0;
- ret = msg->GetGKID(ptr,len2);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetGKID() failure, ret = %xn", ret);
- }
- LOG("Gatekeeper ID len = %dn", len2);
- rcvstring[0] = 'X';
- for(len = 0; len < len2; len++) {
- rcvstring[len] = (char)*ptr++;
- }
- rcvstring[len2] = ' ';
- if (len2 < 100) {
- LOG_ERROR("Gatekeeper ID = %sn",rcvstring);
- }
- #endif
- ret = SendRASMessage(dst_addr, *m);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send RRQ message, 0x%x n", ret);
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendURQ(int seq_num, struct sockaddr *dst_addr)
- {
- LOG("SendURQn");
- H225RASMsgURQ *msg;
- H225RASMessage *m;
- H225CSAliasAddress aa;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_URQ, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new URQ messagen");
- return(ret);
- }
- msg = (H225RASMsgURQ *)m;
- msg->SetSequenceNumber(seq_num);
- ret = msg->AddCallSigAddr(GetLocalSigAddr()) ;
- if(!PROT_IS_SUCCESS(ret)) {
- LOG("msg->AddCallSigAddr() failure, ret = %xn", ret);
- }
- // set the phone numbers we want to unregister
- for (int i=0; i< 10; i++) {
- char e164[128];
- sprintf(e164, "%s%d",
- config->e164src, i);
- ret = aa.SetE164(e164,(unsigned short)strlen(e164));
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("aa.SetE164() failure, ret = %xn", ret);
- }
- ret = msg->AddEndpointAlias(aa);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->AddEndpointAlias() failure, ret = %xn", ret);
- }
- }
- int count;
- ret = msg->GetNumEndpointAliases(count);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->GetNumEndpointAliases() failure, ret = %xn", ret);
- }
- // set the endpoint ID that was assigned by the gatekeeper in RRQ
- ret = msg->SetEndpointID(ep_id, ep_id_len);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG("msg->SetEndpointID() failure, ret = %xn", ret);
- }
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send URQ message, ret = %xn", ret);
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendUCF(int seq_num, struct sockaddr *dst_addr)
- {
- LOG("SendUCFn");
- H225RASMsgUCF *msg;
- H225RASMessage *m;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_UCF, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new UCF messagen");
- return(ret);
- }
- msg = (H225RASMsgUCF *)m;
- msg->SetSequenceNumber(seq_num);
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send UCF messagen");
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendURJ(int seq_num, struct sockaddr *dst_addr)
- {
- LOG("SendURJn");
- H225RASMsgURJ *msg;
- H225RASMessage *m;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_URJ, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new URJ messagen");
- return(ret);
- }
- msg = (H225RASMsgURJ *)m;
- msg->SetSequenceNumber(seq_num);
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send URJ messagen");
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendARQ(int seq_num, struct sockaddr *dst_addr, class SendARQdata *arq_data)
- {
- LOG("SendARQn");
- int index = arq_data->index;
- H225RASMsgARQ *msg;
- H225RASMessage *m;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_ARQ, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new ARQ message, ret = 0x%xn", ret);
- return(ret);
- }
- msg = (H225RASMsgARQ *)m;
- msg->SetSequenceNumber(seq_num);
- ret = msg->SetCallType(CT_POINT_TO_POINT);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetCallType() failure, ret = %xn", ret);
- }
- ret = msg->SetCallModel(CM_GATEKEEPER_ROUTED);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetCallModel() failure, ret = %xn", ret);
- }
- ret = msg->SetEndpointID(ep_id, ep_id_len);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetEndpointID() failure, ret = %xn", ret);
- }
- // how much bandwidth do we need for this call? - mandatory
- ret = msg->SetBandwidth(200); // 20kbits
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetBandwidth() failure, ret = %xn", ret);
- }
- // is this endpoint gonna be the active MC? - mandatory
- ret = msg->SetActiveMC(FALSE);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetActiveMC() failure, ret = %xn", ret);
- }
- // are we placing or receiving a call? - mandatory
- // DIR_INCOMING = 1
- // DIR_OUTGOING = 0;
- ret = msg->SetAnswerCall(ras_sess[index].direction);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetAnswerCall() failure, ret = %xn", ret);
- }
- // set the conference ID - mandatory
- unsigned char *confID;
- int len;
- (H225CSProtocol*)calls[index]->GetConfID(confID, len);
- ret = msg->SetConfID((char *)confID, len);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetConfID() failure, ret = %xn", ret);
- }
- // set the call reference value - mandatory
- ret = msg->SetCRV(index);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetCRV() failure, ret = %xn", ret);
- }
- // The application who calls SendARQ must consider:
- // if the call is outgoing, the e164dst should be filled with the remote e164 alias
- // and the e164src with the local e164 alias
- // if the call is incoming, the e164dst should be filled with the local e164 alias
- // and the e164src with the remote e164 alias
- // Additionally, we only need to address the destination either with an alias
- // like e164 or h323ID or its Q.931 call signalling IP address
- if (arq_data->e164dst[0] != ' ')
- {
- H225CSAliasAddress aa;
- char e164[128];
- sprintf(e164, "%s",arq_data->e164dst);
- ret = aa.SetE164(e164,(unsigned short)strlen(e164));
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("aa.SetE164() failure, ret = %xn", ret);
- }
- ret = msg->AddDstInfo(aa);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->AddDstInfo() failure, ret = %xn", ret);
- }
- }
- if (arq_data->e164src[0] != ' ')
- {
- H225CSAliasAddress aa;
- char e164[128];
- sprintf(e164, "%s",arq_data->e164src);
- ret = aa.SetE164(e164,(unsigned short)strlen(e164));
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("aa.SetE164() failure, ret = %xn", ret);
- }
- ret = msg->AddSrcInfo(aa);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->AddSrcInfo() failure, ret = %xn", ret);
- }
- }
- // fill up the srcInfo with h323 alias
- #if 0
- if (arq_data->h323IDsrc[0] != ' ')
- {
- H225CSAliasAddress aa;
- WCHAR h323_id[128];
- int h323_id_len;
- h323_id_len = MultiByteToWideChar(
- CP_ACP,
- MB_ERR_INVALID_CHARS,
- arq_data->h323IDsrc,
- strlen(arq_data->h323IDsrc),
- h323_id,
- 128);
- aa.SetH323ID(h323_id,h323_id_len);
- ret = msg->AddSrcInfo(aa);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->AddSrcInfo() failure, ret = %xn", ret);
- }
- }
- // fill up the destinationInfo with h323 alias
- if (arq_data->h323IDdst[0] != ' ')
- {
- H225CSAliasAddress aa;
- WCHAR h323_id[128];
- int h323_id_len;
- h323_id_len = MultiByteToWideChar(
- CP_ACP,
- MB_ERR_INVALID_CHARS,
- arq_data->h323IDsrc,
- strlen(arq_data->h323IDdst),
- h323_id,
- 128);
- aa.SetH323ID(h323_id,h323_id_len);
- ret = msg->AddDstInfo(aa);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->AddDstInfo() failure, ret = %xn", ret);
- }
- }
- #endif
- // as we send earlier we can send ARQ with destination either H.323 or E.164 alias so the
- // gatekeeper can resolve the destination IP address or we might know
- // the destination IP and we only need authorization for this call from the GK
- //
- if (arq_data->callsigdst)
- {
- msg->SetDstCallSigAddr((sockaddr *)arq_data->callsigdst);
- }
- // set the call ID - mandatory
- H225CSCallID callID;
- (H225CSProtocol*)calls[index]->GetCallID(callID);
- unsigned char *tmp; char tmp1[256];
- callID.GetCallID(tmp, len);
- strncpy(tmp1, (char*)tmp, len);
- LOG("in SendARQ, callid=%sn", tmp1);
- ret = msg->SetCallID(callID);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetCallID() failure, ret = %xn", ret);
- }
- // the message should be fine, send it
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send ARQ message, ret = 0x%xn", ret);
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendBRQ(int seq_num, struct sockaddr *dst_addr)
- {
- LOG("SendBRQn");
- H225RASMsgBRQ *msg;
- H225RASMessage *m;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_BRQ, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new BRQ messagen");
- return(ret);
- }
- msg = (H225RASMsgBRQ *)m;
- msg->SetSequenceNumber(seq_num);
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send BRQ messagen");
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendDRQ(int seq_num, struct sockaddr *dst_addr, int index)
- {
- LOG("SendDRQn");
- H225RASMsgDRQ *msg;
- H225RASMessage *m;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_DRQ, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new DRQ messagen");
- return(ret);
- }
- msg = (H225RASMsgDRQ *)m;
- msg->SetSequenceNumber(seq_num);
- msg->SetReason(DRQ_NORMAL_DROP);
- // mandatory
- unsigned char *confID;
- int len;
- (H225CSProtocol*)calls[index]->GetConfID(confID, len);
- ret = msg->SetConfID((char *)confID, len);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetConfID() failure, ret = %xn", ret);
- }
- // mandatory
- ret = msg->SetCRV(index);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetCRV() failure, ret = %xn", ret);
- }
- // mandatory
- ret = msg->SetEndpointID(ep_id, ep_id_len);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetEndpointID() failure, ret = %xn", ret);
- }
- // set the call ID - mandatory
- H225CSCallID callID;
- (H225CSProtocol*)calls[index]->GetCallID(callID);
- unsigned char *tmp; char tmp1[256];
- callID.GetCallID(tmp, len);
- strncpy(tmp1, (char*)tmp, len);
- LOG("in SendDRQ, callid=%sn", tmp1);
- ret = msg->SetCallID(callID);
- if(!PROT_IS_SUCCESS(ret)) {
- LOG_ERROR("msg->SetCallID() failure, ret = %xn", ret);
- }
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send DRQ message, ret = 0x%xn", ret);
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendDCF(int seq_num, struct sockaddr *dst_addr)
- {
- LOG("SendDCFn");
- H225RASMsgDCF *msg;
- H225RASMessage *m;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_DCF, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new DCF messagen");
- return(ret);
- }
- msg = (H225RASMsgDCF *)m;
- msg->SetSequenceNumber(seq_num);
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send DCF messagen");
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendDRJ(int seq_num, struct sockaddr *dst_addr)
- {
- LOG("SendDRJn");
- H225RASMsgDRJ *msg;
- H225RASMessage *m;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_DRJ, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new DRJ messagen");
- return(ret);
- }
- msg = (H225RASMsgDRJ *)m;
- msg->SetSequenceNumber(seq_num);
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send DRJ messagen");
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendLRQ(int seq_num, struct sockaddr *dst_addr)
- {
- LOG("SendLRQn");
- H225RASMsgLRQ *msg;
- H225RASMessage *m;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_LRQ, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new LRQ messagen");
- return(ret);
- }
- msg = (H225RASMsgLRQ *)m;
- msg->SetSequenceNumber(seq_num);
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send LRQ messagen");
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendLCF(int seq_num, struct sockaddr *dst_addr)
- {
- LOG("SendLCFn");
- H225RASMsgLCF *msg;
- H225RASMessage *m;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_LCF, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new LCF messagen");
- return(ret);
- }
- msg = (H225RASMsgLCF *)m;
- msg->SetSequenceNumber(seq_num);
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send LCF messagen");
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendLRJ(int seq_num, struct sockaddr *dst_addr)
- {
- LOG("SendLRJn");
- H225RASMsgLRJ *msg;
- H225RASMessage *m;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_LRJ, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new LRJ messagen");
- return(ret);
- }
- msg = (H225RASMsgLRJ *)m;
- msg->SetSequenceNumber(seq_num);
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send LRJ messagen");
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendIRQ(int seq_num, struct sockaddr *dst_addr)
- {
- LOG("SendIRQn");
- H225RASMsgIRQ *msg;
- H225RASMessage *m;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_IRQ, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new IRQ messagen");
- return(ret);
- }
- msg = (H225RASMsgIRQ *)m;
- msg->SetSequenceNumber(seq_num);
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send IRQ messagen");
- }
- delete m;
- return ret;
- }
- ProtReturnCode
- Exchange::SendIRR(int seq_num, struct sockaddr *dst_addr)
- {
- LOG("SendIRRn");
- H225RASMsgIRR *msg;
- H225RASMessage *m;
- ProtReturnCode ret = H225RASMessage::Factory(m, MSG_IRR, (H225RASProtocol *)this);
- if (!PROT_IS_SUCCESS(ret) || !m)
- {
- LOG_ERROR("Failed to new IRR messagen");
- return(ret);
- }
- msg = (H225RASMsgIRR *)m;
- msg->SetSequenceNumber(seq_num);
- ret = SendRASMessage(dst_addr, *msg);
- if (!PROT_IS_SUCCESS(ret))
- {
- LOG_ERROR("Failed to send IRR messagen");
- }
- delete m;
- return ret;
- }
- #endif // USE_RAS