1 /*
2 * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10 #include "net/dcsctp/packet/tlv_trait.h"
11
12 #include "rtc_base/logging.h"
13
14 namespace dcsctp {
15 namespace tlv_trait_impl {
ReportInvalidSize(size_t actual_size,size_t expected_size)16 void ReportInvalidSize(size_t actual_size, size_t expected_size) {
17 RTC_DLOG(LS_WARNING) << "Invalid size (" << actual_size
18 << ", expected minimum " << expected_size << " bytes)";
19 }
20
ReportInvalidType(int actual_type,int expected_type)21 void ReportInvalidType(int actual_type, int expected_type) {
22 RTC_DLOG(LS_WARNING) << "Invalid type (" << actual_type << ", expected "
23 << expected_type << ")";
24 }
25
ReportInvalidFixedLengthField(size_t value,size_t expected)26 void ReportInvalidFixedLengthField(size_t value, size_t expected) {
27 RTC_DLOG(LS_WARNING) << "Invalid length field (" << value << ", expected "
28 << expected << " bytes)";
29 }
30
ReportInvalidVariableLengthField(size_t value,size_t available)31 void ReportInvalidVariableLengthField(size_t value, size_t available) {
32 RTC_DLOG(LS_WARNING) << "Invalid length field (" << value << ", available "
33 << available << " bytes)";
34 }
35
ReportInvalidPadding(size_t padding_bytes)36 void ReportInvalidPadding(size_t padding_bytes) {
37 RTC_DLOG(LS_WARNING) << "Invalid padding (" << padding_bytes << " bytes)";
38 }
39
ReportInvalidLengthMultiple(size_t length,size_t alignment)40 void ReportInvalidLengthMultiple(size_t length, size_t alignment) {
41 RTC_DLOG(LS_WARNING) << "Invalid length field (" << length
42 << ", expected an even multiple of " << alignment
43 << " bytes)";
44 }
45 } // namespace tlv_trait_impl
46 } // namespace dcsctp
47