/** Connect to specified network. * * @param[in] dev_sess Device session. * @param[in] ssid_start Network SSID prefix. * @param[in] password Network password (pass empty string if not needed). * * @return EOK If the operation was successfully completed, * negative error code otherwise. * */ int ieee80211_connect(async_sess_t *dev_sess, char *ssid_start, char *password) { assert(ssid_start); sysarg_t rc_orig; async_exch_t *exch = async_exchange_begin(dev_sess); aid_t aid = async_send_1(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE), IEEE80211_CONNECT, NULL); sysarg_t rc = async_data_write_start(exch, ssid_start, str_size(ssid_start) + 1); if (rc != EOK) { async_exchange_end(exch); async_wait_for(aid, &rc_orig); if (rc_orig == EOK) return (int) rc; return (int) rc_orig; } // FIXME: Typecasting string literal if (password == NULL) password = (char *) ""; rc = async_data_write_start(exch, password, str_size(password) + 1); if (rc != EOK) { async_exchange_end(exch); async_wait_for(aid, &rc_orig); if (rc_orig == EOK) return (int) rc; return (int) rc_orig; } async_exchange_end(exch); async_wait_for(aid, &rc); if (rc != EOK) return rc; /* Send DHCP discover. */ nic_address_t wifi_mac; rc = nic_get_address(dev_sess, &wifi_mac); if (rc != EOK) return rc; sysarg_t link_id = get_link_id(wifi_mac.address); if (link_id == ((sysarg_t) -1)) return EINVAL; rc = dhcp_discover(link_id); return (int) rc; }
link_id g1_path_object_class::link_to(g1_team_type team, g1_path_object_class * obj) { //link_id ret=0; int t=total_links(); //we actually ignore the team //g1_path_object_class *c; for (int i=0; i<t; i++) { if (obj==get_link(i)) { return get_link_id(i); } } return 0; }
static int link_file(int dirfd, const char *filename, int type, unsigned long hash, unsigned char *digest) { char linkfn[32]; int id; id = get_link_id(type, hash, digest); if (id < 0) { fprintf(stderr, "WARNING: Skipping duplicate certificate in file %s\n", filename); return -1; } snprintf(linkfn, sizeof(linkfn), "%08lx.%s%d", hash, prefixes[type], id); fprintf(stdout, "%s => %s\n", linkfn, filename); if (symlinkat(filename, dirfd, linkfn) < 0) perror(linkfn); return 0; }