static int fbsd_read(struct wif *wi, unsigned char *h80211, int len, struct rx_info *ri) { struct priv_fbsd *pf = wi_priv(wi); unsigned char *wh; int plen; assert(len > 0); /* need to read more */ if (pf->pf_totlen == 0) { pf->pf_totlen = read(pf->pf_fd, pf->pf_buf, sizeof(pf->pf_buf)); if (pf->pf_totlen == -1) { pf->pf_totlen = 0; return -1; } pf->pf_next = pf->pf_buf; } /* read 802.11 packet */ wh = get_80211(pf, &plen, ri); if (plen > len) plen = len; assert(plen > 0); memcpy(h80211, wh, plen); if(ri && !ri->ri_channel) ri->ri_channel = wi_get_channel(wi); return plen; }
status_t BNetworkDevice::GetNextAssociatedNetwork(uint32& cookie, BNetworkAddress& address) { // We currently support only a single associated network if (cookie != 0) return B_ENTRY_NOT_FOUND; uint8 mac[IEEE80211_ADDR_LEN]; int32 length = IEEE80211_ADDR_LEN; status_t status = get_80211(Name(), IEEE80211_IOC_BSSID, mac, length); if (status != B_OK) return status; if (mac[0] == 0 && mac[1] == 0 && mac[2] == 0 && mac[3] == 0 && mac[4] == 0 && mac[5] == 0) { return B_ENTRY_NOT_FOUND; } address.SetToLinkLevel(mac, IEEE80211_ADDR_LEN); cookie++; return B_OK; }