contrib/hostapd/hostapd/driver_prism54.c
static int prism54_get_seqnum(const char *ifname, void *priv, const u8 *addr,
			      int idx, u8 *seq)
{
	struct prism54_driver_data *drv = priv;
	struct obj_stasc *stasc;
	pimdev_hdr *hdr;
	size_t blen;
	int ret = 0;

	blen = sizeof(*stasc) + sizeof(*hdr);
	hdr = malloc(blen);
	if (hdr == NULL)
		return -1;

	stasc = (struct obj_stasc *) &hdr[1];
	
	if (addr == NULL)
		memset(&stasc->address[0], 0xff, ETH_ALEN);
	else
		memcpy(&stasc->address[0], addr, ETH_ALEN);

	hdr->oid = htonl(DOT11_OID_STASC);
	hdr->op = htonl(PIMOP_GET);
	stasc->keyid = idx;
	if (send(drv->pim_sock,hdr,blen,0) <= 0) {
		free(hdr);
		return -1;
	}
	if (prism54_waitpim(priv, DOT11_OID_STASC, hdr, blen, 10) <= 0) {
		ret = -1;
	} else {
		if (hdr->op == (int) htonl(PIMOP_RESPONSE)) {
			memcpy(seq + 2, &stasc->sc_high, ETH_ALEN);
			memset(seq, 0, 2);
		} else {
			ret = -1;
		}
	}
	free(hdr);

	return ret;
}
/* get TKIP station sequence counter, prism54 is only 6 bytes */
get TKIP station sequence counter, prism54 is only 6 bytes
get TKIP station sequence counter prism54 is only 6 bytes
static int prism54_get_seqnum(const char *ifname, void *priv, const u8 *addr,
			      int idx, u8 *seq)
{
	struct prism54_driver_data *drv = priv;
	struct obj_stasc *stasc;
	pimdev_hdr *hdr;
	size_t blen;
	int ret = 0;
	blen = sizeof(*stasc) + sizeof(*hdr);
	hdr = malloc(blen);
	if (hdr == NULL)
		return -1;
	stasc = (struct obj_stasc *) &hdr[1];
	if (addr == NULL)
		memset(&stasc->address[0], 0xff, ETH_ALEN);
	else
		memcpy(&stasc->address[0], addr, ETH_ALEN);
	hdr->oid = htonl(DOT11_OID_STASC);
	hdr->op = htonl(PIMOP_GET);
	stasc->keyid = idx;
	if (send(drv->pim_sock,hdr,blen,0) <= 0) {
		free(hdr);
		return -1;
	}
	if (prism54_waitpim(priv, DOT11_OID_STASC, hdr, blen, 10) <= 0) {
		ret = -1;
	} else {
		if (hdr->op == (int) htonl(PIMOP_RESPONSE)) {
			memcpy(seq + 2, &stasc->sc_high, ETH_ALEN);
			memset(seq, 0, 2);
		} else {
			ret = -1;
		}
	}
	free(hdr);
	return ret;
}
static int prism54_get_seqnum ( const char * ifname , void * priv , const u8 * addr , int idx , u8 * seq ) { struct prism54_driver_data * drv = priv ; struct obj_stasc * stasc ; pimdev_hdr * hdr ; size_t blen ; int ret = 0 ; blen = sizeof ( * stasc ) + sizeof ( * hdr ) ; hdr = malloc ( blen ) ; if ( hdr == NULL ) return -1 ; stasc = ( struct obj_stasc * ) & hdr [ 1 ] ; if ( addr == NULL ) memset ( & stasc -> address [ 0 ] , 0xff , ETH_ALEN ) ; else memcpy ( & stasc -> address [ 0 ] , addr , ETH_ALEN ) ; hdr -> oid = htonl ( DOT11_OID_STASC ) ; hdr -> op = htonl ( PIMOP_GET ) ; stasc -> keyid = idx ; if ( send ( drv -> pim_sock , hdr , blen , 0 ) <= 0 ) { free ( hdr ) ; return -1 ; } if ( prism54_waitpim ( priv , DOT11_OID_STASC , hdr , blen , 10 ) <= 0 ) { ret = -1 ; } else { if ( hdr -> op == ( int ) htonl ( PIMOP_RESPONSE ) ) { memcpy ( seq + 2 , & stasc -> sc_high , ETH_ALEN ) ; memset ( seq , 0 , 2 ) ; } else { ret = -1 ; } } free ( hdr ) ; return ret ; }
get TKIP station sequence counter, prism54 is only 6 bytes
get TKIP station sequence counter prism54 is only 6 bytes