Lines Matching refs:buf
20 struct wpabuf *buf; in gas_build_req() local
22 buf = wpabuf_alloc(100 + size); in gas_build_req()
23 if (buf == NULL) in gas_build_req()
26 wpabuf_put_u8(buf, WLAN_ACTION_PUBLIC); in gas_build_req()
27 wpabuf_put_u8(buf, action); in gas_build_req()
28 wpabuf_put_u8(buf, dialog_token); in gas_build_req()
30 return buf; in gas_build_req()
51 struct wpabuf *buf; in gas_build_resp() local
53 buf = wpabuf_alloc(100 + size); in gas_build_resp()
54 if (buf == NULL) in gas_build_resp()
57 wpabuf_put_u8(buf, WLAN_ACTION_PUBLIC); in gas_build_resp()
58 wpabuf_put_u8(buf, action); in gas_build_resp()
59 wpabuf_put_u8(buf, dialog_token); in gas_build_resp()
60 wpabuf_put_le16(buf, status_code); in gas_build_resp()
62 wpabuf_put_u8(buf, frag_id | (more ? 0x80 : 0)); in gas_build_resp()
63 wpabuf_put_le16(buf, comeback_delay); in gas_build_resp()
65 return buf; in gas_build_resp()
99 static void gas_add_adv_proto_anqp(struct wpabuf *buf, u8 query_resp_len_limit, in gas_add_adv_proto_anqp() argument
103 wpabuf_put_u8(buf, WLAN_EID_ADV_PROTO); in gas_add_adv_proto_anqp()
104 wpabuf_put_u8(buf, 2); /* Length */ in gas_add_adv_proto_anqp()
105 wpabuf_put_u8(buf, (query_resp_len_limit & 0x7f) | in gas_add_adv_proto_anqp()
108 wpabuf_put_u8(buf, ACCESS_NETWORK_QUERY_PROTOCOL); in gas_add_adv_proto_anqp()
114 struct wpabuf *buf; in gas_anqp_build_initial_req() local
116 buf = gas_build_initial_req(dialog_token, 4 + size); in gas_anqp_build_initial_req()
117 if (buf == NULL) in gas_anqp_build_initial_req()
120 gas_add_adv_proto_anqp(buf, 0, 0); in gas_anqp_build_initial_req()
122 wpabuf_put(buf, 2); /* Query Request Length to be filled */ in gas_anqp_build_initial_req()
124 return buf; in gas_anqp_build_initial_req()
131 struct wpabuf *buf; in gas_anqp_build_initial_resp() local
133 buf = gas_build_initial_resp(dialog_token, status_code, comeback_delay, in gas_anqp_build_initial_resp()
135 if (buf == NULL) in gas_anqp_build_initial_resp()
138 gas_add_adv_proto_anqp(buf, 0x7f, 0); in gas_anqp_build_initial_resp()
140 wpabuf_put(buf, 2); /* Query Response Length to be filled */ in gas_anqp_build_initial_resp()
142 return buf; in gas_anqp_build_initial_resp()
151 struct wpabuf *buf; in gas_anqp_build_initial_resp_buf() local
153 buf = gas_anqp_build_initial_resp(dialog_token, status_code, in gas_anqp_build_initial_resp_buf()
156 if (buf == NULL) in gas_anqp_build_initial_resp_buf()
160 wpabuf_put_buf(buf, payload); in gas_anqp_build_initial_resp_buf()
162 gas_anqp_set_len(buf); in gas_anqp_build_initial_resp_buf()
164 return buf; in gas_anqp_build_initial_resp_buf()
172 struct wpabuf *buf; in gas_anqp_build_comeback_resp() local
174 buf = gas_build_comeback_resp(dialog_token, status_code, in gas_anqp_build_comeback_resp()
176 if (buf == NULL) in gas_anqp_build_comeback_resp()
179 gas_add_adv_proto_anqp(buf, 0x7f, 0); in gas_anqp_build_comeback_resp()
181 wpabuf_put(buf, 2); /* Query Response Length to be filled */ in gas_anqp_build_comeback_resp()
183 return buf; in gas_anqp_build_comeback_resp()
193 struct wpabuf *buf; in gas_anqp_build_comeback_resp_buf() local
195 buf = gas_anqp_build_comeback_resp(dialog_token, status_code, frag_id, in gas_anqp_build_comeback_resp_buf()
198 if (buf == NULL) in gas_anqp_build_comeback_resp_buf()
202 wpabuf_put_buf(buf, payload); in gas_anqp_build_comeback_resp_buf()
204 gas_anqp_set_len(buf); in gas_anqp_build_comeback_resp_buf()
206 return buf; in gas_anqp_build_comeback_resp_buf()
217 void gas_anqp_set_len(struct wpabuf *buf) in gas_anqp_set_len() argument
223 if (buf == NULL || wpabuf_len(buf) < 2) in gas_anqp_set_len()
226 action = *(wpabuf_head_u8(buf) + 1); in gas_anqp_set_len()
241 if (wpabuf_len(buf) < offset + 2) in gas_anqp_set_len()
244 len = wpabuf_mhead_u8(buf) + offset; in gas_anqp_set_len()
245 WPA_PUT_LE16(len, (u8 *) wpabuf_put(buf, 0) - len - 2); in gas_anqp_set_len()
255 u8 * gas_anqp_add_element(struct wpabuf *buf, u16 info_id) in gas_anqp_add_element() argument
257 wpabuf_put_le16(buf, info_id); in gas_anqp_add_element()
258 return wpabuf_put(buf, 2); /* Length to be filled */ in gas_anqp_add_element()
270 void gas_anqp_set_element_len(struct wpabuf *buf, u8 *len_pos) in gas_anqp_set_element_len() argument
272 WPA_PUT_LE16(len_pos, (u8 *) wpabuf_put(buf, 0) - len_pos - 2); in gas_anqp_set_element_len()