/** * oh_request_new_domain * @hid: a handler id that is requesting the domain * @tag: a tag to put in the domain being requested * @capabilities: capabilities of the requested domain * @pdid: make new domain with this parent? if so, has to be > 0. * @bdid: make new domain with this peer/brother? if so, has to be > 0. * * Creates a new domain and adds it to the list of domains * that the handler (@handler_id) can report events/resources on. * * Returns: domain id of new domain requested, or 0 if an error ocurred. **/ SaHpiDomainIdT oh_request_new_domain_aitimeout( unsigned int hid, SaHpiTextBufferT *tag, SaHpiDomainCapabilitiesT capabilities, SaHpiTimeoutT aitimeout, SaHpiDomainIdT pdid, SaHpiDomainIdT bdid) { SaHpiDomainIdT did = 0; if (hid < 1) { dbg("Warning - invalid handler id parameter passed."); return 0; } if (pdid == 0) { pdid = oh_get_default_domain_id(); } did = oh_create_domain(capabilities, aitimeout, tag); if (did == 0) { dbg("New domain request failed."); return 0; } oh_add_domain_to_handler(hid, did); /* Connect new domain as a child of pdid domain */ if (connect_parent(did, pdid)) { oh_destroy_domain(did); dbg("Operation failed." " Could not connect new domain to parent %d.", pdid); return 0; } /* Connect new domain as a brother of bdid domain */ if (connect_peers(did, bdid)) { oh_destroy_domain(did); dbg("Operation failed." " Could not make new domain peer of domain %d.", bdid); return 0; } return did; }
/** * Callback to be called when the requested peer information is available * * @param cb_cls the closure from GNUNET_TETSBED_peer_get_information() * @param op the operation this callback corresponds to * @param pinfo the result; will be NULL if the operation has failed * @param emsg error message if the operation has failed; will be NULL if the * operation is successfull */ static void peerinfo_cb (void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, const char *emsg) { int res; GNUNET_assert (GNUNET_TESTBED_PIT_CONFIGURATION == pinfo->pit); if (GNUNET_NO == dave_is_setup) res = setup_dave (pinfo->result.cfg); else if (GNUNET_NO == bob_is_setup) res = setup_bob (pinfo->result.cfg); else res = setup_alice (pinfo->result.cfg); if (get_cfg_ops[0] == op) get_cfg_ops[0] = NULL; else if (get_cfg_ops[1] == op) get_cfg_ops[1] = NULL; else get_cfg_ops[2] = NULL; GNUNET_TESTBED_operation_done (op); op = NULL; if (GNUNET_SYSERR == res) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to setup peer \n"); end_badly_now(); } else connect_peers (); /*if (get_cfg_ops[0] == op) { GNUNET_assert (GNUNET_TESTBED_PIT_CONFIGURATION == pinfo->pit); res = setup_dave (pinfo->result.cfg); GNUNET_TESTBED_operation_done (get_cfg_ops[0]); get_cfg_ops[0] = NULL; if (GNUNET_SYSERR == res) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to setup dave \n"); end_badly_now(); } else { connect_peers (); } } else if (get_cfg_ops[1] == op) { GNUNET_assert (GNUNET_TESTBED_PIT_CONFIGURATION == pinfo->pit); res = setup_bob (pinfo->result.cfg); GNUNET_TESTBED_operation_done (get_cfg_ops[1]); get_cfg_ops[1] = NULL; if (GNUNET_SYSERR == res) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to setup dave \n"); end_badly_now(); } else { connect_peers (); } } else if (get_cfg_ops[2] == op) { GNUNET_assert (GNUNET_TESTBED_PIT_CONFIGURATION == pinfo->pit); res = setup_alice (pinfo->result.cfg); GNUNET_TESTBED_operation_done (get_cfg_ops[2]); get_cfg_ops[2] = NULL; if (GNUNET_SYSERR == res) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to setup dave \n"); end_badly_now(); } else { connect_peers (); } }*/ }