MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / _parse_attrs

Function _parse_attrs

tests/stun_server.py:189–199  ·  view source on GitHub ↗

Return list of (attr_type, attr_bytes) pairs.

(data, offset=20)

Source from the content-addressed store, hash-verified

187# ---------------------------------------------------------------------------
188
189def _parse_attrs(data, offset=20):
190 """Return list of (attr_type, attr_bytes) pairs."""
191 result = []
192 while offset + 4 <= len(data):
193 attr_type, attr_len = struct.unpack_from('!HH', data, offset)
194 offset += 4
195 if offset + attr_len > len(data):
196 break
197 result.append((attr_type, data[offset:offset + attr_len]))
198 offset += attr_len + (4 - attr_len % 4) % 4
199 return result
200
201def _get_attr(attrs, attr_type):
202 for t, v in attrs:

Callers 4

_handle_allocate_requestFunction · 0.85
_handle_refresh_requestFunction · 0.85
_handle_send_indicationFunction · 0.85

Calls 1

lenFunction · 0.85

Tested by

no test coverage detected