/* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
// First skip mandatory stun header which is of 20 bytes.
size_t pos = kStunHeaderSize; // Loop through STUN attributes until we find STUN DATA attribute. while (pos < packet_size) { // Keep reading STUN attributes until we hit DATA attribute. // Attribute will be a TLV structure. // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // | Type | Length | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // | Value (variable) .... // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // The value in the length field MUST contain the length of the Value // part of the attribute, prior to padding, measured in bytes. Since // STUN aligns attributes on 32-bit boundaries, attributes whose content // is not a multiple of 4 bytes are padded with 1, 2, or 3 bytes of // padding so that its value contains a multiple of 4 bytes. The // padding bits are ignored, and may be any value.
uint16_t attr_type, attr_length; constint kAttrHeaderLength = sizeof(attr_type) + sizeof(attr_length);
if (packet_size < pos + kAttrHeaderLength) { returnfalse;
}
// Getting attribute type and length.
attr_type = rtc::GetBE16(&packet[pos]);
attr_length = rtc::GetBE16(&packet[pos + sizeof(attr_type)]);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.