DynamicEngine::DynamicEngine( const string & id, const StringList & engineLibPaths ) { DEBUG( "dynamic: ctor: loading and configuring dynamic engine" ); ENGINE_load_dynamic(); ENGINE * dyn = ENGINE_by_id( "dynamic" ); if ( ! dyn ) throw Exception( "dynamic: load failed" ); m_pEngine = dyn; const string engineLibPath( findFirstExisting( engineLibPaths ) ); if ( engineLibPath.empty() ) throw Exception( "dynamic: unable to find engine lib path" ); DEBUG( "dynamic: ctor: so_path=" << QS( engineLibPath ) ); if ( 1 != ENGINE_ctrl_cmd_string( dyn, "SO_PATH", engineLibPath.c_str(), CMD_MANDATORY ) ) throw Exception( "dynamic: setting so_path <= " + QS( engineLibPath ) ); DEBUG( "dynamic: ctor: id=" << QS( id ) ); if ( 1 != ENGINE_ctrl_cmd_string( dyn, "ID", id.c_str(), CMD_MANDATORY ) ) throw Exception( "dynamic: setting id <= " + QS( id ) ); DEBUG( "dynamic: ctor: list_add=1" ); if ( 1 != ENGINE_ctrl_cmd( dyn, "LIST_ADD", 1, NULL, NULL, CMD_MANDATORY ) ) throw Exception( "dynamic: setting list_add <= 1" ); DEBUG( "dynamic: ctor: load=1" ); if ( 1 != ENGINE_ctrl_cmd( dyn, "LOAD", 1, NULL, NULL, CMD_MANDATORY ) ) throw Exception( "dynamic: setting load <= 1" ); DEBUG( "dynamic: ctor: done" ); }
template<class T> void QS(int low, int high, Array1D<T>& data) { int plow, phigh; T a,test; if (high>low) { a=data[low]; plow=low; phigh=high; test=data[phigh]; while (plow<phigh) { if (test<a) { data[plow]=test; plow++; test=data[plow]; } else { data[phigh]=test; phigh--; test=data[phigh]; } } data[plow]=a; QS(low,plow-1,data); QS(plow+1,high,data); } }
void DlgDependencies::AddDependencyItems(QTreeWidgetItem *i, SoaRw *r) { i->setText(0, QS(r->Name())); i->setText(1, QS(r->Tb()->Name())); SoaRwList l = r->GetDependencies(); for (SoaRwList::iterator d = l.begin(); d != l.end(); ++d) AddDependencyItems(new QTreeWidgetItem(i), *d); }
void QS(int v[], int left, int right) { int i,last; if (left>=right) return; swap(v,left,(left+right)/2); last = left; for (i=left+1;i<=right;i++) if (v[i]<v[left]) swap(v,++last,i); swap(v,left,last); QS(v,left,last-1); QS(v,last+1,right); }
BoundedFile::BoundedFile( const string & path, const int64_t end ) : m_sPath( path ), m_iEnd( end ), m_file( open( path.c_str(), O_RDONLY ) ), m_pBIO( BIO_new( &boundedMethods ) ) { if ( m_file < 0 ) throw OSError( "opening " + QS( path ) ); DEBUG( "bf: ctor: path=" << QS( path ) << ", end=" << end ); m_pBIO->ptr = this; m_pBIO->init = 1; }
A getSymKstack(void) { I n=K-MY;I *zp,i,s; C **ns=get_primlist(1,1); A z=gv(Et,n);zp=z->p; i=1; while(i<=n) { s=MY[i++]; if(0==s){*zp++=(I)aplus_nl;} else if(s>-9999&&s<6) { if(0>s)*zp++=(I)gi(-s); else *zp++=(I)gvi(Et,1,MS(si(ns[s]))); } else if(QV(s)) { *zp++=(I)gvi(Et,2,gsv(0,"file"),gsv(0,(C *)(s&~aplusMask))); *zp++=(I)gi(-MY[i++]); } else if(QS(s)) { *zp++=(I)gvi(Et,2,gsv(0,"expr"),gsv(0,(C *)(s&~aplusMask))); } else { A f=(A)s; sprintf((C *)ks_buf,"%s.%s",((CX)f->p[f->n+2])->s->n,XS(*f->d)->n); *zp++=(I)gvi(Et,2,gsv(0,"func"),gsv(0,(C *)ks_buf)); } } R z; }
unsigned long EnumTables::alignFormat(A sym_) /* This originated from AXAlign::format */ { unsigned long align=0; if (sym_!=0) { A *p=(A *)sym_->p; for (int i=0; i<(int)sym_->n; i++) { char *s=(char *)XS(sym_->p[i])->n; if (QS(p[i])) { unsigned long val = (unsigned long)alignEnumHashTable()->lookup(s); if (val==alignEnumHashTable()->notFound()) { cerr << "ã ! "; if (s!=0) cerr<<s; cerr<<": invalid alignment symbol"<<endl; } else { align |= val; } } } } if ((align&MSLeft)&&(align&MSRight)) align-=MSRight; if ((align&MSTop)&&(align&MSBottom)) align-=MSBottom; return align; }
void TokenEngine::login( const string & pin ) { if ( 1 != ENGINE_ctrl_cmd_string( m_pEngine, "PIN", pin.c_str(), CMD_MANDATORY ) ) throw Exception( "token: unable to log in" " with PIN=" + QS( pin ) ); }
int main() { int arr[] = {54,76,12,34,143,34,878,443}; printf("result: %d %d %d %d %d %d %d %d\n", arr[0],arr[1],arr[2],arr[3],arr[4],arr[5],arr[6],arr[7]); QS(arr,0,sizeof(arr)/sizeof(int)-1); printf("result: %d %d %d %d %d %d %d %d\n", arr[0],arr[1],arr[2],arr[3],arr[4],arr[5],arr[6],arr[7]); return 0; }
static C *getString(A aobj) { C *z; if (Ct==aobj->t)z=(C *)aobj->p; else if (Et==aobj->t&&1==aobj->n&&QS(*aobj->p))z=XS(*aobj->p)->n; else z=(C *)0; return z; }
void QS(int arr[], int start, int end) { int mid = (start+end)/2; int pivot = arr[mid]; int l=start, r=end; while (l<=r) { while (arr[l]<pivot) ++l; while (arr[r]>pivot) --r; if(l<=r) swap(&arr[l++],&arr[r--]); } if (start < r) QS(arr, start, r); if (end > l) QS(arr, l, end); }
int BoundedFile::read( char * buf, int bufLen ) { const off64_t cur( lseek64( m_file, 0, SEEK_CUR ) ); if ( cur == static_cast< off64_t >( -1 ) ) throw OSError( "finding current offset in " + QS( m_sPath ) ); const size_t len( static_cast< size_t >( ( m_iEnd < cur + bufLen ) ? m_iEnd - cur : bufLen ) ); const int rv = static_cast< int >( ::read( m_file, buf, len ) ); DEBUG_FINE( "bf-rd: " << QS( m_sPath ) << ": " "end=" << m_iEnd << ", cur=" << cur << ", " "len=" << len << ", rv=" << rv ); return rv; }
TokenEngine::TokenEngine( const StringList & modulePaths ) { ENGINE * tok = ENGINE_by_id( "pkcs11" ); if ( ! tok ) throw Exception( "token: unable to get engine" ); m_pEngine = tok; const string modulePath( findFirstExisting( modulePaths ) ); if ( modulePath.empty() ) throw Exception( "token: unable to find module path" ); DEBUG( "token: ctor: module_path=" << QS( modulePath ) ); if ( 1 != ENGINE_ctrl_cmd_string( tok, "MODULE_PATH", modulePath.c_str(), CMD_MANDATORY ) ) throw Exception( "token: setting module_path <= " + QS( modulePath ) ); DEBUG( "token: ctor: initializing " << m_pEngine ); if ( 1 != ENGINE_init( tok ) ) throw Exception( "token: unable to initialize" ); DEBUG( "token: ctor: done" ); }
void DlgLoadRegistry::LoadSlot() { if (!loading) { ui.textBrowser->clear(); // create domain names list QStringList domainNames; SoaTb *doms = wg->Db().Tb("ServiceDomain"); for (SoaTb::iterator d = doms->begin(); d != doms->end(); ++d) domainNames << QString::fromStdString((*d)->Ce("name")->Txt()); SoaRw *reg = wg->Db().Tb("RuntimeRegistry")->RwByViewId(regId); if (reg) { loader.Load( reg->ViewId(), QS(reg->Name()), QS(reg->Ce("url")->Txt()), QS(reg->Ce("username")->Txt()), ui.passwordEdit->text(), QS(reg->Ce("securityDomain")->Txt()), domainNames); loading = true; ui.passwordEdit->setEnabled(false); ui.mergeButton->setEnabled(false); ui.loadButton->setText("Cancel"); } } else loader.Cancel(); }
TokenEngine::PKeyPtr TokenEngine::getPrivKey( const string & label ) { const string keyId( "label_" + label ); EVP_PKEY * pkey = ENGINE_load_private_key( m_pEngine, keyId.c_str(), NULL, NULL ); DEBUG( "token: got pkey=" << pkey ); if ( ! pkey ) throw Exception( "token: unable to find private key" " with label=" + QS( label ) ); return PKeyPtr( pkey, [=]( EVP_PKEY * p ){ DEBUG( "gpk: releasing key " << keyId << " @" << p ); ENGINE_ctrl_cmd( m_pEngine, "RELEASE_KEY", 0, static_cast< void * >( p ), NULL, CMD_MANDATORY ); } ); }
void main(){ int N, i; /*vector de trabajo y vector resultado*/ int p, k; srand(getpid()); /*generamos un p aleatorio srand(getpid()); la semilla será el Pid del proceso int p=(rand()%(LVECT-2))+1; rango de p: [1, x] , x es la longitud del vector -1 (k-ésimo elemento) generamos un k aleatorio int k=rand()%(LVECT-1); rango de k: [0, LVECT -1] */ printf("Introduzca un valor para N:\n"); scanf("%d", &N); int v[N]; p=N/2; printf("Introduzca un valor para K:\n"); scanf("%d", &k); int inf=k-p/2; int sup=k+(p-p/2); printf("\nVector de números aleatorios:\n"); for (i=0; i<N; i++){ v[i]=rand()%100; printf("%d\t", v[i]); } int copia[N]; for(i=0; i< N; i++) copia[i]=v[i]; printf("\nVector ordenado con QS:\n"); QS(copia, 0, N-1); printvec(copia, N); printf("\n\ninf: %d\nsup: %d\n", inf, sup); pk(v, p, inf, sup, k); printf("\n"); printvec(v, N); }
void main(){ int v[LVECT], i; /*vector de trabajo y vector resultado*/ int p, k; srand(getpid()); printf("Introduzca un valor para P:\n"); scanf("%d", &p); printf("Introduzca un valor para K:\n"); scanf("%d", &k) ; int inf=k-p/2; /*Límite inferior*/ if(inf<0) inf=0; int sup=k+(p-p/2);/*Límite superior*/ if(sup>=LVECT) sup=LVECT-1; printf("\nVector de números aleatorios:\n"); /*Generamos el vector de números aleatorios valores 0-999*/ for (i=0; i<LVECT; i++){ v[i]=rand()%1000; printf("%d\t", v[i]); } int copia[LVECT]; /*Vector copia para comparar resultado final*/ for(i=0; i< LVECT; i++) copia[i]=v[i]; printf("\nVector ordenado con QS:\n"); QS(copia, 0, LVECT-1); printvec(copia, LVECT); printf("\n\ninf: %d\nsup: %d\n\n", inf, sup); printf("K-esimo elemento: %d\n", copia[k]); pk(v, p, inf, sup, k); /*Llamada al método pk*/ printf("====RESULTADO====\n"); for(i=inf; i<=sup; i++){ printf("%d\t", v[i]); } printf("\n\n"); }
Z H2(e2){ I z; I isWritableFile(); CX cx=Cx; ND2; z=*a->p; if (It==a->t||qz(a)) { if(dbg_txeq)xeqtrc((C *)w->p,3); if(w->c||isWritableFile((I)w))z=pexm((I)w->p,APL); else { C *buf=(C *)mab(w->n+1); memmove(buf,w->p,w->n+1); z=pexm((I)buf,APL); mf((I *)buf); } if(dbg_txeq)xeqtrc((C *)w->p,2); R z; } else R QS(z)?(Cx=cxi(XS(z)),z=e1(w),Cx=cx,z):(q=6,0); }
int main(int argc, char * argv[]) { #ifdef TSIM_DISABLE_CACHE /*Now I can disable the caches*/ #ifdef LEON3_CACHE asm("sta %g0, [%g0] 2"); #else asm("sethi %hi(0xfd800000), %g1"); asm("or %g1,%lo(0xfd800000),%g1"); asm("sethi %hi(0x80000014), %g2"); asm("or %g2,%lo(0x80000014),%g2"); asm("st %g1, [%g2]"); #endif #endif int o; int a[TO_SORT_SIZE]; for (o=0;o<TO_SORT_SIZE;o++) a[o]=rand() % 16384; QS(a,0,TO_SORT_SIZE - 1); return 0; }
GV0(C,k1){ I tzer=(Et==t&&n-u&&QS(((I*)w)[0]))?Et+1:t; !u?tmv(t,(I *)r,(I *)(w+Tt(t,v)),n): u<0?tmv(t,(I *)zer(tzer,(I *)r,-u),(I *)w,n+u): zer(tzer,(I *)tmv(t,(I *)r,(I *)(w+Tt(t,v)),n-u),u); }
Z H1(ts){A z;Z C *t[]={"int","float","char","null","box","sym","func", "unknown"}; W(gs(Et))*z->p=MS(si(t[QA(a)?(Et<a->t?6:Et>a->t?a->t:!a->n?3: Et==a->t?(QA(a=(A)*a->p)&&a->t<Xt?4:QS(a)?5:6):6): QP(a)?6:QX(a)?6:7]));R(I)z;}
GV0(C,x3){I tzer=(Et==t&&u&&QS(((I*)w)[0]))?Et+1:t;C *p=r+Tt(t,n);for(;r<p;)if(*a++)r=tmv(t,(I *)r,(I *)w,v),w+=(aw!=2)?Tt(t,v):0;else r=zer(tzer,(I *)r,v);}
void sort(Array1D<T>& data) { QS(0,data.size()-1,data); }
static S getSymbol(A aobj) { if (Et==aobj->t&&1==aobj->n&&QS(*aobj->p))return XS(*aobj->p); return (S)0; }
/*Quick Sort*/ void QS(int *array, int N){ int head; int i; int j; /*配列の個数が1つの場合終了。*/ if(N == 1){ return; } /*先頭の要素を避難。*/ head = array[0]; /*iを一番左、jを一番右に初期化、*/ i = 0; j = N - 1; /*iとjはどちらか一方が増える又はどちらか一方か減るので、必ずどこかでかち合う。(すれ違わない)*/ /*右からスキャンと左からスキャンをiとjがかち合うまで交互に繰り返す。*/ while(i != j){ /*右から左にスキャン。*/ while(i != j){ /*右側は基準値以上でなければならない。*/ /*右が基準値未満の場合。*/ if(array[j] < head){ /*左に右の値を書き込み、左を一つ右にずらす。*/ array[i] = array[j]; i++; /*左から右のスキャンに移る。*/ break; }else{ /*右が基準値以上の場合、右を一つ左にずらす。*/ j--; } } /*左から右にスキャン。*/ while(i != j){ /*左側は基準値未満でなければならない。*/ /*左が基準値以上の場合。*/ if(array[i] >= head){ /*右に左の値を書き込み、右を一つ左にずらす。*/ array[j] = array[i]; j--; /*右から左のスキャンに移る。*/ break; }else{ /*左が基準値未満の場合、左を一つ右にずらす。*/ i++; } } } /*かち合った場所に基準値を上書き。*/ array[i] = head; /*かち合った場所が一番左だと配列を分けられないので、その場合はその1つ右で分ける。*/ if(i == 0){ i = 1; } /*かち合った場所より左と、かち合った場所から右に配列を分ける。*/ /*より深い所のスワップ回数も加える。*/ QS(array, i); QS(array + i, N - i); }
void setBeamMSyncMode(A msyncMode_) { int i; int saveFlag=msyncFlag; if(msyncMode_->t==It) /* Allow explicit setting */ { msyncFlag=*msyncMode_->p; msyncMode=1; R; } if(msyncMode_->t!=Et || !QS(*msyncMode_->p) ) { q=ERR_DOMAIN; R; } msyncFlag=0; for(i=0; i<msyncMode_->n; i++) { if(msyncMode_->p[i]==MS(si("MS_ASYNC"))) { if(msyncFlag&MS_SYNC) { q=ERR_DOMAIN; } else { msyncFlag|=MS_ASYNC; msyncMode=1; } } else if(msyncMode_->p[i]==MS(si("MS_SYNC"))) { if(msyncFlag&MS_ASYNC) { q=ERR_DOMAIN; } else { msyncFlag|=MS_SYNC; msyncMode=1; } } else if(msyncMode_->p[i]==MS(si("MS_INVALIDATE"))) { msyncFlag|=MS_INVALIDATE; msyncMode=1; } else if(msyncMode_->p[i]==MS(si("none"))) { msyncMode=0; } else q=ERR_DOMAIN; } if(q) msyncFlag=saveFlag; }
BoundedFile::~BoundedFile() { BIO_free( m_pBIO ); DEBUG( "bf: dtor: path=" << QS( m_sPath ) ); }
void TurtleParser::parseToken(const Xtreeme::Token& c) { bool expected = false; switch (p->states.top().type) { case Normal: if (c.expr.isValid()) { p->states.top().tpl.subject = c.expr; p->states.top().type = Description; expected = true; } else if (c.code == QS("GRAPH")) { p->states.top().type = Graph; expected = true; } else if (c.code == QS("}") && !p->graphs.isEmpty()) { p->graphs.pop(); expected = true; } break; case Graph: if (c.expr.isValid()) { p->graphs.push(c.expr); p->states.top().type = Open; expected = true; } break; case Open: if (c.code == QS("{")) { p->states.top().type = Normal; expected = true; } break; case Description: if (c.expr.isValid()) { p->states.top().tpl.predicate = c.expr; p->states.top().type = Value; expected = true; } else if (c.code == QS("]") && p->states.size() >= 2) { p->states.pop(); expected = true; } break; case Value: if (c.expr.isValid()) { p->states.top().tpl.object = c.expr; p->states.top().type = EndOfStatement; if (!p->graphs.isEmpty()) p->states.top().tpl.context = p->graphs.top(); emit statement(p->states.top().tpl); expected = true; } break; case EndOfStatement: if (c.code == QS(".") && p->states.size() == 1) // Dot is not allowed in [ ... ] statements { p->states.top().type = Normal; expected = true; } else if (c.code == QS(";")) { p->states.top().type = Description; expected = true; } else if (c.code == QS(",")) { p->states.top().type = Value; expected = true; } else if (c.code == QS("}") && !p->graphs.isEmpty()) { p->graphs.pop(); expected = true; } else if (c.code == QS("]") && p->states.size() >= 2) { p->states.pop(); expected = true; } break; } if (c.code == QS("[")) { State s; s.type = Description; s.tpl.subject = c.expr; p->states.push(s); } if (!expected) throw new ParseError(ParseError::TurtleParser, "Unexpected: " + c.code); }
void Layer7::LoadSlot(QNetworkReply *reply) { switch (op) { case lsoStart: emit UpdateSignal("Loading started..."); Logger::ins.Header() << "Loading registry data from " << http.Url() << "data/ started...\r\n"; http.Propfind(http.Url() + "data/"); op = lsoListDomains; break; case lsoListDomains: if (reply->error() == QNetworkReply::NoError) { QString replyString(reply->readAll()); sl::log << "lsoListDomains: " << SQ(replyString) << sl::end; Propfinds elements = http.ParsePropfindReply(replyString); for (Propfinds::iterator e = elements.begin(); e != elements.end(); ++e) if (e->href != http.Url()) { domains.push_back(GtDomain(SQ(e->href), SQ(e->name))); Logger::ins.Info() << "Service domain: " << e->name << "\r\n"; emit UpdateSignal("Service Domain: " + e->name); } if (SelectFirstDomain()) { loaded = true; // check if all domains match domains from the db for (unsigned int d = 0; d < domains.size(); ++d) if (!sdoms.contains(QS(domains[d].name))) { loaded = false; Logger::ins.Error() << "Repository does not contain service domain named " << QS(domains[d].name) << "\r\n"; emit DoneSignal("Repository does not contain service domain named " + QS(domains[d].name)); } if (loaded) { op = lsoListServices; http.Propfind(QS(SelectedDomain().href) + "web/"); } } } else emit UpdateSignal(reply->errorString()); break; case lsoListServices: if (reply->error() == QNetworkReply::NoError) { QString replyString(reply->readAll()); sl::log << "lsoListServices: " << SQ(replyString) << sl::end; Propfinds elements = http.ParsePropfindReply(replyString); for (Propfinds::iterator e = elements.begin(); e != elements.end(); ++e) if (e->href != http.Url() && e->name != "OLD" && e->name != "REMOVED") { endpoints.push_back(GtEndpoint(item++ * 100 + REPO_TB_IDX, SelectedDomain().name, SQ(e->href), SQ(e->name))); Logger::ins.Info() << "Service: " << e->name << "\r\n"; emit UpdateSignal("Service: " + e->name); } } else emit UpdateSignal(reply->errorString()); if (SelectNextDomain()) http.Propfind(QS(SelectedDomain().href) + "web/"); else if (SelectFirstEndpoint()) { Logger::ins.Info() << "Parsing index files...\r\n"; emit UpdateSignal("Parsing index files..."); op = lsoGetIndexXml; Logger::ins.Info() << "Parsing " << QS(SelectedEndpoint().urlRegistryFolder) << "index.xml...\r\n"; http.Get(QS(SelectedEndpoint().urlRegistryFolder) + "index.xml"); } break; case lsoGetIndexXml: if (reply->error() == QNetworkReply::NoError) { QString replyString(reply->readAll()); sl::log << "lsoGetIndexXml: " << SQ(replyString) << sl::end; QDomDocument doc; doc.setContent(replyString); for (QDomElement r = doc.firstChildElement(); !r.isNull(); r = r.nextSiblingElement()) { if (r.nodeName() == "service") { for (QDomElement e = r.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) { if (e.nodeName() == "files") { for (QDomElement f = e.firstChildElement(); !f.isNull(); f = f.nextSiblingElement()) { QDomAttr r = f.attributeNode("root"), t = f.attributeNode("type"); if (!r.isNull() && r.nodeValue() == "true" && !t.isNull() && t.value() == "WSDL") SelectedEndpoint().urlWSDL = SQ(f.text()); } } else if (e.nodeName() == "name") SelectedEndpoint().intGivenName = SQ(e.text()); else if (e.nodeName() == "version") SelectedEndpoint().intGivenVersion = SQ(e.text()); else if (e.nodeName() == "policyVersion") SelectedEndpoint().policyVersion = SQ(e.text()); else if (e.nodeName() == "enabled") SelectedEndpoint().enabled = SQ(e.text()); else if (e.nodeName() == "soap") SelectedEndpoint().soap = SQ(e.text()); else if (e.nodeName() == "resolutionPath") SelectedEndpoint().resolutionPath = SQ(e.text()); else if (e.nodeName() == "id") SelectedEndpoint().intGivenId = SQ(e.text()); else if (e.nodeName() == "protectedEndpoint") SelectedEndpoint().protectedEndpoint = SQ(e.text()); } break; } } if (SelectedEndpoint().urlWSDL == "") { Logger::ins.Warning() << "WSDL file url not found for endpoint '" << QS(SelectedEndpoint().intGivenName) << "'\r\n"; emit UpdateSignal("WSDL file url not found for endpoint '" + QS(SelectedEndpoint().intGivenName) + "'"); SelectedEndpoint().serviceName = SelectedEndpoint().intGivenName; } if (SelectedEndpoint().protectedEndpoint == "") { Logger::ins.Warning() << "Ignoring non-protected endpoint '" << QS(SelectedEndpoint().intGivenName) << "'\r\n"; emit UpdateSignal("Ignoring non-protected endpoint '" + QS(SelectedEndpoint().intGivenName) + "'"); RemoveSelectedEndpoint(); } } else { Logger::ins.Error() << reply->errorString() << "\r\n"; emit UpdateSignal(reply->errorString()); } if (SelectNextEndpoint()) { Logger::ins.Info() << "Parsing " << QS(SelectedEndpoint().urlRegistryFolder) << "index.xml...\r\n"; http.Get(QS(SelectedEndpoint().urlRegistryFolder) + "index.xml"); } else if (SelectFirstEndpoint()) { Logger::ins.Info() << "Parsing WSDL files...\r\n"; emit UpdateSignal("Parsing WSDL files..."); op = lsoGetWsdl; Logger::ins.Info() << "Parsing " << QS(SelectedEndpoint().urlRegistryFolder + SelectedEndpoint().urlWSDL) << "\r\n"; http.Get(QS(SelectedEndpoint().urlRegistryFolder + SelectedEndpoint().urlWSDL)); } break; case lsoGetWsdl: if (reply->error() == QNetworkReply::NoError) { QString replyString(reply->readAll()); sl::log << "lsoGetWsdl: " << SQ(replyString) << sl::end; QDomDocument doc; doc.setContent(replyString); for (QDomElement r = doc.firstChildElement(); !r.isNull(); r = r.nextSiblingElement()) { if (r.nodeName() == "definitions" || r.nodeName() == "wsdl:definitions") { QDomAttr n = r.attributeNode("targetNamespace"); if (!n.isNull()) SelectedEndpoint().targetNamespace = SQ(n.nodeValue()); n = r.attributeNode("name"); if (!n.isNull()) SelectedEndpoint().definitionName = SQ(n.nodeValue()); // find all service names std::vector<std::string> serviceNames; for (QDomElement e = r.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) { if (e.nodeName() == "service" || e.nodeName() == "wsdl:service") { QDomAttr a = e.attributeNode("name"); if (!a.isNull()) serviceNames.push_back(SQ(a.nodeValue())); } } // assign service name if (serviceNames.size() == 1) SelectedEndpoint().serviceName = serviceNames[0]; else if (serviceNames.size() > 1) { // search service node name with best fit to protected endpoint string std::map<int, std::string> m; for (std::vector<std::string>::iterator s = serviceNames.begin(); s != serviceNames.end(); ++s) m.insert(std::pair<int, std::string>(LevenshteinDistance(SelectedEndpoint().protectedEndpoint, *s, true), *s)); SelectedEndpoint().serviceName = m.begin()->second; } else { Logger::ins.Warning() << "Service name not found for endpoint '" << QS(SelectedEndpoint().intGivenName) + "'\r\n"; emit UpdateSignal("Service name not found for endpoint '" + QS(SelectedEndpoint().intGivenName) + "'"); SelectedEndpoint().serviceName = SelectedEndpoint().intGivenName; } break; } } } else { Logger::ins.Error() << reply->errorString() << "\r\n"; emit UpdateSignal(reply->errorString()); } if (SelectNextEndpoint()) { Logger::ins.Info() << "Parsing " << QS(SelectedEndpoint().urlRegistryFolder + SelectedEndpoint().urlWSDL) << "\r\n"; http.Get(QS(SelectedEndpoint().urlRegistryFolder + SelectedEndpoint().urlWSDL)); } else { Logger::ins.Info() << "Finished loading registry.\r\n"; emit DoneSignal("Finished loading."); } break; default: ; } }