Bug 1654189 - Move sipcc SDP to third_party;r=dminor

Differential Revision: https://phabricator.services.mozilla.com/D89943
This commit is contained in:
Nico Grunbaum 2020-09-11 20:19:42 +00:00
Родитель b896496e10
Коммит b6b3c20d6f
39 изменённых файлов: 428 добавлений и 265 удалений

1
config/external/moz.build поставляемый
Просмотреть файл

@ -18,6 +18,7 @@ if not CONFIG['MOZ_SYSTEM_JPEG']:
DIRS += [
'/third_party/prio',
'/third_party/msgpack',
'/third_party/sipcc',
]
# There's no "native" brotli or woff2 yet, but probably in the future...

Просмотреть файл

@ -5,6 +5,13 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
include('/media/webrtc/webrtc.mozbuild')
if CONFIG['OS_TARGET'] == 'WINNT':
DEFINES['SIP_OS_WINDOWS'] = True
elif CONFIG['OS_TARGET'] == 'Darwin':
DEFINES['SIP_OS_OSX'] = True
else:
DEFINES['SIP_OS_LINUX'] = True
# TODO: bug 1172551 - get these tests working on iOS
# Also, these lengthy tests are prone to OOM on Windows ASan.
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'uikit' and CONFIG['OS_TARGET'] != 'Android' \
@ -24,6 +31,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'uikit' and CONFIG['OS_TARGET'] != 'Android'
'/media/webrtc/trunk',
'/media/webrtc/trunk/webrtc',
'/netwerk/srtp/src/include',
'/third_party/sipcc',
]
SOURCES += [

Просмотреть файл

@ -25,8 +25,8 @@
#include "signaling/src/sdp/ParsingResultComparer.h"
extern "C" {
#include "signaling/src/sdp/sipcc/sdp.h"
#include "signaling/src/sdp/sipcc/sdp_private.h"
#include "sipcc_sdp.h"
#include "sdp_private.h"
}
#ifdef CRLF

Просмотреть файл

@ -10,6 +10,7 @@ LOCAL_INCLUDES += [
'/media/webrtc',
'/media/webrtc/trunk',
'/media/webrtc/trunk/webrtc',
'/third_party/sipcc',
]
UNIFIED_SOURCES += [

Просмотреть файл

@ -3,9 +3,66 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <type_traits>
#include "signaling/src/sdp/SdpLog.h"
#include "signaling/src/common/browser_logging/CSFLog.h"
namespace mozilla {
LazyLogModule SdpLog("sdp");
} // namespace mozilla
// For compile time enum comparison
template <typename E, typename F>
constexpr bool compareEnum(E e, F f) {
return static_cast<typename std::underlying_type<E>::type>(e) ==
static_cast<typename std::underlying_type<F>::type>(f);
}
CSFLogLevel SDPToCSFLogLevel(const SDPLogLevel priority) {
static_assert(compareEnum(SDP_LOG_ERROR, CSF_LOG_ERROR));
static_assert(compareEnum(SDP_LOG_WARNING, CSF_LOG_WARNING));
static_assert(compareEnum(SDP_LOG_INFO, CSF_LOG_INFO));
static_assert(compareEnum(SDP_LOG_DEBUG, CSF_LOG_DEBUG));
static_assert(compareEnum(SDP_LOG_VERBOSE, CSF_LOG_VERBOSE));
// Check that all SDP_LOG_* cases are covered. It compiles to nothing.
switch (priority) {
case SDP_LOG_ERROR:
case SDP_LOG_WARNING:
case SDP_LOG_INFO:
case SDP_LOG_DEBUG:
case SDP_LOG_VERBOSE:
break;
}
// Ditto for CSF_LOG_*
switch (static_cast<CSFLogLevel>(priority)) {
case CSF_LOG_ERROR:
case CSF_LOG_WARNING:
case CSF_LOG_INFO:
case CSF_LOG_DEBUG:
case CSF_LOG_VERBOSE:
break;
}
return static_cast<CSFLogLevel>(priority);
}
void SDPLog(SDPLogLevel priority, const char* sourceFile, int sourceLine,
const char* tag, const char* format, ...) {
va_list ap;
va_start(ap, format);
CSFLogV(SDPToCSFLogLevel(priority), sourceFile, sourceLine, tag, format, ap);
va_end(ap);
}
void SDPLogV(SDPLogLevel priority, const char* sourceFile, int sourceLine,
const char* tag, const char* format, va_list args) {
CSFLogV(SDPToCSFLogLevel(priority), sourceFile, sourceLine, tag, format,
args);
}
int SDPLogTestLevel(SDPLogLevel priority) {
return CSFLogTestLevel(SDPToCSFLogLevel(priority));
}

Просмотреть файл

@ -8,6 +8,7 @@
#define _SDP_LOG_H_
#include "mozilla/Logging.h"
#include "sdp_log.h"
namespace mozilla {
extern mozilla::LazyLogModule SdpLog;

Просмотреть файл

@ -16,7 +16,7 @@
#include "signaling/src/sdp/SipccSdpMediaSection.h"
#include "signaling/src/sdp/SipccSdpAttributeList.h"
extern "C" {
#include "signaling/src/sdp/sipcc/sdp.h"
#include "sipcc_sdp.h"
}
namespace mozilla {

Просмотреть файл

@ -10,7 +10,7 @@
#include "mozilla/Assertions.h"
extern "C" {
#include "signaling/src/sdp/sipcc/sdp_private.h"
#include "sdp_private.h"
}
namespace mozilla {

Просмотреть файл

@ -11,7 +11,7 @@
#include "signaling/src/sdp/SdpAttributeList.h"
extern "C" {
#include "signaling/src/sdp/sipcc/sdp.h"
#include "sipcc_sdp.h"
}
namespace mozilla {

Просмотреть файл

@ -9,6 +9,10 @@
#include <ostream>
#include "signaling/src/sdp/SdpParser.h"
extern "C" {
#include "sipcc_sdp.h"
}
#ifdef CRLF
# undef CRLF
#endif

Просмотреть файл

@ -15,7 +15,7 @@
#include <map>
extern "C" {
#include "signaling/src/sdp/sipcc/sdp.h"
#include "sipcc_sdp.h"
}
namespace mozilla {

Просмотреть файл

@ -9,7 +9,7 @@
#include <utility>
extern "C" {
#include "signaling/src/sdp/sipcc/sdp.h"
#include "sipcc_sdp.h"
}
namespace mozilla {

Просмотреть файл

@ -3,21 +3,13 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['OS_TARGET'] == 'WINNT':
DEFINES['SIP_OS_WINDOWS'] = True
SOURCES += [
'sipcc/sdp_services_win32.c',
]
elif CONFIG['OS_TARGET'] == 'Darwin':
DEFINES['SIP_OS_OSX'] = True
SOURCES += [
'sipcc/sdp_services_unix.c',
]
else:
DEFINES['SIP_OS_LINUX'] = True
SOURCES += [
'sipcc/sdp_services_unix.c',
]
# Add libFuzzer configuration directives
include('/tools/fuzzing/libfuzzer-config.mozbuild')
@ -27,6 +19,7 @@ LOCAL_INCLUDES += [
'/media/webrtc',
'/media/webrtc/signaling/src/common/browser_logging',
'/media/webrtc/trunk',
'/third_party/sipcc',
]
UNIFIED_SOURCES += [
@ -52,16 +45,6 @@ SOURCES += [
'RsdparsaSdpGlue.cpp',
'RsdparsaSdpMediaSection.cpp',
'RsdparsaSdpParser.cpp',
# Multiple definitions of "logTag" mean we can't use unified build here.
'sipcc/cpr_string.c',
'sipcc/sdp_access.c',
'sipcc/sdp_attr.c',
'sipcc/sdp_attr_access.c',
'sipcc/sdp_base64.c',
'sipcc/sdp_config.c',
'sipcc/sdp_main.c',
'sipcc/sdp_token.c',
'sipcc/sdp_utils.c',
]
FINAL_LIBRARY = 'xul'

3
third_party/moz.build поставляемый
Просмотреть файл

@ -28,6 +28,9 @@ with Files('prio/**'):
with Files('msgpack/**'):
BUG_COMPONENT = ('Firefox Build System', 'General')
with Files('sipcc/**'):
BUG_COMPONENT = ('Core', 'WebRTC: Signaling')
with Files('sqlite3/**'):
BUG_COMPONENT = ('Toolkit', 'Storage')

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

44
third_party/sipcc/moz.build поставляемый Normal file
Просмотреть файл

@ -0,0 +1,44 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['OS_TARGET'] == 'WINNT':
DEFINES['SIP_OS_WINDOWS'] = True
SOURCES += [
'sdp_services_win32.c',
]
elif CONFIG['OS_TARGET'] == 'Darwin':
DEFINES['SIP_OS_OSX'] = True
SOURCES += [
'sdp_services_unix.c',
]
else:
DEFINES['SIP_OS_LINUX'] = True
SOURCES += [
'sdp_services_unix.c',
]
# Add libFuzzer configuration directives
include('/tools/fuzzing/libfuzzer-config.mozbuild')
EXPORTS += [
'sdp_log.h',
'sipcc_sdp.h',
]
SOURCES += [
# Multiple definitions of "logTag" mean we can't use unified build here.
'cpr_string.c',
'sdp_access.c',
'sdp_attr.c',
'sdp_attr_access.c',
'sdp_base64.c',
'sdp_config.c',
'sdp_main.c',
'sdp_token.c',
'sdp_utils.c',
]
FINAL_LIBRARY = 'xul'

Просмотреть файл

@ -3,10 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "sdp_os_defs.h"
#include "sdp.h"
#include "sipcc_sdp.h"
#include "sdp_private.h"
#include "CSFLog.h"
#include "sdp_log.h"
static const char* logTag = "sdp_access";
@ -1006,7 +1006,7 @@ int32_t sdp_get_media_portnum (sdp_t *sdp_p, uint16_t level)
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI) &&
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI_CID)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s Port num not valid for media line %u",
SDPLogError(logTag, "%s Port num not valid for media line %u",
sdp_p->debug_str, (unsigned)level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1036,7 +1036,7 @@ int32_t sdp_get_media_portcount (sdp_t *sdp_p, uint16_t level)
/* Make sure port number is valid for the specified format. */
if (mca_p->port_format != SDP_PORT_NUM_COUNT) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s Port count not valid for media line %u",
SDPLogError(logTag, "%s Port count not valid for media line %u",
sdp_p->debug_str, (unsigned)level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1068,7 +1068,7 @@ int32_t sdp_get_media_vpi (sdp_t *sdp_p, uint16_t level)
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI) &&
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI_CID)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s VPI not valid for media line %u",
SDPLogError(logTag, "%s VPI not valid for media line %u",
sdp_p->debug_str, (unsigned)level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1100,7 +1100,7 @@ uint32_t sdp_get_media_vci (sdp_t *sdp_p, uint16_t level)
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI) &&
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI_CID)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s VCI not valid for media line %u",
SDPLogError(logTag, "%s VCI not valid for media line %u",
sdp_p->debug_str, (unsigned)level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1131,7 +1131,7 @@ int32_t sdp_get_media_vcci (sdp_t *sdp_p, uint16_t level)
if ((mca_p->port_format != SDP_PORT_VCCI) &&
(mca_p->port_format != SDP_PORT_VCCI_CID)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s VCCI not valid for media line %u",
SDPLogError(logTag, "%s VCCI not valid for media line %u",
sdp_p->debug_str, (unsigned)level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1162,7 +1162,7 @@ int32_t sdp_get_media_cid (sdp_t *sdp_p, uint16_t level)
if ((mca_p->port_format != SDP_PORT_VCCI_CID) &&
(mca_p->port_format != SDP_PORT_NUM_VPI_VCI_CID)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s CID not valid for media line %u",
SDPLogError(logTag, "%s CID not valid for media line %u",
sdp_p->debug_str, (unsigned)level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1326,7 +1326,7 @@ rtp_ptype sdp_get_known_payload_type(sdp_t *sdp_p,
attr_p = sdp_find_attr(sdp_p, level, 0, SDP_ATTR_RTPMAP, (i + 1));
if (attr_p == NULL) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s rtpmap attribute, level %u instance %u "
SDPLogError(logTag, "%s rtpmap attribute, level %u instance %u "
"not found.",
sdp_p->debug_str,
(unsigned)level,
@ -1497,7 +1497,7 @@ sdp_result_e sdp_insert_media_line (sdp_t *sdp_p, uint16_t level)
if ((level < 1) || (level > (sdp_p->mca_count+1))) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s Invalid media line (%u) to insert, max is "
SDPLogError(logTag, "%s Invalid media line (%u) to insert, max is "
"(%u).", sdp_p->debug_str, (unsigned)level, (unsigned)sdp_p->mca_count);
}
sdp_p->conf_p->num_invalid_param++;
@ -1675,7 +1675,7 @@ sdp_result_e sdp_add_media_profile (sdp_t *sdp_p, uint16_t level,
if (mca_p->media_profiles_p->num_profiles >= SDP_MAX_PROFILES) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s Max number of media profiles already specified"
SDPLogError(logTag, "%s Max number of media profiles already specified"
" for media level %u", sdp_p->debug_str, (unsigned)level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1713,7 +1713,7 @@ sdp_result_e sdp_add_media_payload_type (sdp_t *sdp_p, uint16_t level,
if (mca_p->num_payloads == SDP_MAX_PAYLOAD_TYPES) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s Max number of payload types already defined "
SDPLogError(logTag, "%s Max number of payload types already defined "
"for media line %u", sdp_p->debug_str, (unsigned)level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1753,7 +1753,7 @@ sdp_result_e sdp_add_media_profile_payload_type (sdp_t *sdp_p, uint16_t level,
if ((prof_num < 1) ||
(prof_num > mca_p->media_profiles_p->num_profiles)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s Invalid profile number (%u) for set profile "
SDPLogError(logTag, "%s Invalid profile number (%u) for set profile "
" payload type", sdp_p->debug_str, (unsigned)level);
}
sdp_p->conf_p->num_invalid_param++;
@ -1763,7 +1763,7 @@ sdp_result_e sdp_add_media_profile_payload_type (sdp_t *sdp_p, uint16_t level,
if (mca_p->media_profiles_p->num_payloads[prof_num-1] ==
SDP_MAX_PAYLOAD_TYPES) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s Max number of profile payload types already "
SDPLogError(logTag, "%s Max number of profile payload types already "
"defined profile %u on media line %u",
sdp_p->debug_str, (unsigned)prof_num, (unsigned)level);
}
@ -1850,7 +1850,7 @@ sdp_result_e sdp_copy_all_bw_lines (sdp_t *src_sdp_p, sdp_t *dst_sdp_p,
mca_p = sdp_find_media_level(src_sdp_p, src_level);
if (mca_p == NULL) {
if (src_sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s Invalid src media level (%u) for copy all "
SDPLogError(logTag, "%s Invalid src media level (%u) for copy all "
"attrs ", src_sdp_p->debug_str, (unsigned)src_level);
}
return (SDP_INVALID_PARAMETER);
@ -1865,7 +1865,7 @@ sdp_result_e sdp_copy_all_bw_lines (sdp_t *src_sdp_p, sdp_t *dst_sdp_p,
mca_p = sdp_find_media_level(dst_sdp_p, dst_level);
if (mca_p == NULL) {
if (src_sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s Invalid dst media level (%u) for copy all "
SDPLogError(logTag, "%s Invalid dst media level (%u) for copy all "
"attrs ", src_sdp_p->debug_str, (unsigned)dst_level);
}
return (SDP_INVALID_PARAMETER);

Просмотреть файл

@ -8,11 +8,11 @@
#include "plstr.h"
#include "sdp_os_defs.h"
#include "sdp.h"
#include "sipcc_sdp.h"
#include "sdp_private.h"
#include "sdp_base64.h"
#include "CSFLog.h"
#include "sdp_log.h"
static const char* logTag = "sdp_attr";
@ -250,14 +250,14 @@ sdp_result_e sdp_build_attribute (sdp_t *sdp_p, uint16_t level, flex_string *fs)
while (attr_p != NULL) {
if (attr_p->type >= SDP_MAX_ATTR_TYPES) {
if (sdp_p->debug_flag[SDP_DEBUG_WARNINGS]) {
CSFLogDebug(logTag, "%s Invalid attribute type to build (%u)",
SDPLogDebug(logTag, "%s Invalid attribute type to build (%u)",
sdp_p->debug_str, (unsigned)attr_p->type);
}
} else {
result = sdp_attr[attr_p->type].build_func(sdp_p, attr_p, fs);
if (result != SDP_SUCCESS) {
CSFLogError(logTag, "%s error building attribute %d", __FUNCTION__, result);
SDPLogError(logTag, "%s error building attribute %d", __FUNCTION__, result);
return result;
}
@ -1377,7 +1377,7 @@ sdp_result_e sdp_parse_attr_fmtp (sdp_t *sdp_p, sdp_attr_t *attr_p,
codec_info_found = TRUE;
} else {
// unknown parameter - eat chars until ';'
CSFLogDebug(logTag, "%s Unknown fmtp type (%s) - ignoring", __FUNCTION__,
SDPLogDebug(logTag, "%s Unknown fmtp type (%s) - ignoring", __FUNCTION__,
tmp);
fmtp_ptr = sdp_getnextstrtok(fmtp_ptr, tmp, sizeof(tmp), "; \t",
&result1);
@ -2780,7 +2780,7 @@ sdp_result_e sdp_build_attr_cap (sdp_t *sdp_p, sdp_attr_t *attr_p,
cap_p = attr_p->attr.cap_p;
if (cap_p == NULL) {
CSFLogError(logTag, "%s Invalid %s attribute, unable to build.",
SDPLogError(logTag, "%s Invalid %s attribute, unable to build.",
sdp_p->debug_str, sdp_get_attr_name(attr_p->type));
sdp_p->conf_p->num_invalid_param++;
/* Return success so build won't fail. */
@ -2790,7 +2790,7 @@ sdp_result_e sdp_build_attr_cap (sdp_t *sdp_p, sdp_attr_t *attr_p,
/* Validate params for this capability line */
if ((cap_p->media >= SDP_MAX_MEDIA_TYPES) ||
(cap_p->transport >= SDP_MAX_TRANSPORT_TYPES)) {
CSFLogDebug(logTag, logTag, "%s Media or transport type invalid for %s "
SDPLogDebug(logTag, logTag, "%s Media or transport type invalid for %s "
"attribute, unable to build.", sdp_p->debug_str,
sdp_get_attr_name(attr_p->type));
sdp_p->conf_p->num_invalid_param++;
@ -3019,7 +3019,7 @@ sdp_result_e sdp_build_attr_cpar (sdp_t *sdp_p, sdp_attr_t *attr_p,
while (attr_p != NULL) {
if (attr_p->type >= SDP_MAX_ATTR_TYPES) {
CSFLogDebug(logTag, "%s Invalid attribute type to build (%u)",
SDPLogDebug(logTag, "%s Invalid attribute type to build (%u)",
sdp_p->debug_str, (unsigned)attr_p->type);
} else {
flex_string_sprintf(fs, "a=%s: ", cpar_name);
@ -3525,7 +3525,7 @@ sdp_result_e sdp_build_attr_srtpcontext (sdp_t *sdp_p, sdp_attr_t *attr_p,
if ((status = base64_encode(base64_encoded_input, key_size + salt_size,
base64_encoded_data, &output_len)) != BASE64_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s Error: Failure to Base64 Encoded data (%s) ",
SDPLogError(logTag, "%s Error: Failure to Base64 Encoded data (%s) ",
sdp_p->debug_str, BASE64_RESULT_TO_STRING(status));
}
return (SDP_INVALID_PARAMETER);
@ -4252,7 +4252,7 @@ sdp_build_attr_sdescriptions (sdp_t *sdp_p, sdp_attr_t *attr_p,
if (status != BASE64_SUCCESS) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s Error: Failure to Base64 Encoded data (%s) ",
SDPLogError(logTag, "%s Error: Failure to Base64 Encoded data (%s) ",
sdp_p->debug_str, BASE64_RESULT_TO_STRING(status));
}
return (SDP_INVALID_PARAMETER);
@ -4606,7 +4606,7 @@ sdp_result_e sdp_build_attr_rtcp_fb(sdp_t *sdp_p,
break;
default:
CSFLogError(logTag, "%s Error: Invalid rtcp-fb enum (%d)",
SDPLogError(logTag, "%s Error: Invalid rtcp-fb enum (%d)",
sdp_p->debug_str, attr_p->attr.rtcp_fb.feedback_type);
return SDP_FAILURE;
}
@ -4757,7 +4757,7 @@ sdp_result_e sdp_parse_attr_rtcp_fb (sdp_t *sdp_p,
default:
/* This is an internal error, not a parsing error */
CSFLogError(logTag, "%s Error: Invalid rtcp-fb enum (%d)",
SDPLogError(logTag, "%s Error: Invalid rtcp-fb enum (%d)",
sdp_p->debug_str, attr_p->attr.rtcp_fb.feedback_type);
return SDP_FAILURE;
}
@ -4789,7 +4789,7 @@ sdp_result_e sdp_build_attr_setup(sdp_t *sdp_p,
sdp_setup_type_val[attr_p->attr.setup].name);
break;
default:
CSFLogError(logTag, "%s Error: Invalid setup enum (%d)",
SDPLogError(logTag, "%s Error: Invalid setup enum (%d)",
sdp_p->debug_str, attr_p->attr.setup);
return SDP_FAILURE;
}
@ -4829,7 +4829,7 @@ sdp_result_e sdp_parse_attr_setup(sdp_t *sdp_p,
return SDP_INVALID_PARAMETER;
default:
/* This is an internal error, not a parsing error */
CSFLogError(logTag, "%s Error: Invalid setup enum (%d)",
SDPLogError(logTag, "%s Error: Invalid setup enum (%d)",
sdp_p->debug_str, attr_p->attr.setup);
return SDP_FAILURE;
}
@ -4849,7 +4849,7 @@ sdp_result_e sdp_build_attr_connection(sdp_t *sdp_p,
sdp_connection_type_val[attr_p->attr.connection].name);
break;
default:
CSFLogError(logTag, "%s Error: Invalid connection enum (%d)",
SDPLogError(logTag, "%s Error: Invalid connection enum (%d)",
sdp_p->debug_str, attr_p->attr.connection);
return SDP_FAILURE;
}
@ -4887,7 +4887,7 @@ sdp_result_e sdp_parse_attr_connection(sdp_t *sdp_p,
return SDP_INVALID_PARAMETER;
default:
/* This is an internal error, not a parsing error */
CSFLogError(logTag, "%s Error: Invalid connection enum (%d)",
SDPLogError(logTag, "%s Error: Invalid connection enum (%d)",
sdp_p->debug_str, attr_p->attr.connection);
return SDP_FAILURE;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -3,10 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "sdp_os_defs.h"
#include "sdp.h"
#include "sipcc_sdp.h"
#include "sdp_private.h"
#include "CSFLog.h"
#include "sdp_log.h"
static const char* logTag = "sdp_config";
@ -30,7 +30,7 @@ sdp_conf_options_t *sdp_init_config ()
conf_p = SDP_MALLOC(sizeof(sdp_conf_options_t));
if (!conf_p) {
CSFLogError(logTag, "SDP: could not allocate configuration object.");
SDPLogError(logTag, "SDP: could not allocate configuration object.");
return NULL;
}
@ -83,7 +83,7 @@ sdp_conf_options_t *sdp_init_config ()
conf_p->error_handler = NULL;
conf_p->error_handler_context = NULL;
CSFLogInfo(logTag, "SDP: Initialized config pointer: %p", conf_p);
SDPLogInfo(logTag, "SDP: Initialized config pointer: %p", conf_p);
return (conf_p);
}

62
third_party/sipcc/sdp_log.h поставляемый Normal file
Просмотреть файл

@ -0,0 +1,62 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* This is a mirror of CSFLog. The implementations of SDPLog, SDPLogV, and
SDPLogTestLevel must be provided by the user. */
#ifndef SDPLOG_H
#define SDPLOG_H
#include <stdarg.h>
typedef enum {
SDP_LOG_ERROR = 1,
SDP_LOG_WARNING,
SDP_LOG_INFO,
SDP_LOG_DEBUG,
SDP_LOG_VERBOSE,
} SDPLogLevel;
#define SDPLogError(tag, format, ...) \
SDPLog(SDP_LOG_ERROR, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
#define SDPLogErrorV(tag, format, va_list_arg) \
SDPLogV(SDP_LOG_ERROR, __FILE__, __LINE__, tag, format, va_list_arg)
#define SDPLogWarn(tag, format, ...) \
SDPLog(SDP_LOG_WARNING, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
#define SDPLogWarnV(tag, format, va_list_arg) \
SDPLogV(SDP_LOG_WARNING, __FILE__, __LINE__, tag, format, va_list_arg)
#define SDPLogInfo(tag, format, ...) \
SDPLog(SDP_LOG_INFO, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
#define SDPLogInfoV(tag, format, va_list_arg) \
SDPLogV(SDP_LOG_INFO, __FILE__, __LINE__, tag, format, va_list_arg)
#define SDPLogDebug(tag, format, ...) \
SDPLog(SDP_LOG_DEBUG, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
#define SDPLogDebugV(tag, format, va_list_arg) \
SDPLogV(SDP_LOG_DEBUG, __FILE__, __LINE__, tag, format, va_list_arg)
#define SDPLogVerbose(tag, format, ...) \
SDPLog(SDP_LOG_VERBOSE, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
#define SDPLogVerboseV(tag, format, va_list_arg) \
SDPLogV(SDP_LOG_VERBOSE, __FILE__, __LINE__, tag, format, va_list_arg)
#ifdef __cplusplus
extern "C" {
#endif
void SDPLog(SDPLogLevel priority, const char* sourceFile, int sourceLine,
const char* tag, const char* format, ...)
#ifdef __GNUC__
__attribute__((format(printf, 5, 6)))
#endif
;
void SDPLogV(SDPLogLevel priority, const char* sourceFile, int sourceLine,
const char* tag, const char* format, va_list args);
int SDPLogTestLevel(SDPLogLevel priority);
#ifdef __cplusplus
}
#endif
#endif

Просмотреть файл

@ -3,10 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "sdp_os_defs.h"
#include "sdp.h"
#include "sipcc_sdp.h"
#include "sdp_private.h"
#include "CSFLog.h"
#include "sdp_log.h"
static const char* logTag = "sdp_main";
@ -1054,7 +1054,7 @@ sdp_result_e sdp_parse (sdp_t *sdp_p, const char *buf, size_t len)
sdp_parse_error(sdp_p,
"%s End of line beyond end of buffer.",
sdp_p->debug_str);
CSFLogError(logTag, "SDP: Invalid SDP, no \\n (len %u): %*s",
SDPLogError(logTag, "SDP: Invalid SDP, no \\n (len %u): %*s",
(unsigned)len, (int)len, *bufp);
end_found = TRUE;
break;
@ -1361,7 +1361,7 @@ void sdp_parse_error(sdp_t* sdp, const char *format, ...) {
flex_string_vsprintf(&fs, format, ap);
va_end(ap);
CSFLogError("SDP Parse", "SDP Parse Error %s, line %u", fs.buffer,
SDPLogError("SDP Parse", "SDP Parse Error %s, line %u", fs.buffer,
sdp->parse_line);
if (sdp->conf_p->error_handler) {

Просмотреть файл

@ -11,7 +11,7 @@
#include "cpr_string.h"
#define SDP_PRINT(format, ...) CSFLogError("sdp" , format , ## __VA_ARGS__ )
#define SDP_PRINT(format, ...) SDPLogError("sdp" , format , ## __VA_ARGS__ )
/* Use operating system malloc */
#define SDP_MALLOC(x) calloc(1, (x))

Просмотреть файл

@ -6,7 +6,7 @@
#define _SIPCC_SDP_PRIVATE_H_
#include "sdp.h"
#include "sipcc_sdp.h"
extern const sdp_attrarray_t sdp_attr[];
extern const sdp_namearray_t sdp_media[];

Просмотреть файл

@ -3,10 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "sdp_os_defs.h"
#include "sdp.h"
#include "sipcc_sdp.h"
#include "sdp_private.h"
#include "CSFLog.h"
#include "sdp_log.h"
/******************************************************************/
/* Required Platform Routines */
@ -25,7 +25,7 @@
*/
void sdp_dump_buffer (char * _ptr, int _size_bytes)
{
CSFLogDebug("sdp", "%s", _ptr);
SDPLogDebug("sdp", "%s", _ptr);
}
/******************************************************************/

Просмотреть файл

@ -3,10 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "sdp_os_defs.h"
#include "sdp.h"
#include "sipcc_sdp.h"
#include "sdp_private.h"
#include "CSFLog.h"
#include "sdp_log.h"
/******************************************************************/
/* Required Platform Routines */
@ -25,7 +25,7 @@
*/
void sdp_dump_buffer (char * _ptr, int _size_bytes)
{
CSFLogDebug("sdp", _ptr);
SDPLogDebug("sdp", _ptr);
}
/******************************************************************/

Просмотреть файл

@ -5,10 +5,10 @@
#include <errno.h>
#include "sdp_os_defs.h"
#include "sdp.h"
#include "sipcc_sdp.h"
#include "sdp_private.h"
#include "CSFLog.h"
#include "sdp_log.h"
#include "prprf.h"
static const char *logTag = "sdp_token";
@ -40,7 +40,7 @@ sdp_result_e sdp_build_version (sdp_t *sdp_p, uint16_t level, flex_string *fs)
{
if (sdp_p->version == SDP_INVALID_VALUE) {
if (sdp_p->conf_p->version_reqd == TRUE) {
CSFLogError(logTag, "%s Invalid version for v= line, "
SDPLogError(logTag, "%s Invalid version for v= line, "
"build failed.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
@ -236,7 +236,7 @@ sdp_result_e sdp_build_owner (sdp_t *sdp_p, uint16_t level, flex_string *fs)
}
if (sdp_p->conf_p->owner_reqd == TRUE) {
CSFLogError(logTag, "%s Invalid params for o= owner line, "
SDPLogError(logTag, "%s Invalid params for o= owner line, "
"build failed.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
@ -291,7 +291,7 @@ sdp_result_e sdp_build_sessname (sdp_t *sdp_p, uint16_t level, flex_string *fs)
{
if (sdp_p->sessname[0] == '\0') {
if (sdp_p->conf_p->session_name_reqd == TRUE) {
CSFLogError(logTag, "%s No param defined for s= session name line, "
SDPLogError(logTag, "%s No param defined for s= session name line, "
"build failed.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
@ -927,7 +927,7 @@ sdp_result_e sdp_build_timespec (sdp_t *sdp_p, uint16_t level, flex_string *fs)
(sdp_p->timespec_p->start_time[0] == '\0') ||
(sdp_p->timespec_p->stop_time[0] == '\0')) {
if (sdp_p->conf_p->timespec_reqd == TRUE) {
CSFLogError(logTag, "%s Invalid params for t= time spec line, "
SDPLogError(logTag, "%s Invalid params for t= time spec line, "
"build failed.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
@ -1488,7 +1488,7 @@ sdp_result_e sdp_build_media (sdp_t *sdp_p, uint16_t level, flex_string *fs)
}
if (invalid_params == TRUE) {
CSFLogError(logTag, "%s Invalid params for m= media line, "
SDPLogError(logTag, "%s Invalid params for m= media line, "
"build failed.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);
@ -1522,7 +1522,7 @@ sdp_result_e sdp_build_media (sdp_t *sdp_p, uint16_t level, flex_string *fs)
} else if ((mca_p->vcci == SDP_CHOOSE_PARAM) ||
(mca_p->cid == SDP_CHOOSE_PARAM)) {
/* If one is set but not the other, this is an error. */
CSFLogError(logTag, "%s Invalid params for m= port parameter, "
SDPLogError(logTag, "%s Invalid params for m= port parameter, "
"build failed.", sdp_p->debug_str);
sdp_p->conf_p->num_invalid_param++;
return (SDP_INVALID_PARAMETER);

Просмотреть файл

@ -6,10 +6,9 @@
#include <limits.h>
#include <ctype.h>
#include "sdp_os_defs.h"
#include "sdp.h"
#include "sipcc_sdp.h"
#include "sdp_private.h"
#include "CSFLog.h"
#include "sdp_log.h"
#define MKI_BUF_LEN 4
@ -684,7 +683,7 @@ tinybool sdp_checkrange (sdp_t *sdp_p, char *num, ulong *u_val)
if (*num == '-') {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s ERROR: Parameter value is a negative number: %s",
SDPLogError(logTag, "%s ERROR: Parameter value is a negative number: %s",
sdp_p->debug_str, num);
}
return FALSE;
@ -695,7 +694,7 @@ tinybool sdp_checkrange (sdp_t *sdp_p, char *num, ulong *u_val)
if (l_val > 4294967295UL) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s ERROR: Parameter value: %s is greater than 4294967295",
SDPLogError(logTag, "%s ERROR: Parameter value: %s is greater than 4294967295",
sdp_p->debug_str, num);
}
return FALSE;
@ -710,7 +709,7 @@ tinybool sdp_checkrange (sdp_t *sdp_p, char *num, ulong *u_val)
*/
if (strcmp("4294967295", num)) {
if (sdp_p->debug_flag[SDP_DEBUG_ERRORS]) {
CSFLogError(logTag, "%s ERROR: Parameter value: %s is greater than 4294967295",
SDPLogError(logTag, "%s ERROR: Parameter value: %s is greater than 4294967295",
sdp_p->debug_str, num);
}
return FALSE;

Просмотреть файл