Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev 1.6.0 CI-only pull request #2710

Closed
wants to merge 146 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
5930f72
[core][apps] Fixed wrong +W epoll for listener socket
Feb 24, 2021
8081a2f
[core] Fixed bug: srt_accept failure may make accepted socket leak
Mar 23, 2021
15a99cb
Fixed UT layout and surroundings
Mar 23, 2021
027d423
Changed: on parameter failure the socket stays in the queue and can b…
Mar 23, 2021
48d10f6
[apps] Added url percent decoding to url query string keys and values.
jschultz410 May 20, 2021
f33887d
Refax: smaller fixes and added utilities
Oct 28, 2022
a2b60f3
Updated
Nov 2, 2022
01ef799
Fixed spare code for debugging high bitrate sending
Nov 3, 2022
e1031b5
Merge branch 'master' into dev-refax-group-utils
Nov 8, 2022
2de6785
Updated to latest master (some parts merged)
Nov 8, 2022
045b3fe
Merge branch 'master' into dev-refax-group-utils
Nov 9, 2022
2e604d9
Updated
Dec 6, 2022
c0fcf24
SRT SWIG
lewk2 Dec 6, 2022
cee3a35
Srt1.5.1 swig (#8)
lewk2 Dec 6, 2022
e73b119
-docker lin build now uses ubuntu 22.04 base
Dec 6, 2022
2ea30af
SWIG Linux improvements, C# type mapping fixes
lewk2 Dec 8, 2022
2424c99
Fixing implicit integer and wrong use of SRT_ERROR and SRT_INVALID_SO…
Dec 22, 2022
6ad1041
[MAINT] Fixed example buildbreaks. Added examples for message mode tr…
ethouris Dec 22, 2022
340f0b5
Updated
ethouris Dec 22, 2022
29e8c19
Fixed wrong assertion for drop snd buf sequence check
Dec 23, 2022
31b3a78
Updated
Dec 23, 2022
ce98b8a
[MAINT] Refax for CSndBuffer::readData to make the call form clearer
Dec 23, 2022
333eaf2
[MAINT] Removed reference fields from CPacket pinned to the SRT header
Dec 23, 2022
43c0883
Updated and fixed
Dec 23, 2022
6e2280d
Updated with the fixes
Dec 23, 2022
124ec2b
[BUG] Fixed default reject reason for a listener callback
ethouris Jan 9, 2023
f14c349
Added extended reject reason string API
Jan 9, 2023
512e548
Merge branch 'master' into dev-fix-implicit-int
Jan 11, 2023
08d1e5c
Minor fixes
Jan 11, 2023
4888873
Merge branch 'master' into dev-refax-readdata-rexmit
Jan 11, 2023
dba39ef
Merge branch 'master' into dev-refax-readdata-rexmit
Jan 24, 2023
addefb3
Merge branch 'master' into dev-fix-implicit-int
Jan 25, 2023
6db27db
[core] Use overlapped WSASendTo to avoid UDP sending losses.
maxsharabayko Jan 26, 2023
e9f5eec
Updated and fixed. Moved CreateAddr to test support file
Feb 9, 2023
1baa7e6
Updated to latest upstream
Feb 10, 2023
a8ef62f
Applied a suggestion from the code review
Feb 10, 2023
3b12395
Merge branch 'master' into dev-refax-group-utils
Feb 13, 2023
130f193
Renamed v5 function
Feb 13, 2023
7e93af1
Merge branch 'master' into dev-refax-group-utils
Feb 16, 2023
03c19ac
Merge branch 'master' into dev-refax-readdata-rexmit
Feb 20, 2023
b0e681f
Updated and fixed
Feb 20, 2023
41d27cc
Added log suppression mechanism. Added atomic |= operator. Added log …
Feb 21, 2023
fdc7a47
Fixed and remove devel version
ethouris Feb 21, 2023
26fb1d5
Fixed the use of atomic time diff that caused build breaks
Feb 22, 2023
26bcde8
Renamed expection
Feb 22, 2023
d44a015
[MAINT] Fixed C4267 warning on MSVC
Feb 22, 2023
b53a091
[FIX] Calculate correctly max payload size per UDP packet
Mar 1, 2023
a8b9104
Applied verification of the payload size fit. Added tests. Updated do…
Mar 3, 2023
56fdfdb
Withdrawn quotes for option names
Mar 3, 2023
d7f32d0
Fixed links in the socket option table
Mar 3, 2023
040d8c7
Created a custom main function for gtest
ethouris Mar 6, 2023
388c25e
Added simple option parsing procedure
Mar 6, 2023
70de763
Fixed minimum MSS to 116. Fixed some other bux
Mar 6, 2023
2eb1159
Replaced rand_r with std c++ random
Mar 6, 2023
9f48d3c
Fixed usage of C++14 literals in the test (build failures)
Mar 6, 2023
edbb608
[MAINT] Upgraded CI: ubuntu to version 20.04
Mar 6, 2023
26a7be6
Fixed test logics (printing after closing)
Mar 6, 2023
3d387a2
Attempted fix for a deadlock in test, added some tracking
Mar 6, 2023
03717f3
Merge branch 'dev-upgrade-ci-ubuntu' into dev-fix-ipv6-payloadsize
Mar 6, 2023
3eef592
Added expect and tracking to close socket in ReuseAddr test (Travis p…
Mar 6, 2023
e2ab5f6
Used relaxed signaling for the sake of Travis
Mar 6, 2023
8611e52
[FIX] Changed conditions for setting callbacks
ethouris Mar 7, 2023
77105c3
Removed unnecessary fix for a test
ethouris Mar 7, 2023
d081e50
Lock debug fix for tests
ethouris Mar 7, 2023
ba5f962
Added timeout for lock-CV to avoid Travis problem
ethouris Mar 7, 2023
320a79b
Attempted more debug for test ipv6 for Travis
ethouris Mar 7, 2023
1b3ccd7
More debug for Travis
ethouris Mar 7, 2023
90b13b1
Fixed test ipv6 to use promise-future for synchronization
Mar 7, 2023
bc4059c
Fixed filtering-out IPv6 tests for Travis
Mar 7, 2023
a126316
Added SRT test setup support
Mar 8, 2023
d9b15f5
Added lacking semicolon
Mar 8, 2023
48393d2
Fixed handling per-test options
Mar 8, 2023
1746db7
Formatting fixes
Mar 9, 2023
11574a0
Fixed wrong comment
Mar 9, 2023
8125071
[MAINT] Fixed unhandled error in haicrypt
ethouris Mar 9, 2023
ae5af77
Some fixes in the documentation
Mar 13, 2023
c4b7c83
[BUG] Rejection not undertaken in rendezvous after KMX failure
Mar 16, 2023
c419288
Removed LS locking for processing incoming connection
ethouris Mar 20, 2023
478b684
Merge branch 'dev-test-add-parameters' into dev-untangle-locks-ls-conn
ethouris Mar 20, 2023
1ebc3e7
Merge branch 'dev-test-add-parameters' into dev-1.6.0
Apr 3, 2023
b4487e3
Merged 2681 and 2677
Apr 3, 2023
d725e61
Merge remote-tracking branch 'origin/2635-maint-setting-listener-or-c…
Apr 3, 2023
9d61a23
Merge branch 'dev-refax-readdata-rexmit' into dev-1.6.0
Apr 3, 2023
19cda2b
Fixed not marked test plsize_faux_v6 as IPv6 requiring test
Apr 4, 2023
aeeb437
Repeated fix for 2706 - fixes lacking mutex protection to some ACK-re…
Apr 20, 2023
162fc4e
A crypto service provider based on Botan
oviano Apr 20, 2023
899164d
Added new test
ethouris Apr 25, 2023
9b9352c
Merge branch 'master' into dev-untangle-locks-ls-conn
ethouris Apr 25, 2023
66d0702
Merge remote-tracking branch 'ethouris/dev-fix-consistency-1' into de…
Apr 28, 2023
c519cb8
Merged and fixed 2504
Apr 28, 2023
7dc77ac
Merge branch 'dev-add-rejectreasonx-str' into dev-1.6.0
Apr 28, 2023
9492736
Merge remote-tracking branch 'maxsharabayko/develop/wsasend-overlappe…
Apr 28, 2023
b74ee36
Merge remote-tracking branch 'jschultz410/url-decode' into dev-1.6.0
Apr 28, 2023
30beda9
Merge branch 'dev-fix-rendezvous-ee-rejection' into dev-1.6.0
Apr 28, 2023
3c5ea1f
Fixed incorrect post-merge-fix for 2504
Apr 28, 2023
7a1372f
Merge branch 'dev-fix-merge-1.6.0' into dev-1.6.0
Apr 28, 2023
fabb85f
Updated with upstream and fixed
Apr 28, 2023
96cbbbd
Merge branch 'dev-fix-ipv6-payloadsize' into dev-1.6.0
May 2, 2023
485f2b8
Merge branch 'master' into dev-1.6.0
May 3, 2023
76f6cc3
Merge branch 'dev-fix-2706' into dev-1.6.0
May 3, 2023
35dc1be
Merge remote-tracking branch 'ethouris/dev-untangle-locks-ls-conn' in…
May 3, 2023
99dfe40
Merge branch 'master' into dev-fix-accept-leak-on-api-failure
May 3, 2023
e1f1758
Premature merge of #2681 to prevent merge conflicts
May 3, 2023
e9ba0e4
Merge branch 'dev-fix-accept-leak-on-api-failure' into dev-1.6.0
May 3, 2023
ae8eb77
Merge remote-tracking branch 'oviano/botan-cryspr' into dev-1.6.0
May 4, 2023
fdd9130
Updated to latest upstream, fixed
May 4, 2023
5b3bd8b
Merge branch 'dev-fix-msvc-C4267' into dev-1.6.0
May 4, 2023
3781775
Merge branch 'master' into dev-refax-readdata-rexmit
May 4, 2023
870b682
Merge branch 'dev-refax-readdata-rexmit' into dev-1.6.0
May 4, 2023
7e17425
Merge remote-tracking branch 'Cinegy/master-swig' into dev-1.6.0
May 5, 2023
d126e64
Merge branch 'master' into dev-refax-remove-cpacket-refs
May 8, 2023
380e12f
Updated to latest upstream through #2594
May 8, 2023
ea2dcbf
Merged dev-refax-remove-cpacket-refs #2594 (conflix)
May 8, 2023
afc1841
Merge branch 'dev-fix-implicit-int' into dev-1.6.0
May 8, 2023
95cd025
Merge branch 'master' into dev-add-elaborate-log-suppression
May 8, 2023
3247614
Updated to latest upstream. Fixed. Added conditional trace enabler
May 8, 2023
83aca36
Merged and fixed #2674
May 8, 2023
f83a8f4
Merged from upstream. Changed purpose
May 8, 2023
128266c
Merged #1831 and fixed
May 8, 2023
0df5719
[BUG] Removed setting +W for a listener socket after accept ready
May 9, 2023
d801bc2
Merge branch 'dev-fix-1667' into dev-1.6.0
May 9, 2023
0ab355e
Fixed build break on MSVC
May 9, 2023
4b45a56
Fixed build break on C++98 platforms
May 9, 2023
2e27fe2
Fixed build break on C++98 platforms
May 9, 2023
0526ccd
Merged 2733 (replacement)
May 9, 2023
88b9f33
Fixed build break on Android
May 10, 2023
972b822
Merge branch 'dev-fix-implicit-int' into dev-1.6.0
May 10, 2023
36a9f6e
Merge branch 'dev-add-elaborate-log-suppression-v2' into dev-add-elab…
May 12, 2023
8ca2069
Merge branch 'dev-add-elaborate-log-suppression' into dev-1.6.0
May 12, 2023
97b7643
[core] fix tsbpd() may deadlock with processCtrlShutdown()
gou4shi1 May 17, 2023
d027188
Merge remote-tracking branch 'gou4shi1/fix-tsbpd-deadlock' into dev-1…
May 26, 2023
7cc801f
Updated and fixed
Sep 8, 2023
7658145
Fixed a bug introduced during upstream merge
Sep 11, 2023
41a86bf
Fixed tests that should require IPv6 enabled
Sep 11, 2023
d5a7604
Updated and fixed
Sep 13, 2023
5cf9b9e
Merge branch 'master' into dev-refax-group-utils
Sep 13, 2023
8a7fa07
Added one more utility
Sep 13, 2023
3371360
Merge branch 'master' into dev-untangle-locks-ls-conn
Sep 13, 2023
547697e
Simplification
Sep 14, 2023
dd47b7b
Updated 2677
Sep 14, 2023
50c81b7
Merge branch 'dev-refax-group-utils' into dev-1.6.0
Sep 14, 2023
6522513
Merge branch 'dev-fix-accept-leak-on-api-failure' into dev-1.6.0
Sep 14, 2023
be7bc06
Merge branch 'dev-untangle-locks-ls-conn' into dev-1.6.0
Sep 14, 2023
1ead248
Fixed according to the change
Sep 14, 2023
de62802
Merged partially, but still errors
Sep 14, 2023
6830c3a
Merged and fixed
Sep 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ configuration:
- Debug

image:
- Ubuntu
- Visual Studio 2019
- Visual Studio 2015
- Visual Studio 2013

platform:
- x64
- x86

build_script:
- ps: $VSIMG = $Env:APPVEYOR_BUILD_WORKER_IMAGE; $CNFG = $Env:CONFIGURATION
- ps: $VSIMG = $Env:APPVEYOR_BUILD_WORKER_IMAGE; $CNFG = $Env:CONFIGURATION
# use a few differing arguments depending on VS version to exercise different options during builds
- ps: if ($VSIMG -match '2019' -and $CNFG -eq "Release") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS ON -UNIT_TESTS ON -BONDING ON }
- ps: if ($VSIMG -match '2019' -and $CNFG -eq "Debug") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS ON }
- ps: if ($VSIMG -match '2019' -and $CNFG -eq "Release") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS ON -UNIT_TESTS ON -BONDING ON -ENABLE_SWIG ON}
- ps: if ($VSIMG -match '2019' -and $CNFG -eq "Debug") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS ON -ENABLE_SWIG ON}
- ps: if ($VSIMG -match '2015' -and $CNFG -eq "Release") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS ON -UNIT_TESTS ON -BONDING ON}
- ps: if ($VSIMG -match '2015' -and $CNFG -eq "Debug") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS OFF }
- ps: if ($VSIMG -match '2013' -and $CNFG -eq "Release") { .\scripts\build-windows.ps1 -CXX11 OFF -BUILD_APPS ON }
- ps: if ($VSIMG -match '2013' -and $CNFG -eq "Debug") { Exit-AppveyorBuild } # just skip 2013 debug build for speed
- sh: ./scripts/build-lin-docker.ps1 -ENABLE_SWIG ON

test_script:
- ps: if ( $Env:RUN_UNIT_TESTS ) { cd ./_build; ctest -E "TestIPv6.v6_calls_v4" --extra-verbose -C $Env:CONFIGURATION; cd ../ }

after_build:
- cmd: >-
scripts/gather-package.bat
7z a SRT-%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%-Win%PLATFORM%-%VS_VERSION%-%APPVEYOR_BUILD_VERSION%.zip %APPVEYOR_BUILD_FOLDER%\package\*
appveyor PushArtifact SRT-%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%-Win%PLATFORM%-%VS_VERSION%-%APPVEYOR_BUILD_VERSION%.zip
- cmd: cd %APPVEYOR_BUILD_FOLDER%
- cmd: scripts/gather-package.bat
- cmd: scripts/create-win64-nuget.bat
- cmd: 7z a SRT-%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%-Win%PLATFORM%-%VS_VERSION%-%APPVEYOR_BUILD_VERSION%.zip %APPVEYOR_BUILD_FOLDER%\package\*
- cmd: appveyor PushArtifact SRT-%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%-Win%PLATFORM%-%VS_VERSION%-%APPVEYOR_BUILD_VERSION%.zip
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ vcpkg/

# LSP
compile_commands.json

# Nuget packages
packages/
package/
*.nupkg

# Swig bindings
/srtcore/swig_bindings
95 changes: 88 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ endforeach()
# SRT_DEBUG_BONDING_STATES 1
# SRT_DEBUG_RTT 1 /* RTT trace */
# SRT_MAVG_SAMPLING_RATE 40 /* Max sampling rate */
# SRT_ENABLE_FREQUENT_LOG_TRACE 0 : set to 1 to enable printing reason for suppressed freq logs

# option defaults
set(ENABLE_HEAVY_LOGGING_DEFAULT OFF)
Expand Down Expand Up @@ -166,6 +167,8 @@ option(USE_BUSY_WAITING "Enable more accurate sending times at a cost of potenti
option(USE_GNUSTL "Get c++ library/headers from the gnustl.pc" OFF)
option(ENABLE_SOCK_CLOEXEC "Enable setting SOCK_CLOEXEC on a socket" ON)
option(ENABLE_SHOW_PROJECT_CONFIG "Enable show Project Configuration" OFF)
option(ENABLE_SWIG "Enable SWIG, used to generate alternative language bindings" OFF)
option(ENABLE_SWIG_CSHARP "Enable SWIG binding generation for CSharp language (only effective if ENABLE_SWIG is ON)" ON)

option(ENABLE_CLANG_TSA "Enable Clang Thread Safety Analysis" OFF)

Expand Down Expand Up @@ -232,7 +235,7 @@ if (NOT USE_ENCLIB)
endif()

set(USE_ENCLIB "${USE_ENCLIB}" CACHE STRING "The crypto library that SRT uses")
set_property(CACHE USE_ENCLIB PROPERTY STRINGS "openssl" "gnutls" "mbedtls")
set_property(CACHE USE_ENCLIB PROPERTY STRINGS "openssl" "gnutls" "mbedtls" "botan")

# Make sure DLLs and executabes go to the same path regardles of subdirectory
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
Expand Down Expand Up @@ -404,6 +407,46 @@ if (ENABLE_ENCRYPTION)
set (SSL_LIBRARIES ${OPENSSL_LIBRARIES})
message(STATUS "SSL via find_package(OpenSSL): -I ${SSL_INCLUDE_DIRS} -l;${SSL_LIBRARIES}")
endif()
elseif ("${USE_ENCLIB}" STREQUAL "botan")
add_definitions(-DUSE_BOTAN=1 -DCRYSPR2)
set (SSL_REQUIRED_MODULES "botan")
find_package(Botan 3.0.0 REQUIRED)
botan_generate(
botan
ffi
nist_keywrap
aes_armv8
aes_ni
aes_power8
aes_vperm
idea_sse2
serpent_avx2
shacal2_armv8
shacal2_avx2
shacal2_x86
sm4_armv8
rdseed
sha1_armv8
sha1_sse2
sha1_x86
sha2_32_armv8
sha2_32_bmi2
sha2_32_x86
sha2_64_bmi2
sha3_bmi2
zfec_sse2
zfec_vperm
argon2_avx2
argon2_ssse3
processor_rng
chacha_avx2
ghash_cpu
ghash_vperm
simd
simd_avx2)
target_compile_features("botan" PRIVATE "cxx_std_20")
set (SSL_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR})
set (SSL_LIBRARIES "botan")
else() # openssl
# Openssl (Direct-AES API) can use CRYSPR2
add_definitions(-DUSE_OPENSSL=1 -DCRYSPR2)
Expand Down Expand Up @@ -445,11 +488,11 @@ if (ENABLE_ENCRYPTION)
message (STATUS "SSL libraries: ${SSL_LIBRARIES}")

if (ENABLE_AEAD_API_PREVIEW)
if ("${USE_ENCLIB}" STREQUAL "openssl-evp")
if (("${USE_ENCLIB}" STREQUAL "openssl-evp") OR ("${USE_ENCLIB}" STREQUAL "botan"))
add_definitions(-DENABLE_AEAD_API_PREVIEW)
message(STATUS "ENCRYPTION AEAD API: ENABLED")
else()
message(FATAL_ERROR "ENABLE_AEAD_API_PREVIEW is only available with USE_ENCLIB=openssl-evp!")
message(FATAL_ERROR "ENABLE_AEAD_API_PREVIEW is only available with USE_ENCLIB=[openssl-evp | botan]!")
endif()
else()
message(STATUS "ENCRYPTION AEAD API: DISABLED")
Expand Down Expand Up @@ -1009,10 +1052,12 @@ if (srt_libspec_shared)
endif()
if (MICROSOFT)
target_link_libraries(${TARGET_srt}_shared PRIVATE ws2_32.lib)
if (OPENSSL_USE_STATIC_LIBS)
target_link_libraries(${TARGET_srt}_shared PRIVATE crypt32.lib)
else()
set_target_properties(${TARGET_srt}_shared PROPERTIES LINK_FLAGS "/DELAYLOAD:libeay32.dll")
if (NOT (ENABLE_ENCRYPTION AND "${USE_ENCLIB}" STREQUAL "botan"))
if (OPENSSL_USE_STATIC_LIBS)
target_link_libraries(${TARGET_srt}_shared PRIVATE crypt32.lib)
else()
set_target_properties(${TARGET_srt}_shared PROPERTIES LINK_FLAGS "/DELAYLOAD:libeay32.dll")
endif()
endif()
elseif (MINGW)
target_link_libraries(${TARGET_srt}_shared PRIVATE wsock32 ws2_32)
Expand Down Expand Up @@ -1096,6 +1141,10 @@ endif()

target_compile_definitions(srt_virtual PRIVATE -DSRT_LOG_SLOWDOWN_FREQ_MS=${SRT_LOG_SLOWDOWN_FREQ_MS})

if (ENABLE_ENCRYPTION AND "${USE_ENCLIB}" STREQUAL "botan")
add_dependencies(srt_virtual botan)
endif()

if (srt_libspec_shared)
if (MICROSOFT)
target_link_libraries(${TARGET_srt}_shared PUBLIC Ws2_32.lib)
Expand Down Expand Up @@ -1414,6 +1463,38 @@ endif()
srt_add_example(testcapi-connect.c)
endif()

#SWIG support - adding bindings for other languages into a new library that statically include the main SRT lib
cmake_policy(SET CMP0078 NEW)
cmake_policy(SET CMP0086 NEW)

#older cmakes do not understand this policy, so filter (VS2015 AppVeyor cmake is too old)
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.21)
cmake_policy(SET CMP0122 NEW)
endif()

#experimental SWIG support for csharp
if(ENABLE_SWIG)
#on windows, there is no swig just in the path - nuget / scripted downloads must be pointed at (linux it just works)
if(MICROSOFT)
#if nuget has been used to install swig in the project packages, bind to that
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/packages/swig/swigwin-4.1.1/swig.exe")
set(SWIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/packages/swig/swigwin-4.1.1/swig.exe")
endif()
endif()

FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})

if(UNIX AND NOT APPLE)
list(APPEND CMAKE_SWIG_FLAGS "-DSWIGWORDSIZE64")
endif()

if(ENABLE_SWIG_CSHARP)
swig_add_library(srt_swig_csharp LANGUAGE csharp SOURCES srtcore/srt.i OUTPUT_DIR ${CMAKE_BINARY_DIR}/swig_bindings/csharp)
swig_link_libraries(srt_swig_csharp ${srt_link_library} ${DEPENDS_srt})
set_property(TARGET srt_swig_csharp PROPERTY SWIG_COMPILE_OPTIONS -namespace SrtSharp)
endif()
endif()

if (ENABLE_UNITTESTS AND ENABLE_CXX11)

Expand Down
2 changes: 1 addition & 1 deletion apps/socketoptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct SocketOption
template<>
inline int SocketOption::setso<SocketOption::SRT, int>(int socket, int /*ignored*/, int sym, const void* data, size_t size)
{
return srt_setsockopt(socket, 0, SRT_SOCKOPT(sym), data, (int) size);
return (int)srt_setsockopt(SRTSOCKET(socket), 0, SRT_SOCKOPT(sym), data, (int) size);
}

#if ENABLE_BONDING
Expand Down
7 changes: 5 additions & 2 deletions apps/srt-file-transmit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ int parse_args(FileTransmitConfig &cfg, int argc, char** argv)
return 2;
}

cfg.chunk_size = stoul(Option<OutString>(params, "1456", o_chunk));
cfg.chunk_size = stoul(Option<OutString>(params, "0", o_chunk));
cfg.skip_flushing = Option<OutBool>(params, false, o_no_flush);
cfg.bw_report = stoi(Option<OutString>(params, "0", o_bwreport));
cfg.stats_report = stoi(Option<OutString>(params, "0", o_statsrep));
Expand Down Expand Up @@ -681,8 +681,11 @@ int main(int argc, char** argv)
//
// Set global config variables
//
if (cfg.chunk_size != SRT_LIVE_MAX_PLSIZE)
if (cfg.chunk_size != 0)
transmit_chunk_size = cfg.chunk_size;
else
transmit_chunk_size = SRT_MAX_PLSIZE_AF_INET;

transmit_stats_writer = SrtStatsWriterFactory(cfg.stats_pf);
transmit_bw_report = cfg.bw_report;
transmit_stats_report = cfg.stats_report;
Expand Down
37 changes: 34 additions & 3 deletions apps/transmitmedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ bool g_stats_are_printed_to_stdout = false;
bool transmit_total_stats = false;
unsigned long transmit_bw_report = 0;
unsigned long transmit_stats_report = 0;
unsigned long transmit_chunk_size = SRT_LIVE_MAX_PLSIZE;
unsigned long transmit_chunk_size = SRT_MAX_PLSIZE_AF_INET6;

class FileSource: public Source
{
Expand Down Expand Up @@ -179,6 +179,36 @@ void SrtCommon::InitParameters(string host, map<string,string> par)
m_adapter = host;
}

int fam_to_limit_size = AF_INET6; // take the less one as default

// Try to interpret host and adapter first
sockaddr_any host_sa, adapter_sa;

if (host != "")
{
host_sa = CreateAddr(host);
fam_to_limit_size = host_sa.family();
if (fam_to_limit_size == AF_UNSPEC)
Error("Failed to interpret 'host' spec: " + host);
}

if (adapter != "" && adapter != host)
{
adapter_sa = CreateAddr(adapter);
fam_to_limit_size = adapter_sa.family();

if (fam_to_limit_size == AF_UNSPEC)
Error("Failed to interpret 'adapter' spec: " + adapter);

if (host_sa.family() != AF_UNSPEC && host_sa.family() != adapter_sa.family())
{
Error("Both host and adapter specified and they use different IP versions");
}
}

if (fam_to_limit_size != AF_INET)
fam_to_limit_size = AF_INET6;

if (par.count("tsbpd") && false_names.count(par.at("tsbpd")))
{
m_tsbpdmode = false;
Expand All @@ -195,8 +225,9 @@ void SrtCommon::InitParameters(string host, map<string,string> par)
if ((par.count("transtype") == 0 || par["transtype"] != "file")
&& transmit_chunk_size > SRT_LIVE_DEF_PLSIZE)
{
if (transmit_chunk_size > SRT_LIVE_MAX_PLSIZE)
throw std::runtime_error("Chunk size in live mode exceeds 1456 bytes; this is not supported");
size_t size_limit = (size_t)SRT_MAX_PLSIZE(fam_to_limit_size);
if (transmit_chunk_size > size_limit)
throw std::runtime_error(Sprint("Chunk size in live mode exceeds ", size_limit, " bytes; this is not supported"));

par["payloadsize"] = Sprint(transmit_chunk_size);
}
Expand Down
37 changes: 36 additions & 1 deletion apps/uriparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,41 @@ string UriParser::queryValue(const string& strKey) const
return m_mapQuery.at(strKey);
}

// NOTE: handles percent encoded single byte ASCII / Latin-1 characters but not unicode characters and encodings

static string url_decode(const string& str)
{
string ret;
size_t prev_idx;
size_t idx;

for (prev_idx = 0; string::npos != (idx = str.find('%', prev_idx)); prev_idx = idx + 3)
{
char tmp[3];
unsigned hex;

if (idx + 2 >= str.size()) // bad percent encoding
break;

tmp[0] = str[idx + 1];
tmp[1] = str[idx + 2];
tmp[2] = '\0';

if (!isxdigit((unsigned char) tmp[0]) || // bad percent encoding
!isxdigit((unsigned char) tmp[1]) ||
1 != sscanf(tmp, "%x", &hex) ||
0 == hex)
break;

ret += str.substr(prev_idx, idx - prev_idx);
ret += (char) hex;
}

ret += str.substr(prev_idx, str.size() - prev_idx);

return ret;
}

void UriParser::Parse(const string& strUrl, DefaultExpect exp)
{
int iQueryStart = -1;
Expand Down Expand Up @@ -308,7 +343,7 @@ void UriParser::Parse(const string& strUrl, DefaultExpect exp)
idx = strQueryPair.find("=");
if (idx != string::npos)
{
m_mapQuery[strQueryPair.substr(0, idx)] = strQueryPair.substr(idx + 1, strQueryPair.size() - (idx + 1));
m_mapQuery[url_decode(strQueryPair.substr(0, idx))] = url_decode(strQueryPair.substr(idx + 1, strQueryPair.size() - (idx + 1)));
}
}

Expand Down
Loading
Loading