/******************************************************************************* * wl_process_updated_record() ******************************************************************************* * * DESCRIPTION: * * Process the updated information record message signaled by the device. * * PARAMETERS: * * lp - a pointer to the device's private structure * * RETURNS: * * N/A * ******************************************************************************/ void wl_process_updated_record( struct wl_private *lp ) { DBG_FUNC( "wl_process_updated_record" ); DBG_ENTER( DbgInfo ); if( lp != NULL ) { lp->updatedRecord.u.u16[0] = CNV_LITTLE_TO_INT( lp->updatedRecord.u.u16[0] ); switch( lp->updatedRecord.u.u16[0] ) { case CFG_CUR_COUNTRY_INFO: DBG_TRACE( DbgInfo, "Updated Record: CFG_CUR_COUNTRY_INFO\n" ); wl_connect( lp ); break; case CFG_PORT_STAT: DBG_TRACE( DbgInfo, "Updated Record: WAIT_FOR_CONNECT (0xFD40)\n" ); //wl_connect( lp ); break; default: DBG_TRACE( DbgInfo, "UNKNOWN: 0x%04x\n", lp->updatedRecord.u.u16[0] ); } } DBG_LEAVE( DbgInfo ); return; } // wl_process_updated_record
void sta_connect(PROFILES *profile) { int i; printf("ssid: %s\n", profile->ssid); stainfo_g.mode = profile->mode; stainfo_g.chan = profile->chan; strncpy(stainfo_g.ssid, profile->ssid, 32); stainfo_g.rate = profile->rate; stainfo_g.wep = profile->wep; stainfo_g.wepkeylen = profile->wepkeylen; stainfo_g.wepkeyactive = profile->wepkeyactive; stainfo_g.sharedkeyauth = profile->sharedkeyauth; stainfo_g.brgmacclone = profile->brgmacclone; stainfo_g.preamble = profile->preamble; wl_connect(profile); }
static void select_net(struct cm* cm) { struct wl_network_t *candidate_net; struct wl_network_t *current_net; struct wl_ssid_t *ssid_p; int ret; /* Nothing to do */ if (0 == cm->candidate.ssid.len) { return; } current_net = wl_get_current_network(); candidate_net = find_best_candidate(cm); /* Connected to the candidate? ... */ if ( current_net == candidate_net ) { if ( current_net ) { /* ...yes, dont change. */ return; } } /* Roaming checks */ if (current_net && candidate_net) { /* Are we changing BSSs? */ if ( equal_ssid(&candidate_net->ssid, ¤t_net->ssid)) { /* ...no. Does the currently connected * net have a decent RSSI?...*/ if ( current_net->rssi > ROAMING_RSSI_THRESHOLD ) { /* ...yes, stay with it. */ return; } /* ...no. Does the candidate have * sufficiently better RSSI to * motivate a switch to it? */ if ( candidate_net->rssi < current_net->rssi + ROAMING_RSSI_DIFF) { return; } /* ...yes, try to roam to candidate_net */ CM_DPRINTF("CM: Roaming from rssi %d to %d\n", current_net->rssi, candidate_net->rssi); } } /* a candidate is found */ if (candidate_net) { /* We connect to a specific bssid here because * find_best_candidate() might have picked a * particulare AP among many with the same SSID. * wl_connect() would pick one of them at random. */ ret = wl_connect_bssid(candidate_net->bssid); } /* no candidate found */ else { CM_DPRINTF("CM: No candidate found for ssid \"%s\"\n", ssid2str(&cm->candidate.ssid)); /* Might be a hidden SSID so we try to connect to it. * wl_connect() will trigger a directed scan * for the SSID in this case. */ ssid_p = &cm->candidate.ssid; ret = wl_connect(ssid_p->ssid, ssid_p->len); } switch (ret) { case WL_SUCCESS : return; case WL_BUSY: wl_disconnect(); return; case WL_RETRY: break; default : CM_DPRINTF("CM: failed to connect\n"); break; } /* some operation failed or no candidate found */ if (wl_scan() != WL_SUCCESS) CM_DPRINTF("CM: failed to scan\n"); }