Source
ssize_t uwb_rc_get_ie(struct uwb_rc *uwb_rc, struct uwb_rc_evt_get_ie **pget_ie)
/*
* Ultra Wide Band
* Information Element Handling
*
* Copyright (C) 2005-2006 Intel Corporation
* Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
* Reinette Chatre <reinette.chatre@intel.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
*
* FIXME: docs
*/
/**
* uwb_ie_next - get the next IE in a buffer
* @ptr: start of the buffer containing the IE data
* @len: length of the buffer
*
* Both @ptr and @len are updated so subsequent calls to uwb_ie_next()
* will get the next IE.
*
* NULL is returned (and @ptr and @len will not be updated) if there
* are no more IEs in the buffer or the buffer is too short.
*/
struct uwb_ie_hdr *uwb_ie_next(void **ptr, size_t *len)
{
struct uwb_ie_hdr *hdr;
size_t ie_len;
if (*len < sizeof(struct uwb_ie_hdr))
return NULL;
hdr = *ptr;
ie_len = sizeof(struct uwb_ie_hdr) + hdr->length;
if (*len < ie_len)
return NULL;
*ptr += ie_len;
*len -= ie_len;
return hdr;
}
EXPORT_SYMBOL_GPL(uwb_ie_next);
/**