本文整理汇总了C++中wpabuf_put_le16函数的典型用法代码示例。如果您正苦于以下问题:C++ wpabuf_put_le16函数的具体用法?C++ wpabuf_put_le16怎么用?C++ wpabuf_put_le16使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpabuf_put_le16函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: anqp_add_venue_name
static void anqp_add_venue_name(struct hostapd_data *hapd, struct wpabuf *buf,
struct gas_dialog_info *di)
{
if (hapd->conf->hs20_venue_name) {
wpabuf_put_le16(buf, ANQP_VENUE_NAME);
wpabuf_put_le16(buf, hapd->conf->hs20_venue_name_len);
wpabuf_put_data(buf, hapd->conf->hs20_venue_name,
hapd->conf->hs20_venue_name_len);
} else if (hapd->conf->venue_name) {
u8 *len;
unsigned int i;
len = gas_anqp_add_element(buf, ANQP_VENUE_NAME);
wpabuf_put_u8(buf, hapd->conf->venue_group);
wpabuf_put_u8(buf, hapd->conf->venue_type);
for (i = 0; i < hapd->conf->venue_name_count; i++) {
struct hostapd_venue_name *vn;
vn = &hapd->conf->venue_name[i];
wpabuf_put_u8(buf, 3 + vn->name_len);
wpabuf_put_data(buf, vn->lang, 3);
wpabuf_put_data(buf, vn->name, vn->name_len);
}
gas_anqp_set_element_len(buf, len);
} else if (di) {
wpabuf_put_data(buf, di->venue_name, di->venue_name_len);
}
}
示例2: p2p_build_gas_comeback_resp
static struct wpabuf * p2p_build_gas_comeback_resp(u8 dialog_token,
u16 status_code,
u16 update_indic,
const u8 *data, size_t len,
u8 frag_id, u8 more,
u16 total_len)
{
struct wpabuf *buf;
buf = gas_anqp_build_comeback_resp(dialog_token, status_code, frag_id,
more, 0, 100 + len);
if (buf == NULL)
return NULL;
if (frag_id == 0) {
/* ANQP Query Response Frame */
wpabuf_put_le16(buf, ANQP_VENDOR_SPECIFIC); /* Info ID */
wpabuf_put_le16(buf, 3 + 1 + 2 + total_len);
wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
/* Service Update Indicator */
wpabuf_put_le16(buf, update_indic);
}
wpabuf_put_data(buf, data, len);
gas_anqp_set_len(buf);
return buf;
}
示例3: anqp_add_domain_name
static void anqp_add_domain_name(struct hostapd_data *hapd, struct wpabuf *buf)
{
if (hapd->conf->domain_name) {
wpabuf_put_le16(buf, ANQP_DOMAIN_NAME);
wpabuf_put_le16(buf, hapd->conf->domain_name_len);
wpabuf_put_data(buf, hapd->conf->domain_name,
hapd->conf->domain_name_len);
}
}
示例4: anqp_add_nai_realm
static void anqp_add_nai_realm(struct hostapd_data *hapd, struct wpabuf *buf,
struct gas_dialog_info *di,
struct anqp_query_info *qi, int nai_realm,
int nai_home_realm)
{
/* dynamically set nai_realm_list overrides static configuration */
if (nai_realm && hapd->conf->hs20_nai_realm_list) {
wpabuf_put_le16(buf, ANQP_NAI_REALM);
wpabuf_put_le16(buf, hapd->conf->hs20_nai_realm_list_len);
wpabuf_put_data(buf, hapd->conf->hs20_nai_realm_list,
hapd->conf->hs20_nai_realm_list_len);
} else if (nai_realm && hapd->conf->nai_realm_data) {
u8 *len;
unsigned int i, j;
len = gas_anqp_add_element(buf, ANQP_NAI_REALM);
wpabuf_put_le16(buf, hapd->conf->nai_realm_count);
for (i = 0; i < hapd->conf->nai_realm_count; i++) {
u8 *realm_data_len, *realm_len;
struct hostapd_nai_realm_data *realm;
realm = &hapd->conf->nai_realm_data[i];
realm_data_len = wpabuf_put(buf, 2);
wpabuf_put_u8(buf, realm->encoding);
realm_len = wpabuf_put(buf, 1);
for (j = 0; realm->realm[j]; j++) {
if (j > 0)
wpabuf_put_u8(buf, ';');
wpabuf_put_str(buf, realm->realm[j]);
}
*realm_len = (u8 *) wpabuf_put(buf, 0) - realm_len - 1;
if (realm->num_auths) {
wpabuf_put_u8(buf, 1); /* EAP method count */
wpabuf_put_u8(buf, 2 + (3 * realm->num_auths));
wpabuf_put_u8(buf, realm->eap_method);
wpabuf_put_u8(buf, realm->num_auths);
for (j = 0; j < realm->num_auths; j++) {
wpabuf_put_u8(buf, realm->auth_id[j]);
wpabuf_put_u8(buf, 1);
wpabuf_put_u8(buf, realm->auth_val[j]);
}
} else {
wpabuf_put_u8(buf, 0); /* EAP method count */
}
gas_anqp_set_element_len(buf, realm_data_len);
}
gas_anqp_set_element_len(buf, len);
} else if (nai_home_realm && hapd->conf->nai_realm_data) {
process_hs_nai_home_realm(hapd, buf, qi);
} else if (di) {
if (nai_realm)
wpabuf_put_data(buf, di->nai_realm,
di->nai_realm_len);
if (nai_home_realm)
wpabuf_put_data(buf, di->nai_home_realm,
di->nai_home_realm_len);
}
}
示例5: anqp_add_ip_addr_type_availability
static void anqp_add_ip_addr_type_availability(struct hostapd_data *hapd,
struct wpabuf *buf)
{
if (hapd->conf->ipaddr_type_configured) {
wpabuf_put_le16(buf, ANQP_IP_ADDR_TYPE_AVAILABILITY);
wpabuf_put_le16(buf, 1);
wpabuf_put_u8(buf, hapd->conf->ipaddr_type_availability);
}
}
示例6: anqp_add_network_auth_type
static void anqp_add_network_auth_type(struct hostapd_data *hapd,
struct wpabuf *buf)
{
if (hapd->conf->network_auth_type) {
wpabuf_put_le16(buf, ANQP_NETWORK_AUTH_TYPE);
wpabuf_put_le16(buf, hapd->conf->network_auth_type_len);
wpabuf_put_data(buf, hapd->conf->network_auth_type,
hapd->conf->network_auth_type_len);
}
}
示例7: anqp_add_3gpp_cellular_network
static void anqp_add_3gpp_cellular_network(struct hostapd_data *hapd,
struct wpabuf *buf)
{
if (hapd->conf->anqp_3gpp_cell_net) {
wpabuf_put_le16(buf, ANQP_3GPP_CELLULAR_NETWORK);
wpabuf_put_le16(buf,
hapd->conf->anqp_3gpp_cell_net_len);
wpabuf_put_data(buf, hapd->conf->anqp_3gpp_cell_net,
hapd->conf->anqp_3gpp_cell_net_len);
}
}
示例8: p2p_buf_add_ext_listen_timing
void p2p_buf_add_ext_listen_timing(struct wpabuf *buf, u16 period,
u16 interval)
{
/* Extended Listen Timing */
wpabuf_put_u8(buf, P2P_ATTR_EXT_LISTEN_TIMING);
wpabuf_put_le16(buf, 4);
wpabuf_put_le16(buf, period);
wpabuf_put_le16(buf, interval);
wpa_printf(MSG_DEBUG, "P2P: * Extended Listen Timing (period %u msec "
"interval %u msec)", period, interval);
}
示例9: anqp_add_icon_binary_file
static void anqp_add_icon_binary_file(struct hostapd_data *hapd,
struct wpabuf *buf,
const u8 *name, size_t name_len)
{
struct hs20_icon *icon;
size_t i;
u8 *len;
wpa_hexdump_ascii(MSG_DEBUG, "HS 2.0: Requested Icon Filename",
name, name_len);
for (i = 0; i < hapd->conf->hs20_icons_count; i++) {
icon = &hapd->conf->hs20_icons[i];
if (name_len == os_strlen(icon->name) &&
os_memcmp(name, icon->name, name_len) == 0)
break;
}
if (i < hapd->conf->hs20_icons_count)
icon = &hapd->conf->hs20_icons[i];
else
icon = NULL;
len = gas_anqp_add_element(buf, ANQP_VENDOR_SPECIFIC);
wpabuf_put_be24(buf, OUI_WFA);
wpabuf_put_u8(buf, HS20_ANQP_OUI_TYPE);
wpabuf_put_u8(buf, HS20_STYPE_ICON_BINARY_FILE);
wpabuf_put_u8(buf, 0); /* Reserved */
if (icon) {
char *data;
size_t data_len;
data = os_readfile(icon->file, &data_len);
if (data == NULL || data_len > 65535) {
wpabuf_put_u8(buf, 2); /* Download Status:
* Unspecified file error */
wpabuf_put_u8(buf, 0);
wpabuf_put_le16(buf, 0);
} else {
wpabuf_put_u8(buf, 0); /* Download Status: Success */
wpabuf_put_u8(buf, os_strlen(icon->type));
wpabuf_put_str(buf, icon->type);
wpabuf_put_le16(buf, data_len);
wpabuf_put_data(buf, data, data_len);
}
os_free(data);
} else {
wpabuf_put_u8(buf, 1); /* Download Status: File not found */
wpabuf_put_u8(buf, 0);
wpabuf_put_le16(buf, 0);
}
gas_anqp_set_element_len(buf, len);
}
示例10: anqp_add_ip_addr_type_availability
static void anqp_add_ip_addr_type_availability(struct hostapd_data *hapd,
struct wpabuf *buf,
struct gas_dialog_info *di)
{
if (hapd->conf->hs20_ipaddr_type_configured) {
wpabuf_put_le16(buf, ANQP_IP_ADDR_TYPE_AVAILABILITY);
wpabuf_put_le16(buf, 1);
wpabuf_put_u8(buf, hapd->conf->hs20_ipaddr_type_availability);
} else if (di) {
wpabuf_put_data(buf, di->ipaddr_type, di->ipaddr_type_len);
}
}
示例11: anqp_add_domain_name
static void anqp_add_domain_name(struct hostapd_data *hapd, struct wpabuf *buf,
struct gas_dialog_info *di)
{
if (hapd->conf->hs20_domain_name_list_value) {
wpabuf_put_le16(buf, ANQP_DOMAIN_NAME);
wpabuf_put_le16(buf,
hapd->conf->hs20_domain_name_list_len);
wpabuf_put_data(buf, hapd->conf->hs20_domain_name_list_value,
hapd->conf->hs20_domain_name_list_len);
} else if (di) {
wpabuf_put_data(buf, di->domain_name, di->domain_name_len);
}
}
示例12: anqp_add_network_auth_type
static void anqp_add_network_auth_type(struct hostapd_data *hapd,
struct wpabuf *buf,
struct gas_dialog_info *di)
{
if (hapd->conf->hs20_network_auth_type) {
wpabuf_put_le16(buf, ANQP_NETWORK_AUTH_TYPE);
wpabuf_put_le16(buf, hapd->conf->hs20_network_auth_type_len);
wpabuf_put_data(buf, hapd->conf->hs20_network_auth_type,
hapd->conf->hs20_network_auth_type_len);
} else if (di) {
wpabuf_put_data(buf, di->net_auth_type, di->net_auth_type_len);
}
}
示例13: anqp_add_capab_list
static void anqp_add_capab_list(struct hostapd_data *hapd,
struct wpabuf *buf)
{
u8 *len;
len = gas_anqp_add_element(buf, ANQP_CAPABILITY_LIST);
wpabuf_put_le16(buf, ANQP_CAPABILITY_LIST);
if (hapd->conf->venue_name)
wpabuf_put_le16(buf, ANQP_VENUE_NAME);
if (hapd->conf->network_auth_type)
wpabuf_put_le16(buf, ANQP_NETWORK_AUTH_TYPE);
if (hapd->conf->roaming_consortium)
wpabuf_put_le16(buf, ANQP_ROAMING_CONSORTIUM);
if (hapd->conf->ipaddr_type_configured)
wpabuf_put_le16(buf, ANQP_IP_ADDR_TYPE_AVAILABILITY);
if (hapd->conf->nai_realm_data)
wpabuf_put_le16(buf, ANQP_NAI_REALM);
if (hapd->conf->anqp_3gpp_cell_net)
wpabuf_put_le16(buf, ANQP_3GPP_CELLULAR_NETWORK);
if (hapd->conf->domain_name)
wpabuf_put_le16(buf, ANQP_DOMAIN_NAME);
#ifdef CONFIG_HS20
anqp_add_hs_capab_list(hapd, buf);
#endif /* CONFIG_HS20 */
gas_anqp_set_element_len(buf, len);
}
示例14: anqp_add_3gpp_cellular_network
static void anqp_add_3gpp_cellular_network(struct hostapd_data *hapd,
struct wpabuf *buf,
struct gas_dialog_info *di)
{
if (hapd->conf->hs20_3gpp_cellular_network) {
wpabuf_put_le16(buf, ANQP_3GPP_CELLULAR_NETWORK);
wpabuf_put_le16(buf,
hapd->conf->hs20_3gpp_cellular_network_len);
wpabuf_put_data(buf, hapd->conf->hs20_3gpp_cellular_network,
hapd->conf->hs20_3gpp_cellular_network_len);
} else if (di) {
wpabuf_put_data(buf, di->cell_net, di->cell_net_len);
}
}
示例15: anqp_add_capab_list
static void anqp_add_capab_list(struct hostapd_data *hapd,
struct wpabuf *buf)
{
u8 *len;
len = gas_anqp_add_element(buf, ANQP_CAPABILITY_LIST);
wpabuf_put_le16(buf, ANQP_CAPABILITY_LIST);
if (hapd->conf->venue_name || hapd->conf->hs20_venue_name ||
(hapd->anqp_type_mask & ANQP_REQ_VENUE_NAME))
wpabuf_put_le16(buf, ANQP_VENUE_NAME);
if (hapd->conf->hs20_network_auth_type ||
(hapd->anqp_type_mask & ANQP_REQ_NETWORK_AUTH_TYPE))
wpabuf_put_le16(buf, ANQP_NETWORK_AUTH_TYPE);
if (hapd->conf->roaming_consortium ||
(hapd->anqp_type_mask & ANQP_REQ_ROAMING_CONSORTIUM))
wpabuf_put_le16(buf, ANQP_ROAMING_CONSORTIUM);
if (hapd->conf->hs20_ipaddr_type_configured ||
(hapd->anqp_type_mask & ANQP_REQ_IP_ADDR_TYPE_AVAILABILITY))
wpabuf_put_le16(buf, ANQP_IP_ADDR_TYPE_AVAILABILITY);
if (hapd->conf->hs20_nai_realm_list ||
hapd->conf->nai_realm_data ||
(hapd->anqp_type_mask & ANQP_REQ_NAI_REALM))
wpabuf_put_le16(buf, ANQP_NAI_REALM);
if (hapd->conf->hs20_3gpp_cellular_network ||
(hapd->anqp_type_mask & ANQP_REQ_3GPP_CELLULAR_NETWORK))
wpabuf_put_le16(buf, ANQP_3GPP_CELLULAR_NETWORK);
if (hapd->conf->hs20_domain_name_list_value ||
(hapd->anqp_type_mask & ANQP_REQ_DOMAIN_NAME))
wpabuf_put_le16(buf, ANQP_DOMAIN_NAME);
anqp_add_hs_capab_list(hapd, buf);
gas_anqp_set_element_len(buf, len);
}