"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/h460/h460_std17.cxx" between
h323plus-1_26_9.tar.gz and h323plus-1_27_0.tar.gz

About: H.323 Plus offers libraries for voice (VoIP) and videoconferencing using H.323.

h460_std17.cxx  (h323plus-1_26_9):h460_std17.cxx  (h323plus-1_27_0)
skipping to change at line 85 skipping to change at line 85
recPtr = srvRecords.GetNext(); recPtr = srvRecords.GetNext();
PTRACE(4, "H323\tFound " << rec.addr << ":" << rec.port << " with SRV " << srv << " for domain " << domain); PTRACE(4, "H323\tFound " << rec.addr << ":" << rec.port << " with SRV " << srv << " for domain " << domain);
} }
} }
return found; return found;
#else #else
return false; return false;
#endif #endif
} }
static PBoolean FindRoutes(const PString & domain, std::vector<std::pair<LookupR ecord,H323TransportSecurity> > & routes, H323TransportSecurity * sec) static PBoolean FindRoutes(const PString & domain, std::vector<std::pair<LookupR ecord, H323TransportSecurity> > & routes, H323TransportSecurity * sec)
{ {
std::vector<LookupRecord> secureRoute; std::vector<LookupRecord> secureRoute;
std::vector<LookupRecord>::iterator r; std::vector<LookupRecord>::iterator r;
if (sec && sec->IsTLSEnabled()) { if (sec && sec->IsTLSEnabled()) {
H323TransportSecurity tls; H323TransportSecurity tls;
tls.EnableTLS(true); tls.EnableTLS(true);
FindSRVRecords(secureRoute, domain, "_h323rs-sec._tcp."); FindSRVRecords(secureRoute, domain, "_h323rs-sec._tcp.");
for (r = secureRoute.begin(); r != secureRoute.end(); ++r) for (r = secureRoute.begin(); r != secureRoute.end(); ++r)
routes.push_back(std::make_pair(*r,tls)); routes.push_back(std::make_pair(*r,tls));
if (routes.size() > 0) if (!routes.empty())
return true; return true;
} }
std::vector<LookupRecord> route; std::vector<LookupRecord> route;
H323TransportSecurity unsecure; H323TransportSecurity unsecure;
FindSRVRecords(route, domain, "_h323rs._tcp."); FindSRVRecords(route, domain, "_h323rs._tcp.");
for (r = route.begin(); r != route.end(); ++r) for (r = route.begin(); r != route.end(); ++r)
routes.push_back(std::make_pair(*r,unsecure)); routes.push_back(std::make_pair(*r,unsecure));
return routes.size() > 0; return !routes.empty();
} }
//////////////////////////////////////////////////////////////////////////////// /// //////////////////////////////////////////////////////////////////////////////// ///
// Must Declare for Factory Loader. // Must Declare for Factory Loader.
H460_FEATURE(Std17); H460_FEATURE(Std17);
PBoolean H460_FeatureStd17::isEnabled = false; PBoolean H460_FeatureStd17::isEnabled = false;
H460_FeatureStd17::H460_FeatureStd17() H460_FeatureStd17::H460_FeatureStd17()
: H460_FeatureStd(17), EP(NULL), CON(NULL), m_handler(NULL) : H460_FeatureStd(17), EP(NULL), CON(NULL), m_handler(NULL)
{ {
skipping to change at line 173 skipping to change at line 173
#ifdef H323_H46018 #ifdef H323_H46018
EP->H46018Enable(false); EP->H46018Enable(false);
#endif #endif
isEnabled = true; isEnabled = true;
return (m_handler->RegisterGatekeeper()); return (m_handler->RegisterGatekeeper());
} else { } else {
typedef std::vector<std::pair<LookupRecord,H323TransportSecurity> > type_rou tes; typedef std::vector<std::pair<LookupRecord,H323TransportSecurity> > type_rou tes;
type_routes routes; type_routes routes;
if (!FindRoutes(remoteAddr,routes,sec)) { if (!FindRoutes(remoteAddr, routes, sec)) {
PTRACE(2,"H46017\tNo Gatekeeper registration SRV Records found!"); PTRACE(2,"H46017\tNo Gatekeeper registration SRV Records found!");
return false; return false;
} }
type_routes::const_iterator r; type_routes::const_iterator r;
for (r = routes.begin(); r != routes.end(); ++r) { for (r = routes.begin(); r != routes.end(); ++r) {
const LookupRecord & rec = r->first; const LookupRecord & rec = r->first;
H323TransportAddress rem(rec.addr,rec.port); H323TransportAddress rem(rec.addr,rec.port);
const H323TransportSecurity & sec = r->second; const H323TransportSecurity & sec = r->second;
skipping to change at line 302 skipping to change at line 302
H46017Transport::~H46017Transport() H46017Transport::~H46017Transport()
{ {
Close(); Close();
} }
PBoolean FindH46017RAS(const H225_H323_UU_PDU & pdu, std::list<PBYTEArray> & ras ) PBoolean FindH46017RAS(const H225_H323_UU_PDU & pdu, std::list<PBYTEArray> & ras )
{ {
if (pdu.HasOptionalField(H225_H323_UU_PDU::e_genericData)) { if (pdu.HasOptionalField(H225_H323_UU_PDU::e_genericData)) {
const H225_ArrayOf_GenericData & data = pdu.m_genericData; const H225_ArrayOf_GenericData & data = pdu.m_genericData;
for (PINDEX i=0; i < data.GetSize(); i++) { for (PINDEX i = 0; i < data.GetSize(); i++) {
if (data[i].m_id == H460_FeatureID(17)) { if (data[i].m_id == H460_FeatureID(17)) {
H460_Feature feat((const H225_FeatureDescriptor &)data[i]); H460_Feature feat((const H225_FeatureDescriptor &)data[i]);
for (PINDEX i=0; i< feat.GetParameterCount(); ++i) { for (PINDEX i = 0; i< feat.GetParameterCount(); ++i) {
H460_FeatureParameter & param = feat.GetFeatureParameter(i); H460_FeatureParameter & param = feat.GetFeatureParameter(i);
if (param.ID() == 1 && param.hasContent()) { if (param.ID() == 1 && param.hasContent()) {
PASN_OctetString raw = param; PASN_OctetString raw = param;
ras.push_back(raw.GetValue()); ras.push_back(raw.GetValue());
} }
} }
} }
} }
} }
return (ras.size() > 0); return (!ras.empty());
} }
PBoolean H46017Transport::WriteRasPDU(const PBYTEArray & pdu) PBoolean H46017Transport::WriteRasPDU(const PBYTEArray & pdu)
{ {
if (remoteShutDown) if (remoteShutDown)
return false; return false;
H323SignalPDU rasPDU; H323SignalPDU rasPDU;
rasPDU.BuildRasFacility(); rasPDU.BuildRasFacility();
rasPDU.m_h323_uu_pdu.IncludeOptionalField(H225_H323_UU_PDU::e_genericData); rasPDU.m_h323_uu_pdu.IncludeOptionalField(H225_H323_UU_PDU::e_genericData);
H225_ArrayOf_GenericData & gdata = rasPDU.m_h323_uu_pdu.m_genericData; H225_ArrayOf_GenericData & gdata = rasPDU.m_h323_uu_pdu.m_genericData;
int sz = gdata.GetSize(); int sz = gdata.GetSize();
gdata.SetSize(sz+1); gdata.SetSize(sz+1);
H225_GenericData & data = gdata[sz]; H225_GenericData & data = gdata[sz];
H460_FeatureStd feat = H460_FeatureStd(17); H460_FeatureStd feat = H460_FeatureStd(17);
PASN_OctetString encFrame; PASN_OctetString encFrame;
encFrame.SetValue(pdu); encFrame.SetValue(pdu);
feat.Add(1,H460_FeatureContent(encFrame)); feat.Add(1,H460_FeatureContent(encFrame));
data = feat; data = feat;
rasPDU.BuildQ931(); rasPDU.BuildQ931();
PTRACE(6,"H46017\tSend " << rasPDU); PTRACE(6, "H46017\tSend " << rasPDU);
return WriteTunnel(rasPDU); return WriteTunnel(rasPDU);
} }
PBoolean H46017Transport::HandleH46017Socket() PBoolean H46017Transport::HandleH46017Socket()
{ {
for (;;) { for (;;) {
if (!IsOpen()) if (!IsOpen())
return false; return false;
skipping to change at line 407 skipping to change at line 407
return true; return true;
else if (HandleH46017SignalPDU(pdu)) else if (HandleH46017SignalPDU(pdu))
return true; return true;
else else
return false; return false;
} }
PBoolean H46017Transport::HandleH46017RAS(const H323SignalPDU & pdu) PBoolean H46017Transport::HandleH46017RAS(const H323SignalPDU & pdu)
{ {
std::list<PBYTEArray> ras; std::list<PBYTEArray> ras;
if ((pdu.GetQ931().GetMessageType() == Q931::FacilityMsg) && if ((pdu.GetQ931().GetMessageType() == Q931::FacilityMsg) && FindH46017RAS(p
FindH46017RAS(pdu.m_h323_uu_pdu,ras)) { du.m_h323_uu_pdu, ras)) {
H46017RasTransport * rasTransport = Feature->GetRasTransport(); H46017RasTransport * rasTransport = Feature->GetRasTransport();
for (std::list<PBYTEArray>::iterator r = ras.begin(); r != ras.end(); ++r ) { for (std::list<PBYTEArray>::iterator r = ras.begin(); r != ras.end(); ++r ) {
if (!rasTransport->ReceivedPDU(*r)) if (!rasTransport->ReceivedPDU(*r))
return false; return false;
} }
ras.clear(); ras.clear();
return true; return true;
} }
return false; return false;
} }
skipping to change at line 437 skipping to change at line 436
PThread::NormalPriority, PThread::NormalPriority,
"h46017signal:%x"); "h46017signal:%x");
} }
signalMutex.Wait(); signalMutex.Wait();
recdpdu.push(pdu); recdpdu.push(pdu);
signalMutex.Signal(); signalMutex.Signal();
msgRecd.Signal(); msgRecd.Signal();
return true; return true;
} }
void H46017Transport::SignalProcess(PThread &, H323_INT) void H46017Transport::SignalProcess(PThread &, H323_INT)
{ {
H323SignalPDU pdu; H323SignalPDU pdu;
PBoolean dataToProcess = false; PBoolean dataToProcess = false;
while (!closeTransport) { while (!closeTransport) {
msgRecd.Wait(); msgRecd.Wait();
while (!closeTransport && !recdpdu.empty()) { while (!closeTransport && !recdpdu.empty()) {
signalMutex.Wait(); signalMutex.Wait();
if (!recdpdu.empty()) { if (!recdpdu.empty()) {
pdu = recdpdu.front(); pdu = recdpdu.front();
dataToProcess = true; dataToProcess = true;
recdpdu.pop(); recdpdu.pop();
} }
signalMutex.Signal(); signalMutex.Signal();
if (dataToProcess) { if (dataToProcess) {
HandleH46017SignallingPDU(pdu.GetQ931().GetCallReference(),pdu); HandleH46017SignallingPDU(pdu.GetQ931().GetCallReference(), pdu) ;
dataToProcess = false; dataToProcess = false;
} }
} }
} }
} }
PBoolean H46017Transport::HandleH46017SignallingPDU(unsigned crv, H323SignalPDU & pdu) PBoolean H46017Transport::HandleH46017SignallingPDU(unsigned crv, H323SignalPDU & pdu)
{ {
H323Connection * connection = NULL; H323Connection * connection = NULL;
if ((pdu.GetQ931().GetMessageType() == Q931::SetupMsg)) if ((pdu.GetQ931().GetMessageType() == Q931::SetupMsg))
skipping to change at line 691 skipping to change at line 690
if (ras != NULL) { if (ras != NULL) {
delete ras; delete ras;
ras = NULL; ras = NULL;
} }
} }
PBoolean H46017Handler::CreateNewTransport(const H323TransportSecurity & securit y) PBoolean H46017Handler::CreateNewTransport(const H323TransportSecurity & securit y)
{ {
PTRACE(5, "H46017\tCreating Transport."); PTRACE(5, "H46017\tCreating Transport.");
curtransport = new H46017Transport(ep, curtransport = new H46017Transport(ep, PIPSocket::Address::GetAny(remoteAddr
PIPSocket::Address::GetAny(remoteAddress.GetIpVersion()), ess.GetIpVersion()), this);
this);
curtransport->InitialiseSecurity(&security); curtransport->InitialiseSecurity(&security);
curtransport->SetRemoteAddress(remoteAddress); curtransport->SetRemoteAddress(remoteAddress);
if (curtransport->Connect()) { if (curtransport->Connect()) {
PTRACE(3, "H46017\tConnected to " << curtransport->GetRemoteAddress()); PTRACE(3, "H46017\tConnected to " << curtransport->GetRemoteAddress());
new H46017TransportThread(curtransport->GetEndPoint(), curtransport); new H46017TransportThread(curtransport->GetEndPoint(), curtransport);
openTransport = true; openTransport = true;
return TRUE; return TRUE;
} }
 End of changes. 13 change blocks. 
20 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)