private static ASNObj getDA_All(D_DirectoryEntry de, DirectoryRequest dr) { // boolean DEBUG = true; if (DEBUG) System.out.println("DS: getDA_All: not fully implemented!"); DirectoryAnswerMultipleIdentities dami = new DirectoryAnswerMultipleIdentities(); dami.directory_domain = dr.directory_domain; dami.directory_udp_port = dr.director_udp_port; addInstanceData(dami, dr.terms_default, de); for (D_DirectoryEntry de_crt : de.instances.values()) { // D_DirectoryEntry de_crt = de.instances.get(i.instance); addInstanceData(dami, dr.terms_default, de_crt); } // TODO Auto-generated method stub if (dami.remote_GIDhash == null) dami.remote_GIDhash = dr.globalIDhash; if (dami.remote_GIDhash == null) dami.remote_GIDhash = D_Peer.getGIDHashFromGID(dr.globalID); if (DEBUG) System.out.println("DS: getDA_All: done all with " + dami); return dami; }
private static ASNObj getDA_Only(D_DirectoryEntry de, DirectoryRequest dr) { // boolean DEBUG = true; if (DEBUG) System.out.println("DS: getDA_Only: enter"); DirectoryAnswerMultipleIdentities dami = new DirectoryAnswerMultipleIdentities(); dami.directory_domain = dr.directory_domain; dami.directory_udp_port = dr.director_udp_port; // dami.version = DirectoryAnswerMultipleIdentities.V3;//dr.version; if ((dr == null) || (dr.req_instances == null)) { if (_DEBUG) System.out.println("DS: getDA_Only: enter null dr=" + dr); // may support old versions of requests not having terms. addInstanceData(dami, null, de); } if ((dr != null) && (dr.req_instances != null)) { for (DirectoryRequestPerInstance i : dr.req_instances) { if (DEBUG) System.out.println("DS: getDA_Only: analyzing query: " + i); if (i.instance == null) { addInstanceData(dami, i.instance_terms, de); continue; } if (DEBUG) System.out.println("DS: getDA_Only: non NULL instance \"" + i.instance + "\""); if (!de.instances.containsKey(i.instance)) { if (DEBUG) System.out.println("DS: getDA_Only: unknown instance \"" + i.instance + "\""); continue; } D_DirectoryEntry de_crt = de.instances.get(i.instance); addInstanceData(dami, i.instance_terms, de_crt); /* DirectoryAnswerInstance e = new DirectoryAnswerInstance(); e.instance = de_crt.instance; //e.branch = de_crt.; //de_crt dami.known |= de_crt.known; e.signature_peer = de_crt.signature; dami.date_most_recent_among_instances = e.date_last_contact = de_crt.timestamp; if (de_crt.addresses != null) { if (DEBUG) System.out.println("DS: getDA_Only: got addresses #"+de_crt.addresses.length); for (int k=0; k < de_crt.addresses.length; k++) { if (DEBUG) System.out.println("DS: getDA_Only: adding address \""+k+"="+de_crt.addresses[k]+"\""); e.addresses.add(de_crt.addresses[k]); if (e.branch == null) e.branch = de_crt.addresses[k].branch; if (e.agent_version == null) e.agent_version = de_crt.addresses[k].getAgentVersionInts(); // here one can delete them from addresses and reset them later } } else { if (DEBUG) System.out.println("DS: getDA_Only: no addresses in de"); } if (dami.remote_GIDhash == null) dami.remote_GIDhash = de_crt.globalIDhash; if (dami.remote_GIDhash == null) dami.remote_GIDhash = D_Peer.getGIDHashFromGID(de_crt.globalID); e.date_last_contact = de_crt.timestamp; dami.instances.add(e); if (DEBUG) System.out.println("DS: getDA_Only: added instance: "+e+" from "+de_crt+" of "+de); */ } } if (dami.remote_GIDhash == null) dami.remote_GIDhash = dr.globalIDhash; if (dami.remote_GIDhash == null) dami.remote_GIDhash = D_Peer.getGIDHashFromGID(dr.globalID); return dami; }