提交 fd2158aa authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Update NPM deps, nlohmann/json and usrsctp

上级 a6583d97
# Changelog # Changelog
### 3.6.33 (WIP)
* Update `nlohmann/json` to 3.9.1.
* Update `usrsctp`.
* Update NPM deps.
### 3.6.32 ### 3.6.32
* Fix notifications from `mediasoup-worker` being processed before responses received before them (issue #501). * Fix notifications from `mediasoup-worker` being processed before responses received before them (issue #501).
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
"testRegex": "test/test.*\\.js" "testRegex": "test/test.*\\.js"
}, },
"dependencies": { "dependencies": {
"@types/node": "^14.14.22", "@types/node": "^14.14.28",
"awaitqueue": "^2.3.3", "awaitqueue": "^2.3.3",
"debug": "^4.3.1", "debug": "^4.3.1",
"h264-profile-level-id": "^1.0.1", "h264-profile-level-id": "^1.0.1",
...@@ -60,10 +60,10 @@ ...@@ -60,10 +60,10 @@
"@types/debug": "^4.1.5", "@types/debug": "^4.1.5",
"@types/random-number": "0.0.0", "@types/random-number": "0.0.0",
"@types/uuid": "^8.3.0", "@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^4.14.1", "@typescript-eslint/eslint-plugin": "^4.15.0",
"@typescript-eslint/parser": "^4.14.1", "@typescript-eslint/parser": "^4.15.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint": "^7.18.0", "eslint": "^7.20.0",
"eslint-plugin-jest": "^24.1.3", "eslint-plugin-jest": "^24.1.3",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-clang-format": "^1.0.27", "gulp-clang-format": "^1.0.27",
......
...@@ -47,7 +47,7 @@ assignees: '' ...@@ -47,7 +47,7 @@ assignees: ''
<!-- Please add an `x` to the respective line. --> <!-- Please add an `x` to the respective line. -->
- [ ] latest release version 3.9.0 - [ ] latest release version 3.9.1
- [ ] other release - please state the version: ___ - [ ] other release - please state the version: ___
- [ ] the `develop` branch - [ ] the `develop` branch
......
...@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.1) ...@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.1)
## PROJECT ## PROJECT
## name and version ## name and version
## ##
project(nlohmann_json VERSION 3.9.0 LANGUAGES CXX) project(nlohmann_json VERSION 3.9.1 LANGUAGES CXX)
## ##
## INCLUDE ## INCLUDE
...@@ -40,6 +40,7 @@ set(NLOHMANN_JSON_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}") ...@@ -40,6 +40,7 @@ set(NLOHMANN_JSON_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}ConfigVersion.cmake") set(NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
set(NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Config.cmake") set(NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Config.cmake")
set(NLOHMANN_JSON_CMAKE_PROJECT_TARGETS_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Targets.cmake") set(NLOHMANN_JSON_CMAKE_PROJECT_TARGETS_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Targets.cmake")
set(NLOHMANN_JSON_PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
if (JSON_MultipleHeaders) if (JSON_MultipleHeaders)
set(NLOHMANN_JSON_INCLUDE_BUILD_DIR "${PROJECT_SOURCE_DIR}/include/") set(NLOHMANN_JSON_INCLUDE_BUILD_DIR "${PROJECT_SOURCE_DIR}/include/")
...@@ -157,7 +158,7 @@ endif() ...@@ -157,7 +158,7 @@ endif()
DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR} DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR}
) )
install( install(
FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc" FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION lib/pkgconfig DESTINATION ${NLOHMANN_JSON_PKGCONFIG_INSTALL_DIR}
) )
endif() endif()
# Changelog # Changelog
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
## [v3.9.1](https://github.com/nlohmann/json/releases/tag/v3.9.1) (2020-08-06)
[Full Changelog](https://github.com/nlohmann/json/compare/v3.9.0...v3.9.1)
- Can't parse not formatted JSON. [\#2340](https://github.com/nlohmann/json/issues/2340)
- parse returns desired array contained in array when JSON text begins with square bracket on gcc 7.5.0 [\#2339](https://github.com/nlohmann/json/issues/2339)
- Unexpected deserialization difference between Mac and Linux [\#2338](https://github.com/nlohmann/json/issues/2338)
- Reading ordered\_json from file causes compile error [\#2331](https://github.com/nlohmann/json/issues/2331)
- ignore\_comment=true fails on multiple consecutive lines starting with comments [\#2330](https://github.com/nlohmann/json/issues/2330)
- Update documentation about Homebrew installation and CMake integration - Homebrew [\#2326](https://github.com/nlohmann/json/issues/2326)
- Chinese character initialize error [\#2325](https://github.com/nlohmann/json/issues/2325)
- json.update and vector\<pair\>does not work with ordered\_json [\#2315](https://github.com/nlohmann/json/issues/2315)
- Ambiguous call to overloaded function [\#2210](https://github.com/nlohmann/json/issues/2210)
- Fix fallthrough warning [\#2333](https://github.com/nlohmann/json/pull/2333) ([nlohmann](https://github.com/nlohmann))
- Fix lexer to properly cope with repeated comments [\#2332](https://github.com/nlohmann/json/pull/2332) ([nlohmann](https://github.com/nlohmann))
- Fix name of Homebrew formula in documentation [\#2327](https://github.com/nlohmann/json/pull/2327) ([nlohmann](https://github.com/nlohmann))
- fix typo [\#2320](https://github.com/nlohmann/json/pull/2320) ([wx257osn2](https://github.com/wx257osn2))
- Fix a bug due to missing overloads in ordered\_map container [\#2319](https://github.com/nlohmann/json/pull/2319) ([nlohmann](https://github.com/nlohmann))
- cmake: install pkg-config file relative to current\_binary\_dir [\#2318](https://github.com/nlohmann/json/pull/2318) ([eli-schwartz](https://github.com/eli-schwartz))
- Fixed installation of pkg-config file on other than Ubuntu [\#2314](https://github.com/nlohmann/json/pull/2314) ([xvitaly](https://github.com/xvitaly))
- Cleanup [\#2303](https://github.com/nlohmann/json/pull/2303) ([nlohmann](https://github.com/nlohmann))
## [v3.9.0](https://github.com/nlohmann/json/releases/tag/v3.9.0) (2020-07-27) ## [v3.9.0](https://github.com/nlohmann/json/releases/tag/v3.9.0) (2020-07-27)
[Full Changelog](https://github.com/nlohmann/json/compare/v3.8.0...v3.9.0) [Full Changelog](https://github.com/nlohmann/json/compare/v3.8.0...v3.9.0)
...@@ -80,7 +103,6 @@ All notable changes to this project will be documented in this file. This projec ...@@ -80,7 +103,6 @@ All notable changes to this project will be documented in this file. This projec
- Fix bug in CBOR tag handling [\#2308](https://github.com/nlohmann/json/pull/2308) ([nlohmann](https://github.com/nlohmann)) - Fix bug in CBOR tag handling [\#2308](https://github.com/nlohmann/json/pull/2308) ([nlohmann](https://github.com/nlohmann))
- added inline to NLOHMANN\_DEFINE\_TYPE\_NON\_INTRUSIVE macro [\#2306](https://github.com/nlohmann/json/pull/2306) ([jwittbrodt](https://github.com/jwittbrodt)) - added inline to NLOHMANN\_DEFINE\_TYPE\_NON\_INTRUSIVE macro [\#2306](https://github.com/nlohmann/json/pull/2306) ([jwittbrodt](https://github.com/jwittbrodt))
- fixes unused variable 'ex' for \#2304 [\#2305](https://github.com/nlohmann/json/pull/2305) ([AODQ](https://github.com/AODQ)) - fixes unused variable 'ex' for \#2304 [\#2305](https://github.com/nlohmann/json/pull/2305) ([AODQ](https://github.com/AODQ))
- Cleanup [\#2303](https://github.com/nlohmann/json/pull/2303) ([nlohmann](https://github.com/nlohmann))
- Add test with multiple translation units [\#2301](https://github.com/nlohmann/json/pull/2301) ([nlohmann](https://github.com/nlohmann)) - Add test with multiple translation units [\#2301](https://github.com/nlohmann/json/pull/2301) ([nlohmann](https://github.com/nlohmann))
- Merge GitHub actions [\#2300](https://github.com/nlohmann/json/pull/2300) ([nlohmann](https://github.com/nlohmann)) - Merge GitHub actions [\#2300](https://github.com/nlohmann/json/pull/2300) ([nlohmann](https://github.com/nlohmann))
- Fix unused parameter [\#2299](https://github.com/nlohmann/json/pull/2299) ([nlohmann](https://github.com/nlohmann)) - Fix unused parameter [\#2299](https://github.com/nlohmann/json/pull/2299) ([nlohmann](https://github.com/nlohmann))
...@@ -741,6 +763,8 @@ All notable changes to this project will be documented in this file. This projec ...@@ -741,6 +763,8 @@ All notable changes to this project will be documented in this file. This projec
- Added to\_string and added basic tests [\#1585](https://github.com/nlohmann/json/pull/1585) ([Macr0Nerd](https://github.com/Macr0Nerd)) - Added to\_string and added basic tests [\#1585](https://github.com/nlohmann/json/pull/1585) ([Macr0Nerd](https://github.com/Macr0Nerd))
- Regression tests for MSVC [\#1570](https://github.com/nlohmann/json/pull/1570) ([nickaein](https://github.com/nickaein)) - Regression tests for MSVC [\#1570](https://github.com/nlohmann/json/pull/1570) ([nickaein](https://github.com/nickaein))
- Fix/1511 [\#1555](https://github.com/nlohmann/json/pull/1555) ([theodelrieu](https://github.com/theodelrieu)) - Fix/1511 [\#1555](https://github.com/nlohmann/json/pull/1555) ([theodelrieu](https://github.com/theodelrieu))
- Remove C++17 extension warning from clang; \#1535 [\#1551](https://github.com/nlohmann/json/pull/1551) ([heavywatal](https://github.com/heavywatal))
- moved from Catch to doctest for unit tests [\#1439](https://github.com/nlohmann/json/pull/1439) ([onqtam](https://github.com/onqtam))
## [v3.6.1](https://github.com/nlohmann/json/releases/tag/v3.6.1) (2019-03-20) ## [v3.6.1](https://github.com/nlohmann/json/releases/tag/v3.6.1) (2019-03-20)
...@@ -843,7 +867,6 @@ All notable changes to this project will be documented in this file. This projec ...@@ -843,7 +867,6 @@ All notable changes to this project will be documented in this file. This projec
- Implicit type conversion error on MSVC [\#1333](https://github.com/nlohmann/json/issues/1333) - Implicit type conversion error on MSVC [\#1333](https://github.com/nlohmann/json/issues/1333)
- NuGet Package [\#1132](https://github.com/nlohmann/json/issues/1132) - NuGet Package [\#1132](https://github.com/nlohmann/json/issues/1132)
- Remove C++17 extension warning from clang; \#1535 [\#1551](https://github.com/nlohmann/json/pull/1551) ([heavywatal](https://github.com/heavywatal))
- Change macros to numeric\_limits [\#1514](https://github.com/nlohmann/json/pull/1514) ([naszta](https://github.com/naszta)) - Change macros to numeric\_limits [\#1514](https://github.com/nlohmann/json/pull/1514) ([naszta](https://github.com/naszta))
- fix GCC 7.1.1 - 7.2.1 on CentOS [\#1496](https://github.com/nlohmann/json/pull/1496) ([lieff](https://github.com/lieff)) - fix GCC 7.1.1 - 7.2.1 on CentOS [\#1496](https://github.com/nlohmann/json/pull/1496) ([lieff](https://github.com/lieff))
- Update Buckaroo instructions in README.md [\#1495](https://github.com/nlohmann/json/pull/1495) ([njlr](https://github.com/njlr)) - Update Buckaroo instructions in README.md [\#1495](https://github.com/nlohmann/json/pull/1495) ([njlr](https://github.com/njlr))
...@@ -859,7 +882,6 @@ All notable changes to this project will be documented in this file. This projec ...@@ -859,7 +882,6 @@ All notable changes to this project will be documented in this file. This projec
- remove extra semicolon from readme [\#1451](https://github.com/nlohmann/json/pull/1451) ([Afforix](https://github.com/Afforix)) - remove extra semicolon from readme [\#1451](https://github.com/nlohmann/json/pull/1451) ([Afforix](https://github.com/Afforix))
- attempt to fix \#1445, flush buffer in serializer::dump\_escaped in UTF8\_REJECT case. [\#1446](https://github.com/nlohmann/json/pull/1446) ([scinart](https://github.com/scinart)) - attempt to fix \#1445, flush buffer in serializer::dump\_escaped in UTF8\_REJECT case. [\#1446](https://github.com/nlohmann/json/pull/1446) ([scinart](https://github.com/scinart))
- Use C++11 features supported by CMake 3.1. [\#1441](https://github.com/nlohmann/json/pull/1441) ([iwanders](https://github.com/iwanders)) - Use C++11 features supported by CMake 3.1. [\#1441](https://github.com/nlohmann/json/pull/1441) ([iwanders](https://github.com/iwanders))
- moved from Catch to doctest for unit tests [\#1439](https://github.com/nlohmann/json/pull/1439) ([onqtam](https://github.com/onqtam))
- :rotating\_light: fixed unused variable warning [\#1435](https://github.com/nlohmann/json/pull/1435) ([pboettch](https://github.com/pboettch)) - :rotating\_light: fixed unused variable warning [\#1435](https://github.com/nlohmann/json/pull/1435) ([pboettch](https://github.com/pboettch))
- allow push\_back\(\) and pop\_back\(\) calls on json\_pointer [\#1434](https://github.com/nlohmann/json/pull/1434) ([pboettch](https://github.com/pboettch)) - allow push\_back\(\) and pop\_back\(\) calls on json\_pointer [\#1434](https://github.com/nlohmann/json/pull/1434) ([pboettch](https://github.com/pboettch))
- Add instructions about using nlohmann/json with the conda package manager [\#1430](https://github.com/nlohmann/json/pull/1430) ([nicoddemus](https://github.com/nicoddemus)) - Add instructions about using nlohmann/json with the conda package manager [\#1430](https://github.com/nlohmann/json/pull/1430) ([nicoddemus](https://github.com/nicoddemus))
...@@ -870,6 +892,7 @@ All notable changes to this project will be documented in this file. This projec ...@@ -870,6 +892,7 @@ All notable changes to this project will be documented in this file. This projec
- Fix x64 target platform for appveyor [\#1414](https://github.com/nlohmann/json/pull/1414) ([nickaein](https://github.com/nickaein)) - Fix x64 target platform for appveyor [\#1414](https://github.com/nlohmann/json/pull/1414) ([nickaein](https://github.com/nickaein))
- Improve dump\_integer performance [\#1411](https://github.com/nlohmann/json/pull/1411) ([nickaein](https://github.com/nickaein)) - Improve dump\_integer performance [\#1411](https://github.com/nlohmann/json/pull/1411) ([nickaein](https://github.com/nickaein))
- buildsystem: relax requirement on cmake version [\#1409](https://github.com/nlohmann/json/pull/1409) ([yann-morin-1998](https://github.com/yann-morin-1998)) - buildsystem: relax requirement on cmake version [\#1409](https://github.com/nlohmann/json/pull/1409) ([yann-morin-1998](https://github.com/yann-morin-1998))
- Added Support for Structured Bindings [\#1391](https://github.com/nlohmann/json/pull/1391) ([pratikpc](https://github.com/pratikpc))
- CMake: Optional Install if Embedded [\#1330](https://github.com/nlohmann/json/pull/1330) ([ax3l](https://github.com/ax3l)) - CMake: Optional Install if Embedded [\#1330](https://github.com/nlohmann/json/pull/1330) ([ax3l](https://github.com/ax3l))
## [v3.5.0](https://github.com/nlohmann/json/releases/tag/v3.5.0) (2018-12-21) ## [v3.5.0](https://github.com/nlohmann/json/releases/tag/v3.5.0) (2018-12-21)
...@@ -939,7 +962,6 @@ All notable changes to this project will be documented in this file. This projec ...@@ -939,7 +962,6 @@ All notable changes to this project will be documented in this file. This projec
- Check value for existence by json\_pointer [\#1194](https://github.com/nlohmann/json/issues/1194) - Check value for existence by json\_pointer [\#1194](https://github.com/nlohmann/json/issues/1194)
- Feature/add file input adapter [\#1392](https://github.com/nlohmann/json/pull/1392) ([dumarjo](https://github.com/dumarjo)) - Feature/add file input adapter [\#1392](https://github.com/nlohmann/json/pull/1392) ([dumarjo](https://github.com/dumarjo))
- Added Support for Structured Bindings [\#1391](https://github.com/nlohmann/json/pull/1391) ([pratikpc](https://github.com/pratikpc))
- Link to issue \#958 broken [\#1382](https://github.com/nlohmann/json/pull/1382) ([kjpus](https://github.com/kjpus)) - Link to issue \#958 broken [\#1382](https://github.com/nlohmann/json/pull/1382) ([kjpus](https://github.com/kjpus))
- readme: fix typo [\#1380](https://github.com/nlohmann/json/pull/1380) ([manu-chroma](https://github.com/manu-chroma)) - readme: fix typo [\#1380](https://github.com/nlohmann/json/pull/1380) ([manu-chroma](https://github.com/manu-chroma))
- recommend using explicit from JSON conversions [\#1363](https://github.com/nlohmann/json/pull/1363) ([theodelrieu](https://github.com/theodelrieu)) - recommend using explicit from JSON conversions [\#1363](https://github.com/nlohmann/json/pull/1363) ([theodelrieu](https://github.com/theodelrieu))
...@@ -948,6 +970,7 @@ All notable changes to this project will be documented in this file. This projec ...@@ -948,6 +970,7 @@ All notable changes to this project will be documented in this file. This projec
- Set eofbit on exhausted input stream. [\#1343](https://github.com/nlohmann/json/pull/1343) ([mefyl](https://github.com/mefyl)) - Set eofbit on exhausted input stream. [\#1343](https://github.com/nlohmann/json/pull/1343) ([mefyl](https://github.com/mefyl))
- Add a SFINAE friendly iterator\_traits and use that instead. [\#1342](https://github.com/nlohmann/json/pull/1342) ([dgavedissian](https://github.com/dgavedissian)) - Add a SFINAE friendly iterator\_traits and use that instead. [\#1342](https://github.com/nlohmann/json/pull/1342) ([dgavedissian](https://github.com/dgavedissian))
- Fix EOL Whitespaces & CMake Spelling [\#1329](https://github.com/nlohmann/json/pull/1329) ([ax3l](https://github.com/ax3l)) - Fix EOL Whitespaces & CMake Spelling [\#1329](https://github.com/nlohmann/json/pull/1329) ([ax3l](https://github.com/ax3l))
- Add BSON support [\#1320](https://github.com/nlohmann/json/pull/1320) ([nlohmann](https://github.com/nlohmann))
## [v3.4.0](https://github.com/nlohmann/json/releases/tag/v3.4.0) (2018-10-30) ## [v3.4.0](https://github.com/nlohmann/json/releases/tag/v3.4.0) (2018-10-30)
...@@ -987,7 +1010,6 @@ All notable changes to this project will be documented in this file. This projec ...@@ -987,7 +1010,6 @@ All notable changes to this project will be documented in this file. This projec
- Soften the landing when dumping non-UTF8 strings \(type\_error.316 exception\) [\#1198](https://github.com/nlohmann/json/issues/1198) - Soften the landing when dumping non-UTF8 strings \(type\_error.316 exception\) [\#1198](https://github.com/nlohmann/json/issues/1198)
- Add macro to define enum/JSON mapping [\#1323](https://github.com/nlohmann/json/pull/1323) ([nlohmann](https://github.com/nlohmann)) - Add macro to define enum/JSON mapping [\#1323](https://github.com/nlohmann/json/pull/1323) ([nlohmann](https://github.com/nlohmann))
- Add BSON support [\#1320](https://github.com/nlohmann/json/pull/1320) ([nlohmann](https://github.com/nlohmann))
- Properly convert constants to CharType [\#1315](https://github.com/nlohmann/json/pull/1315) ([nlohmann](https://github.com/nlohmann)) - Properly convert constants to CharType [\#1315](https://github.com/nlohmann/json/pull/1315) ([nlohmann](https://github.com/nlohmann))
- Allow to set error handler for decoding errors [\#1314](https://github.com/nlohmann/json/pull/1314) ([nlohmann](https://github.com/nlohmann)) - Allow to set error handler for decoding errors [\#1314](https://github.com/nlohmann/json/pull/1314) ([nlohmann](https://github.com/nlohmann))
- Add Meson related info to README [\#1305](https://github.com/nlohmann/json/pull/1305) ([koponomarenko](https://github.com/koponomarenko)) - Add Meson related info to README [\#1305](https://github.com/nlohmann/json/pull/1305) ([koponomarenko](https://github.com/koponomarenko))
...@@ -1975,6 +1997,7 @@ All notable changes to this project will be documented in this file. This projec ...@@ -1975,6 +1997,7 @@ All notable changes to this project will be documented in this file. This projec
- Fix usage examples' comments for std::multiset [\#321](https://github.com/nlohmann/json/pull/321) ([vasild](https://github.com/vasild)) - Fix usage examples' comments for std::multiset [\#321](https://github.com/nlohmann/json/pull/321) ([vasild](https://github.com/vasild))
- Include dir relocation [\#318](https://github.com/nlohmann/json/pull/318) ([ChristophJud](https://github.com/ChristophJud)) - Include dir relocation [\#318](https://github.com/nlohmann/json/pull/318) ([ChristophJud](https://github.com/ChristophJud))
- trivial documentation fix [\#313](https://github.com/nlohmann/json/pull/313) ([5tefan](https://github.com/5tefan)) - trivial documentation fix [\#313](https://github.com/nlohmann/json/pull/313) ([5tefan](https://github.com/5tefan))
- unit-constructor1.cpp: Fix floating point truncation warning [\#300](https://github.com/nlohmann/json/pull/300) ([t-b](https://github.com/t-b))
## [v2.0.5](https://github.com/nlohmann/json/releases/tag/v2.0.5) (2016-09-14) ## [v2.0.5](https://github.com/nlohmann/json/releases/tag/v2.0.5) (2016-09-14)
...@@ -2007,8 +2030,6 @@ All notable changes to this project will be documented in this file. This projec ...@@ -2007,8 +2030,6 @@ All notable changes to this project will be documented in this file. This projec
- Incorrect parsing of large int64\_t numbers [\#287](https://github.com/nlohmann/json/issues/287) - Incorrect parsing of large int64\_t numbers [\#287](https://github.com/nlohmann/json/issues/287)
- \[question\]: macro to disable floating point support [\#284](https://github.com/nlohmann/json/issues/284) - \[question\]: macro to disable floating point support [\#284](https://github.com/nlohmann/json/issues/284)
- unit-constructor1.cpp: Fix floating point truncation warning [\#300](https://github.com/nlohmann/json/pull/300) ([t-b](https://github.com/t-b))
## [v2.0.2](https://github.com/nlohmann/json/releases/tag/v2.0.2) (2016-07-31) ## [v2.0.2](https://github.com/nlohmann/json/releases/tag/v2.0.2) (2016-07-31)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.1...v2.0.2) [Full Changelog](https://github.com/nlohmann/json/compare/v2.0.1...v2.0.2)
...@@ -2085,7 +2106,6 @@ All notable changes to this project will be documented in this file. This projec ...@@ -2085,7 +2106,6 @@ All notable changes to this project will be documented in this file. This projec
- What is within scope? [\#192](https://github.com/nlohmann/json/issues/192) - What is within scope? [\#192](https://github.com/nlohmann/json/issues/192)
- Bugs in miloyip/nativejson-benchmark: roundtrips [\#187](https://github.com/nlohmann/json/issues/187) - Bugs in miloyip/nativejson-benchmark: roundtrips [\#187](https://github.com/nlohmann/json/issues/187)
- Floating point exceptions [\#181](https://github.com/nlohmann/json/issues/181) - Floating point exceptions [\#181](https://github.com/nlohmann/json/issues/181)
- Integer conversion to unsigned [\#178](https://github.com/nlohmann/json/issues/178)
- map string string fails to compile [\#176](https://github.com/nlohmann/json/issues/176) - map string string fails to compile [\#176](https://github.com/nlohmann/json/issues/176)
- In basic\_json::basic\_json\(const CompatibleArrayType& val\), the requirement of CompatibleArrayType is not strict enough. [\#174](https://github.com/nlohmann/json/issues/174) - In basic\_json::basic\_json\(const CompatibleArrayType& val\), the requirement of CompatibleArrayType is not strict enough. [\#174](https://github.com/nlohmann/json/issues/174)
- Provide a FAQ [\#163](https://github.com/nlohmann/json/issues/163) - Provide a FAQ [\#163](https://github.com/nlohmann/json/issues/163)
...@@ -2104,7 +2124,6 @@ All notable changes to this project will be documented in this file. This projec ...@@ -2104,7 +2124,6 @@ All notable changes to this project will be documented in this file. This projec
- fixed noexcept; added constexpr [\#208](https://github.com/nlohmann/json/pull/208) ([nlohmann](https://github.com/nlohmann)) - fixed noexcept; added constexpr [\#208](https://github.com/nlohmann/json/pull/208) ([nlohmann](https://github.com/nlohmann))
- Add support for afl-fuzz testing [\#207](https://github.com/nlohmann/json/pull/207) ([mykter](https://github.com/mykter)) - Add support for afl-fuzz testing [\#207](https://github.com/nlohmann/json/pull/207) ([mykter](https://github.com/mykter))
- replaced ssize\_t occurrences with auto \(addresses \#204\) [\#205](https://github.com/nlohmann/json/pull/205) ([nlohmann](https://github.com/nlohmann)) - replaced ssize\_t occurrences with auto \(addresses \#204\) [\#205](https://github.com/nlohmann/json/pull/205) ([nlohmann](https://github.com/nlohmann))
- Fixed issue \#199 - Small bugs in json.hpp \(get\_number\) and unit.cpp \(non-standard integer type test\) [\#200](https://github.com/nlohmann/json/pull/200) ([twelsby](https://github.com/twelsby))
- Fix broken link [\#197](https://github.com/nlohmann/json/pull/197) ([vog](https://github.com/vog)) - Fix broken link [\#197](https://github.com/nlohmann/json/pull/197) ([vog](https://github.com/vog))
- Issue \#195 - update Travis to Trusty due to gcc/clang strtod\(\) bug [\#196](https://github.com/nlohmann/json/pull/196) ([twelsby](https://github.com/twelsby)) - Issue \#195 - update Travis to Trusty due to gcc/clang strtod\(\) bug [\#196](https://github.com/nlohmann/json/pull/196) ([twelsby](https://github.com/twelsby))
- Issue \#178 - Extending support to full uint64\_t/int64\_t range and unsigned type \(updated\) [\#193](https://github.com/nlohmann/json/pull/193) ([twelsby](https://github.com/twelsby)) - Issue \#178 - Extending support to full uint64\_t/int64\_t range and unsigned type \(updated\) [\#193](https://github.com/nlohmann/json/pull/193) ([twelsby](https://github.com/twelsby))
...@@ -2118,6 +2137,7 @@ All notable changes to this project will be documented in this file. This projec ...@@ -2118,6 +2137,7 @@ All notable changes to this project will be documented in this file. This projec
- Floating point equality [\#185](https://github.com/nlohmann/json/issues/185) - Floating point equality [\#185](https://github.com/nlohmann/json/issues/185)
- Unused variables in catch [\#180](https://github.com/nlohmann/json/issues/180) - Unused variables in catch [\#180](https://github.com/nlohmann/json/issues/180)
- Typo in documentation [\#179](https://github.com/nlohmann/json/issues/179) - Typo in documentation [\#179](https://github.com/nlohmann/json/issues/179)
- Integer conversion to unsigned [\#178](https://github.com/nlohmann/json/issues/178)
- JSON performance benchmark comparision [\#177](https://github.com/nlohmann/json/issues/177) - JSON performance benchmark comparision [\#177](https://github.com/nlohmann/json/issues/177)
- Since re2c is often ignored in pull requests, it may make sense to make a contributing.md file [\#175](https://github.com/nlohmann/json/issues/175) - Since re2c is often ignored in pull requests, it may make sense to make a contributing.md file [\#175](https://github.com/nlohmann/json/issues/175)
- Question about exceptions [\#173](https://github.com/nlohmann/json/issues/173) - Question about exceptions [\#173](https://github.com/nlohmann/json/issues/173)
...@@ -2131,11 +2151,11 @@ All notable changes to this project will be documented in this file. This projec ...@@ -2131,11 +2151,11 @@ All notable changes to this project will be documented in this file. This projec
- range based for loop for objects [\#83](https://github.com/nlohmann/json/issues/83) - range based for loop for objects [\#83](https://github.com/nlohmann/json/issues/83)
- Consider submitting this to the Boost Library Incubator [\#66](https://github.com/nlohmann/json/issues/66) - Consider submitting this to the Boost Library Incubator [\#66](https://github.com/nlohmann/json/issues/66)
- Fixed issue \#199 - Small bugs in json.hpp \(get\_number\) and unit.cpp \(non-standard integer type test\) [\#200](https://github.com/nlohmann/json/pull/200) ([twelsby](https://github.com/twelsby))
- Fixed Issue \#186 - add strto\(f|d|ld\) overload wrappers, "-0.0" special case and FP trailing zero [\#191](https://github.com/nlohmann/json/pull/191) ([twelsby](https://github.com/twelsby)) - Fixed Issue \#186 - add strto\(f|d|ld\) overload wrappers, "-0.0" special case and FP trailing zero [\#191](https://github.com/nlohmann/json/pull/191) ([twelsby](https://github.com/twelsby))
- Issue \#185 - remove approx\(\) and use \#pragma to kill warnings [\#190](https://github.com/nlohmann/json/pull/190) ([twelsby](https://github.com/twelsby)) - Issue \#185 - remove approx\(\) and use \#pragma to kill warnings [\#190](https://github.com/nlohmann/json/pull/190) ([twelsby](https://github.com/twelsby))
- Fixed Issue \#171 - added two extra template overloads of operator\[\] for T\* arguments [\#189](https://github.com/nlohmann/json/pull/189) ([twelsby](https://github.com/twelsby)) - Fixed Issue \#171 - added two extra template overloads of operator\[\] for T\* arguments [\#189](https://github.com/nlohmann/json/pull/189) ([twelsby](https://github.com/twelsby))
- Fixed issue \#167 - removed operator ValueType\(\) condition for VS2015 [\#188](https://github.com/nlohmann/json/pull/188) ([twelsby](https://github.com/twelsby)) - Fixed issue \#167 - removed operator ValueType\(\) condition for VS2015 [\#188](https://github.com/nlohmann/json/pull/188) ([twelsby](https://github.com/twelsby))
- Implementation of get\_ref\(\) [\#184](https://github.com/nlohmann/json/pull/184) ([dariomt](https://github.com/dariomt))
- Fixed some typos in CONTRIBUTING.md [\#182](https://github.com/nlohmann/json/pull/182) ([nibroc](https://github.com/nibroc)) - Fixed some typos in CONTRIBUTING.md [\#182](https://github.com/nlohmann/json/pull/182) ([nibroc](https://github.com/nibroc))
## [v1.0.0](https://github.com/nlohmann/json/releases/tag/v1.0.0) (2015-12-27) ## [v1.0.0](https://github.com/nlohmann/json/releases/tag/v1.0.0) (2015-12-27)
...@@ -2177,6 +2197,7 @@ All notable changes to this project will be documented in this file. This projec ...@@ -2177,6 +2197,7 @@ All notable changes to this project will be documented in this file. This projec
- Wishlist [\#65](https://github.com/nlohmann/json/issues/65) - Wishlist [\#65](https://github.com/nlohmann/json/issues/65)
- Windows/Visual Studio \(through 2013\) is unsupported [\#62](https://github.com/nlohmann/json/issues/62) - Windows/Visual Studio \(through 2013\) is unsupported [\#62](https://github.com/nlohmann/json/issues/62)
- Implementation of get\_ref\(\) [\#184](https://github.com/nlohmann/json/pull/184) ([dariomt](https://github.com/dariomt))
- Replace sprintf with hex function, this fixes \#149 [\#153](https://github.com/nlohmann/json/pull/153) ([whackashoe](https://github.com/whackashoe)) - Replace sprintf with hex function, this fixes \#149 [\#153](https://github.com/nlohmann/json/pull/153) ([whackashoe](https://github.com/whackashoe))
- Fix character skipping after a surrogate pair [\#146](https://github.com/nlohmann/json/pull/146) ([robertmrk](https://github.com/robertmrk)) - Fix character skipping after a surrogate pair [\#146](https://github.com/nlohmann/json/pull/146) ([robertmrk](https://github.com/robertmrk))
- Detect correctly pointer-to-const [\#137](https://github.com/nlohmann/json/pull/137) ([dariomt](https://github.com/dariomt)) - Detect correctly pointer-to-const [\#137](https://github.com/nlohmann/json/pull/137) ([dariomt](https://github.com/dariomt))
......
...@@ -1611,7 +1611,7 @@ Here is a related issue [#1924](https://github.com/nlohmann/json/issues/1924). ...@@ -1611,7 +1611,7 @@ Here is a related issue [#1924](https://github.com/nlohmann/json/issues/1924).
- The code contains numerous debug **assertions** which can be switched off by defining the preprocessor macro `NDEBUG`, see the [documentation of `assert`](https://en.cppreference.com/w/cpp/error/assert). In particular, note [`operator[]`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a233b02b0839ef798942dd46157cc0fe6.html#a233b02b0839ef798942dd46157cc0fe6) implements **unchecked access** for const objects: If the given key is not present, the behavior is undefined (think of a dereferenced null pointer) and yields an [assertion failure](https://github.com/nlohmann/json/issues/289) if assertions are switched on. If you are not sure whether an element in an object exists, use checked access with the [`at()` function](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a73ae333487310e3302135189ce8ff5d8.html#a73ae333487310e3302135189ce8ff5d8). Furthermore, you can define `JSON_ASSERT(x)` to replace calls to `assert(x)`. - The code contains numerous debug **assertions** which can be switched off by defining the preprocessor macro `NDEBUG`, see the [documentation of `assert`](https://en.cppreference.com/w/cpp/error/assert). In particular, note [`operator[]`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a233b02b0839ef798942dd46157cc0fe6.html#a233b02b0839ef798942dd46157cc0fe6) implements **unchecked access** for const objects: If the given key is not present, the behavior is undefined (think of a dereferenced null pointer) and yields an [assertion failure](https://github.com/nlohmann/json/issues/289) if assertions are switched on. If you are not sure whether an element in an object exists, use checked access with the [`at()` function](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a73ae333487310e3302135189ce8ff5d8.html#a73ae333487310e3302135189ce8ff5d8). Furthermore, you can define `JSON_ASSERT(x)` to replace calls to `assert(x)`.
- As the exact type of a number is not defined in the [JSON specification](https://tools.ietf.org/html/rfc8259.html), this library tries to choose the best fitting C++ number type automatically. As a result, the type `double` may be used to store numbers which may yield [**floating-point exceptions**](https://github.com/nlohmann/json/issues/181) in certain rare situations if floating-point exceptions have been unmasked in the calling code. These exceptions are not caused by the library and need to be fixed in the calling code, such as by re-masking the exceptions prior to calling library functions. - As the exact type of a number is not defined in the [JSON specification](https://tools.ietf.org/html/rfc8259.html), this library tries to choose the best fitting C++ number type automatically. As a result, the type `double` may be used to store numbers which may yield [**floating-point exceptions**](https://github.com/nlohmann/json/issues/181) in certain rare situations if floating-point exceptions have been unmasked in the calling code. These exceptions are not caused by the library and need to be fixed in the calling code, such as by re-masking the exceptions prior to calling library functions.
- The code can be compiled without C++ **runtime type identification** features; that is, you can use the `-fno-rtti` compiler flag. - The code can be compiled without C++ **runtime type identification** features; that is, you can use the `-fno-rtti` compiler flag.
- **Exceptions** are used widely within the library. They can, however, be switched off with either using the compiler flag `-fno-exceptions` or by defining the symbol `JSON_NOEXCEPTION`. In this case, exceptions are replaced by `abort()` calls. You can further control this behavior by defining `JSON_THROW_USER´` (overriding `throw`), `JSON_TRY_USER` (overriding `try`), and `JSON_CATCH_USER` (overriding `catch`). Note that `JSON_THROW_USER` should leave the current scope (e.g., by throwing or aborting), as continuing after it may yield undefined behavior. - **Exceptions** are used widely within the library. They can, however, be switched off with either using the compiler flag `-fno-exceptions` or by defining the symbol `JSON_NOEXCEPTION`. In this case, exceptions are replaced by `abort()` calls. You can further control this behavior by defining `JSON_THROW_USER` (overriding `throw`), `JSON_TRY_USER` (overriding `try`), and `JSON_CATCH_USER` (overriding `catch`). Note that `JSON_THROW_USER` should leave the current scope (e.g., by throwing or aborting), as continuing after it may yield undefined behavior.
## Execute unit tests ## Execute unit tests
......
...@@ -880,13 +880,13 @@ class lexer : public lexer_base<BasicJsonType> ...@@ -880,13 +880,13 @@ class lexer : public lexer_base<BasicJsonType>
default: default:
{ {
unget(); unget();
break; continue;
} }
} }
} }
default: default:
break; continue;
} }
} }
} }
...@@ -1511,7 +1511,7 @@ scan_number_done: ...@@ -1511,7 +1511,7 @@ scan_number_done:
skip_whitespace(); skip_whitespace();
// ignore comments // ignore comments
if (ignore_comments && current == '/') while (ignore_comments && current == '/')
{ {
if (!scan_comment()) if (!scan_comment())
{ {
......
/* /*
__ _____ _____ _____ __ _____ _____ _____
__| | __| | | | JSON for Modern C++ __| | __| | | | JSON for Modern C++
| | |__ | | | | | | version 3.9.0 | | |__ | | | | | | version 3.9.1
|_____|_____|_____|_|___| https://github.com/nlohmann/json |_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License <http://opensource.org/licenses/MIT>. Licensed under the MIT License <http://opensource.org/licenses/MIT>.
...@@ -32,7 +32,7 @@ SOFTWARE. ...@@ -32,7 +32,7 @@ SOFTWARE.
#define NLOHMANN_JSON_VERSION_MAJOR 3 #define NLOHMANN_JSON_VERSION_MAJOR 3
#define NLOHMANN_JSON_VERSION_MINOR 9 #define NLOHMANN_JSON_VERSION_MINOR 9
#define NLOHMANN_JSON_VERSION_PATCH 0 #define NLOHMANN_JSON_VERSION_PATCH 1
#include <algorithm> // all_of, find, for_each #include <algorithm> // all_of, find, for_each
#include <cstddef> // nullptr_t, ptrdiff_t, size_t #include <cstddef> // nullptr_t, ptrdiff_t, size_t
...@@ -1052,7 +1052,7 @@ class basic_json ...@@ -1052,7 +1052,7 @@ class basic_json
object = nullptr; // silence warning, see #821 object = nullptr; // silence warning, see #821
if (JSON_HEDLEY_UNLIKELY(t == value_t::null)) if (JSON_HEDLEY_UNLIKELY(t == value_t::null))
{ {
JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.9.0")); // LCOV_EXCL_LINE JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.9.1")); // LCOV_EXCL_LINE
} }
break; break;
} }
......
...@@ -18,6 +18,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>, ...@@ -18,6 +18,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
using mapped_type = T; using mapped_type = T;
using Container = std::vector<std::pair<const Key, T>, Allocator>; using Container = std::vector<std::pair<const Key, T>, Allocator>;
using typename Container::iterator; using typename Container::iterator;
using typename Container::const_iterator;
using typename Container::size_type; using typename Container::size_type;
using typename Container::value_type; using typename Container::value_type;
...@@ -30,7 +31,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>, ...@@ -30,7 +31,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
ordered_map(std::initializer_list<T> init, const Allocator& alloc = Allocator() ) ordered_map(std::initializer_list<T> init, const Allocator& alloc = Allocator() )
: Container{init, alloc} {} : Container{init, alloc} {}
std::pair<iterator, bool> emplace(key_type&& key, T&& t) std::pair<iterator, bool> emplace(const key_type& key, T&& t)
{ {
for (auto it = this->begin(); it != this->end(); ++it) for (auto it = this->begin(); it != this->end(); ++it)
{ {
...@@ -43,9 +44,40 @@ template <class Key, class T, class IgnoredLess = std::less<Key>, ...@@ -43,9 +44,40 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
return {--this->end(), true}; return {--this->end(), true};
} }
T& operator[](Key&& key) T& operator[](const Key& key)
{ {
return emplace(std::move(key), T{}).first->second; return emplace(key, T{}).first->second;
}
const T& operator[](const Key& key) const
{
return at(key);
}
T& at(const Key& key)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (it->first == key)
{
return it->second;
}
}
throw std::out_of_range("key not found");
}
const T& at(const Key& key) const
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (it->first == key)
{
return it->second;
}
}
throw std::out_of_range("key not found");
} }
size_type erase(const Key& key) size_type erase(const Key& key)
...@@ -66,6 +98,74 @@ template <class Key, class T, class IgnoredLess = std::less<Key>, ...@@ -66,6 +98,74 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
} }
return 0; return 0;
} }
iterator erase(iterator pos)
{
auto it = pos;
// Since we cannot move const Keys, re-construct them in place
for (auto next = it; ++next != this->end(); ++it)
{
it->~value_type(); // Destroy but keep allocation
new (&*it) value_type{std::move(*next)};
}
Container::pop_back();
return pos;
}
size_type count(const Key& key) const
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (it->first == key)
{
return 1;
}
}
return 0;
}
iterator find(const Key& key)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (it->first == key)
{
return it;
}
}
return Container::end();
}
const_iterator find(const Key& key) const
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (it->first == key)
{
return it;
}
}
return Container::end();
}
std::pair<iterator, bool> insert( value_type&& value )
{
return emplace(value.first, std::move(value.second));
}
std::pair<iterator, bool> insert( const value_type& value )
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (it->first == value.first)
{
return {it, false};
}
}
Container::push_back(value);
return {--this->end(), true};
}
}; };
} // namespace nlohmann } // namespace nlohmann
project('nlohmann_json', project('nlohmann_json',
'cpp', 'cpp',
version : '3.9.0', version : '3.9.1',
license : 'MIT', license : 'MIT',
) )
......
/* /*
__ _____ _____ _____ __ _____ _____ _____
__| | __| | | | JSON for Modern C++ __| | __| | | | JSON for Modern C++
| | |__ | | | | | | version 3.9.0 | | |__ | | | | | | version 3.9.1
|_____|_____|_____|_|___| https://github.com/nlohmann/json |_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License <http://opensource.org/licenses/MIT>. Licensed under the MIT License <http://opensource.org/licenses/MIT>.
...@@ -32,7 +32,7 @@ SOFTWARE. ...@@ -32,7 +32,7 @@ SOFTWARE.
#define NLOHMANN_JSON_VERSION_MAJOR 3 #define NLOHMANN_JSON_VERSION_MAJOR 3
#define NLOHMANN_JSON_VERSION_MINOR 9 #define NLOHMANN_JSON_VERSION_MINOR 9
#define NLOHMANN_JSON_VERSION_PATCH 0 #define NLOHMANN_JSON_VERSION_PATCH 1
#include <algorithm> // all_of, find, for_each #include <algorithm> // all_of, find, for_each
#include <cstddef> // nullptr_t, ptrdiff_t, size_t #include <cstddef> // nullptr_t, ptrdiff_t, size_t
...@@ -6759,13 +6759,13 @@ class lexer : public lexer_base<BasicJsonType> ...@@ -6759,13 +6759,13 @@ class lexer : public lexer_base<BasicJsonType>
default: default:
{ {
unget(); unget();
break; continue;
} }
} }
} }
default: default:
break; continue;
} }
} }
} }
...@@ -7390,7 +7390,7 @@ scan_number_done: ...@@ -7390,7 +7390,7 @@ scan_number_done:
skip_whitespace(); skip_whitespace();
// ignore comments // ignore comments
if (ignore_comments && current == '/') while (ignore_comments && current == '/')
{ {
if (!scan_comment()) if (!scan_comment())
{ {
...@@ -16408,6 +16408,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>, ...@@ -16408,6 +16408,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
using mapped_type = T; using mapped_type = T;
using Container = std::vector<std::pair<const Key, T>, Allocator>; using Container = std::vector<std::pair<const Key, T>, Allocator>;
using typename Container::iterator; using typename Container::iterator;
using typename Container::const_iterator;
using typename Container::size_type; using typename Container::size_type;
using typename Container::value_type; using typename Container::value_type;
...@@ -16420,7 +16421,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>, ...@@ -16420,7 +16421,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
ordered_map(std::initializer_list<T> init, const Allocator& alloc = Allocator() ) ordered_map(std::initializer_list<T> init, const Allocator& alloc = Allocator() )
: Container{init, alloc} {} : Container{init, alloc} {}
std::pair<iterator, bool> emplace(key_type&& key, T&& t) std::pair<iterator, bool> emplace(const key_type& key, T&& t)
{ {
for (auto it = this->begin(); it != this->end(); ++it) for (auto it = this->begin(); it != this->end(); ++it)
{ {
...@@ -16433,9 +16434,40 @@ template <class Key, class T, class IgnoredLess = std::less<Key>, ...@@ -16433,9 +16434,40 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
return {--this->end(), true}; return {--this->end(), true};
} }
T& operator[](Key&& key) T& operator[](const Key& key)
{
return emplace(key, T{}).first->second;
}
const T& operator[](const Key& key) const
{
return at(key);
}
T& at(const Key& key)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (it->first == key)
{
return it->second;
}
}
throw std::out_of_range("key not found");
}
const T& at(const Key& key) const
{ {
return emplace(std::move(key), T{}).first->second; for (auto it = this->begin(); it != this->end(); ++it)
{
if (it->first == key)
{
return it->second;
}
}
throw std::out_of_range("key not found");
} }
size_type erase(const Key& key) size_type erase(const Key& key)
...@@ -16456,6 +16488,74 @@ template <class Key, class T, class IgnoredLess = std::less<Key>, ...@@ -16456,6 +16488,74 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
} }
return 0; return 0;
} }
iterator erase(iterator pos)
{
auto it = pos;
// Since we cannot move const Keys, re-construct them in place
for (auto next = it; ++next != this->end(); ++it)
{
it->~value_type(); // Destroy but keep allocation
new (&*it) value_type{std::move(*next)};
}
Container::pop_back();
return pos;
}
size_type count(const Key& key) const
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (it->first == key)
{
return 1;
}
}
return 0;
}
iterator find(const Key& key)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (it->first == key)
{
return it;
}
}
return Container::end();
}
const_iterator find(const Key& key) const
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (it->first == key)
{
return it;
}
}
return Container::end();
}
std::pair<iterator, bool> insert( value_type&& value )
{
return emplace(value.first, std::move(value.second));
}
std::pair<iterator, bool> insert( const value_type& value )
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (it->first == value.first)
{
return {it, false};
}
}
Container::push_back(value);
return {--this->end(), true};
}
}; };
} // namespace nlohmann } // namespace nlohmann
...@@ -17440,7 +17540,7 @@ class basic_json ...@@ -17440,7 +17540,7 @@ class basic_json
object = nullptr; // silence warning, see #821 object = nullptr; // silence warning, see #821
if (JSON_HEDLEY_UNLIKELY(t == value_t::null)) if (JSON_HEDLEY_UNLIKELY(t == value_t::null))
{ {
JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.9.0")); // LCOV_EXCL_LINE JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.9.1")); // LCOV_EXCL_LINE
} }
break; break;
} }
......
...@@ -2,7 +2,7 @@ wsjcpp_version: "v0.1.1" ...@@ -2,7 +2,7 @@ wsjcpp_version: "v0.1.1"
cmake_minimum_required: "3.0" cmake_minimum_required: "3.0"
cmake_cxx_standard: "11" cmake_cxx_standard: "11"
name: "nlohmann/json" name: "nlohmann/json"
version: "v3.9.0" version: "v3.9.1"
description: "JSON for Modern C++" description: "JSON for Modern C++"
issues: "https://github.com/nlohmann/json/issues" issues: "https://github.com/nlohmann/json/issues"
keywords: keywords:
......
name: Build with CMake
on:
push:
branches: [ master, github-actions ]
pull_request:
branches: [ master ]
jobs:
build:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
cmake_build_type: [Debug, RelWithDebInfo]
sctp_invariants: [ON, OFF]
sctp_inet6: [ON, OFF]
sctp_inet: [ON, OFF]
sctp_debug: [ON, OFF]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
with:
path: 'usrsctp_source'
- name: Prepare dirs
shell: bash
run: |
mkdir -p cmake_build
mkdir -p cmake_install
- name: Generate CMake project
shell: bash
run: |
cd cmake_build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-Dsctp_debug=${{ matrix.sctp_debug }} \
-Dsctp_invariants=${{ matrix.sctp_invariants }} \
-Dsctp_inet6=${{ matrix.sctp_inet6 }} \
-Dsctp_inet=${{ matrix.sctp_inet }} \
-Dsctp_build_programs=ON \
-Dsctp_build_fuzzer=OFF \
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/cmake_install \
${GITHUB_WORKSPACE}/usrsctp_source
- name: Build and install project
shell: bash
run: |
cmake --build cmake_build \
--parallel 2 \
--config ${{ matrix.cmake_build_type }} \
--target install \
--clean-first
...@@ -28,7 +28,7 @@ dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ...@@ -28,7 +28,7 @@ dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
dnl SUCH DAMAGE. dnl SUCH DAMAGE.
dnl dnl
AC_INIT([libusrsctp], [0.9.3.0]) AC_INIT([libusrsctp], [0.9.5.0])
AM_INIT_AUTOMAKE([foreign]) AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC AC_PROG_CC
......
# Project definition # Project definition
project('usrsctplib', 'c', project('usrsctplib', 'c',
version: '1.0.0', version: '0.9.5.0',
default_options: ['c_std=c99'], default_options: ['c_std=c99'],
meson_version: '>=0.49.0') meson_version: '>=0.49.0')
# Shared library API and ABI versions
# Notice: shared library version must be in X.Y.Z format only
soversion_full = '2.0.0'
soversion_short = '2'
# Set compiler warning flags # Set compiler warning flags
compiler = meson.get_compiler('c') compiler = meson.get_compiler('c')
if compiler.get_argument_syntax() == 'msvc' if compiler.get_argument_syntax() == 'msvc'
...@@ -186,7 +191,8 @@ else ...@@ -186,7 +191,8 @@ else
dependencies: dependencies, dependencies: dependencies,
include_directories: include_dirs, include_directories: include_dirs,
install: true, install: true,
version: meson.project_version()) version: soversion_full,
soversion: soversion_short)
endif endif
# Declare dependency # Declare dependency
......
...@@ -34,14 +34,21 @@ ...@@ -34,14 +34,21 @@
# INCLUDE MODULES AND SETTINGS # INCLUDE MODULES AND SETTINGS
################################################# #################################################
set(VERSION "1.0.0") set(VERSION "0.9.5.0")
# Shared library API and ABI versions
# Notice: shared library version must be in X.Y.Z format only
set(SOVERSION_FULL "2.0.0")
set(SOVERSION_SHORT "2")
include(GNUInstallDirs)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${prefix})
set(libdir ${exec_prefix}/${CMAKE_INSTALL_LIBDIR})
set(includedir ${prefix}/${CMAKE_INSTALL_INCLUDEDIR}/usrsctp)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${prefix})
set(libdir ${exec_prefix}/lib)
set(includedir ${prefix}/include/usrsctp)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MACOSX_RPATH 1) set(CMAKE_MACOSX_RPATH 1)
include(CheckCCompilerFlag) include(CheckCCompilerFlag)
...@@ -80,7 +87,6 @@ if (sctp_build_shared_lib) ...@@ -80,7 +87,6 @@ if (sctp_build_shared_lib)
set(BUILD_SHARED_LIBS 1) set(BUILD_SHARED_LIBS 1)
endif () endif ()
################################################# #################################################
# LIBRARY FILES # LIBRARY FILES
################################################# #################################################
...@@ -176,16 +182,18 @@ if (WIN32) ...@@ -176,16 +182,18 @@ if (WIN32)
endif () endif ()
set_target_properties(usrsctp PROPERTIES IMPORT_SUFFIX "_import.lib") set_target_properties(usrsctp PROPERTIES IMPORT_SUFFIX "_import.lib")
set_target_properties(usrsctp PROPERTIES SOVERSION 1 VERSION 1.0.0) set_target_properties(usrsctp PROPERTIES SOVERSION ${SOVERSION_SHORT} VERSION ${SOVERSION_FULL})
if (NOT DEFINED CMAKE_INSTALL_LIBDIR)
SET(CMAKE_INSTALL_LIBDIR lib)
endif ()
################################################# #################################################
# INSTALL LIBRARY AND HEADER # INSTALL LIBRARY AND HEADER
################################################# #################################################
install(TARGETS usrsctp DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(TARGETS usrsctp DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES usrsctp.h DESTINATION include) install(FILES usrsctp.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
#################################################
# GENERATE AND INSTALL PKG-CONFIG FILE
#################################################
configure_file("${PROJECT_SOURCE_DIR}/usrsctp.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/usrsctp.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/usrsctp.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
...@@ -76,6 +76,6 @@ libusrsctp_la_SOURCES = user_atomic.h \ ...@@ -76,6 +76,6 @@ libusrsctp_la_SOURCES = user_atomic.h \
netinet6/sctp6_var.h \ netinet6/sctp6_var.h \
netinet6/sctp6_usrreq.c netinet6/sctp6_usrreq.c
libusrsctp_la_CFLAGS = $(LIBCFLAGS) libusrsctp_la_CFLAGS = $(LIBCFLAGS)
libusrsctp_la_LDFLAGS = -version-info 1:0:0 libusrsctp_la_LDFLAGS = -version-info 2:0:0
include_HEADERS = usrsctp.h include_HEADERS = usrsctp.h
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 367520 2020-11-09 13:12:07Z tuexen $"); __FBSDID("$FreeBSD$");
#endif #endif
#include <netinet/sctp_os.h> #include <netinet/sctp_os.h>
...@@ -838,7 +838,7 @@ restart: ...@@ -838,7 +838,7 @@ restart:
} }
memset(nc, 0, sizeof(struct sctp_queued_to_read)); memset(nc, 0, sizeof(struct sctp_queued_to_read));
TAILQ_REMOVE(&control->reasm, chk, sctp_next); TAILQ_REMOVE(&control->reasm, chk, sctp_next);
sctp_add_chk_to_control(control, strm, stcb, asoc, chk, SCTP_READ_LOCK_NOT_HELD); sctp_add_chk_to_control(control, strm, stcb, asoc, chk, inp_read_lock_held);
fsn++; fsn++;
cnt_added++; cnt_added++;
chk = NULL; chk = NULL;
...@@ -927,7 +927,7 @@ restart: ...@@ -927,7 +927,7 @@ restart:
} }
if (cnt_added && strm->pd_api_started) { if (cnt_added && strm->pd_api_started) {
#if defined(__Userspace__) #if defined(__Userspace__)
sctp_invoke_recv_callback(stcb->sctp_ep, stcb, control, SCTP_READ_LOCK_NOT_HELD); sctp_invoke_recv_callback(stcb->sctp_ep, stcb, control, inp_read_lock_held);
#endif #endif
sctp_wakeup_the_read_socket(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); sctp_wakeup_the_read_socket(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED);
} }
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 368622 2020-12-13 23:51:51Z tuexen $"); __FBSDID("$FreeBSD$");
#endif #endif
#include <netinet/sctp_os.h> #include <netinet/sctp_os.h>
...@@ -2074,9 +2074,9 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, ...@@ -2074,9 +2074,9 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
asoc->strmout[i].abandoned_sent[0] = 0; asoc->strmout[i].abandoned_sent[0] = 0;
asoc->strmout[i].abandoned_unsent[0] = 0; asoc->strmout[i].abandoned_unsent[0] = 0;
#endif #endif
stcb->asoc.strmout[i].sid = i;
stcb->asoc.strmout[i].next_mid_ordered = 0; stcb->asoc.strmout[i].next_mid_ordered = 0;
stcb->asoc.strmout[i].next_mid_unordered = 0; stcb->asoc.strmout[i].next_mid_unordered = 0;
stcb->asoc.strmout[i].sid = i;
stcb->asoc.strmout[i].last_msg_incomplete = 0; stcb->asoc.strmout[i].last_msg_incomplete = 0;
} }
TAILQ_FOREACH_SAFE(strrst, &asoc->resetHead, next_resp, nstrrst) { TAILQ_FOREACH_SAFE(strrst, &asoc->resetHead, next_resp, nstrrst) {
......
...@@ -283,9 +283,13 @@ typedef char* caddr_t; ...@@ -283,9 +283,13 @@ typedef char* caddr_t;
#else /* !defined(Userspace_os_Windows) */ #else /* !defined(Userspace_os_Windows) */
#include <sys/socket.h> #include <sys/socket.h>
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__native_client__) || defined(__Fuchsia__) || defined(__EMSCRIPTEN_PTHREADS__)
#include <pthread.h> #if defined(__EMSCRIPTEN__) && !defined(__EMSCRIPTEN_PTHREADS__)
#error "Unsupported build configuration."
#endif #endif
#include <pthread.h>
typedef pthread_mutex_t userland_mutex_t; typedef pthread_mutex_t userland_mutex_t;
typedef pthread_cond_t userland_cond_t; typedef pthread_cond_t userland_cond_t;
typedef pthread_t userland_thread_t; typedef pthread_t userland_thread_t;
......
...@@ -3736,9 +3736,8 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er ...@@ -3736,9 +3736,8 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er
} }
for (i = 0; i < stcb->asoc.streamoutcnt; i++) { for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); TAILQ_INIT(&stcb->asoc.strmout[i].outqueue);
stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL);
stcb->asoc.strmout[i].chunks_on_queues = 0; stcb->asoc.strmout[i].chunks_on_queues = 0;
stcb->asoc.strmout[i].next_mid_ordered = 0;
stcb->asoc.strmout[i].next_mid_unordered = 0;
#if defined(SCTP_DETAILED_STR_STATS) #if defined(SCTP_DETAILED_STR_STATS)
for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) { for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) {
stcb->asoc.strmout[i].abandoned_sent[j] = 0; stcb->asoc.strmout[i].abandoned_sent[j] = 0;
...@@ -3748,10 +3747,11 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er ...@@ -3748,10 +3747,11 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er
stcb->asoc.strmout[i].abandoned_sent[0] = 0; stcb->asoc.strmout[i].abandoned_sent[0] = 0;
stcb->asoc.strmout[i].abandoned_unsent[0] = 0; stcb->asoc.strmout[i].abandoned_unsent[0] = 0;
#endif #endif
stcb->asoc.strmout[i].next_mid_ordered = 0;
stcb->asoc.strmout[i].next_mid_unordered = 0;
stcb->asoc.strmout[i].sid = i; stcb->asoc.strmout[i].sid = i;
stcb->asoc.strmout[i].last_msg_incomplete = 0; stcb->asoc.strmout[i].last_msg_incomplete = 0;
stcb->asoc.strmout[i].state = SCTP_STREAM_OPENING; stcb->asoc.strmout[i].state = SCTP_STREAM_OPENING;
stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL);
} }
} }
break; break;
...@@ -5682,24 +5682,23 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_initpkt, ...@@ -5682,24 +5682,23 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_initpkt,
return (op_err); return (op_err);
} }
static int /*
* Given a INIT chunk, look through the parameters to verify that there
* are no new addresses.
* Return true, if there is a new address or there is a problem parsing
the parameters. Provide an optional error cause used when sending an ABORT.
* Return false, if there are no new addresses and there is no problem in
parameter processing.
*/
static bool
sctp_are_there_new_addresses(struct sctp_association *asoc, sctp_are_there_new_addresses(struct sctp_association *asoc,
struct mbuf *in_initpkt, int offset, struct sockaddr *src) struct mbuf *in_initpkt, int offset, int limit, struct sockaddr *src,
struct mbuf **op_err)
{ {
/*
* Given a INIT packet, look through the packet to verify that there
* are NO new addresses. As we go through the parameters add reports
* of any un-understood parameters that require an error. Also we
* must return (1) to drop the packet if we see a un-understood
* parameter that tells us to drop the chunk.
*/
struct sockaddr *sa_touse; struct sockaddr *sa_touse;
struct sockaddr *sa; struct sockaddr *sa;
struct sctp_paramhdr *phdr, params; struct sctp_paramhdr *phdr, params;
uint16_t ptype, plen;
uint8_t fnd;
struct sctp_nets *net; struct sctp_nets *net;
int check_src;
#ifdef INET #ifdef INET
struct sockaddr_in sin4, *sa4; struct sockaddr_in sin4, *sa4;
#endif #endif
...@@ -5709,7 +5708,10 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, ...@@ -5709,7 +5708,10 @@ sctp_are_there_new_addresses(struct sctp_association *asoc,
#if defined(__Userspace__) #if defined(__Userspace__)
struct sockaddr_conn *sac; struct sockaddr_conn *sac;
#endif #endif
uint16_t ptype, plen;
bool fnd, check_src;
*op_err = NULL;
#ifdef INET #ifdef INET
memset(&sin4, 0, sizeof(sin4)); memset(&sin4, 0, sizeof(sin4));
sin4.sin_family = AF_INET; sin4.sin_family = AF_INET;
...@@ -5725,26 +5727,26 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, ...@@ -5725,26 +5727,26 @@ sctp_are_there_new_addresses(struct sctp_association *asoc,
#endif #endif
#endif #endif
/* First what about the src address of the pkt ? */ /* First what about the src address of the pkt ? */
check_src = 0; check_src = false;
switch (src->sa_family) { switch (src->sa_family) {
#ifdef INET #ifdef INET
case AF_INET: case AF_INET:
if (asoc->scope.ipv4_addr_legal) { if (asoc->scope.ipv4_addr_legal) {
check_src = 1; check_src = true;
} }
break; break;
#endif #endif
#ifdef INET6 #ifdef INET6
case AF_INET6: case AF_INET6:
if (asoc->scope.ipv6_addr_legal) { if (asoc->scope.ipv6_addr_legal) {
check_src = 1; check_src = true;
} }
break; break;
#endif #endif
#if defined(__Userspace__) #if defined(__Userspace__)
case AF_CONN: case AF_CONN:
if (asoc->scope.conn_addr_legal) { if (asoc->scope.conn_addr_legal) {
check_src = 1; check_src = true;
} }
break; break;
#endif #endif
...@@ -5753,7 +5755,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, ...@@ -5753,7 +5755,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc,
break; break;
} }
if (check_src) { if (check_src) {
fnd = 0; fnd = false;
TAILQ_FOREACH(net, &asoc->nets, sctp_next) { TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
sa = (struct sockaddr *)&net->ro._l_addr; sa = (struct sockaddr *)&net->ro._l_addr;
if (sa->sa_family == src->sa_family) { if (sa->sa_family == src->sa_family) {
...@@ -5764,7 +5766,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, ...@@ -5764,7 +5766,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc,
sa4 = (struct sockaddr_in *)sa; sa4 = (struct sockaddr_in *)sa;
src4 = (struct sockaddr_in *)src; src4 = (struct sockaddr_in *)src;
if (sa4->sin_addr.s_addr == src4->sin_addr.s_addr) { if (sa4->sin_addr.s_addr == src4->sin_addr.s_addr) {
fnd = 1; fnd = true;
break; break;
} }
} }
...@@ -5776,7 +5778,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, ...@@ -5776,7 +5778,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc,
sa6 = (struct sockaddr_in6 *)sa; sa6 = (struct sockaddr_in6 *)sa;
src6 = (struct sockaddr_in6 *)src; src6 = (struct sockaddr_in6 *)src;
if (SCTP6_ARE_ADDR_EQUAL(sa6, src6)) { if (SCTP6_ARE_ADDR_EQUAL(sa6, src6)) {
fnd = 1; fnd = true;
break; break;
} }
} }
...@@ -5788,16 +5790,22 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, ...@@ -5788,16 +5790,22 @@ sctp_are_there_new_addresses(struct sctp_association *asoc,
sac = (struct sockaddr_conn *)sa; sac = (struct sockaddr_conn *)sa;
srcc = (struct sockaddr_conn *)src; srcc = (struct sockaddr_conn *)src;
if (sac->sconn_addr == srcc->sconn_addr) { if (sac->sconn_addr == srcc->sconn_addr) {
fnd = 1; fnd = true;
break; break;
} }
} }
#endif #endif
} }
} }
if (fnd == 0) { if (!fnd) {
/* New address added! no need to look further. */ /*
return (1); * If sending an ABORT in case of an additional address,
* don't use the new address error cause.
* This looks no different than if no listener was
* present.
*/
*op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Address added");
return (true);
} }
} }
/* Ok so far lets munge through the rest of the packet */ /* Ok so far lets munge through the rest of the packet */
...@@ -5807,6 +5815,14 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, ...@@ -5807,6 +5815,14 @@ sctp_are_there_new_addresses(struct sctp_association *asoc,
sa_touse = NULL; sa_touse = NULL;
ptype = ntohs(phdr->param_type); ptype = ntohs(phdr->param_type);
plen = ntohs(phdr->param_length); plen = ntohs(phdr->param_length);
if (offset + plen > limit) {
*op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "Partial parameter");
return (true);
}
if (plen < sizeof(struct sctp_paramhdr)) {
*op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "Parameter length too small");
return (true);
}
switch (ptype) { switch (ptype) {
#ifdef INET #ifdef INET
case SCTP_IPV4_ADDRESS: case SCTP_IPV4_ADDRESS:
...@@ -5814,12 +5830,14 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, ...@@ -5814,12 +5830,14 @@ sctp_are_there_new_addresses(struct sctp_association *asoc,
struct sctp_ipv4addr_param *p4, p4_buf; struct sctp_ipv4addr_param *p4, p4_buf;
if (plen != sizeof(struct sctp_ipv4addr_param)) { if (plen != sizeof(struct sctp_ipv4addr_param)) {
return (1); *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "Parameter length illegal");
return (true);
} }
phdr = sctp_get_next_param(in_initpkt, offset, phdr = sctp_get_next_param(in_initpkt, offset,
(struct sctp_paramhdr *)&p4_buf, sizeof(p4_buf)); (struct sctp_paramhdr *)&p4_buf, sizeof(p4_buf));
if (phdr == NULL) { if (phdr == NULL) {
return (1); *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "");
return (true);
} }
if (asoc->scope.ipv4_addr_legal) { if (asoc->scope.ipv4_addr_legal) {
p4 = (struct sctp_ipv4addr_param *)phdr; p4 = (struct sctp_ipv4addr_param *)phdr;
...@@ -5835,12 +5853,14 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, ...@@ -5835,12 +5853,14 @@ sctp_are_there_new_addresses(struct sctp_association *asoc,
struct sctp_ipv6addr_param *p6, p6_buf; struct sctp_ipv6addr_param *p6, p6_buf;
if (plen != sizeof(struct sctp_ipv6addr_param)) { if (plen != sizeof(struct sctp_ipv6addr_param)) {
return (1); *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "Parameter length illegal");
return (true);
} }
phdr = sctp_get_next_param(in_initpkt, offset, phdr = sctp_get_next_param(in_initpkt, offset,
(struct sctp_paramhdr *)&p6_buf, sizeof(p6_buf)); (struct sctp_paramhdr *)&p6_buf, sizeof(p6_buf));
if (phdr == NULL) { if (phdr == NULL) {
return (1); *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "");
return (true);
} }
if (asoc->scope.ipv6_addr_legal) { if (asoc->scope.ipv6_addr_legal) {
p6 = (struct sctp_ipv6addr_param *)phdr; p6 = (struct sctp_ipv6addr_param *)phdr;
...@@ -5857,7 +5877,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, ...@@ -5857,7 +5877,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc,
} }
if (sa_touse) { if (sa_touse) {
/* ok, sa_touse points to one to check */ /* ok, sa_touse points to one to check */
fnd = 0; fnd = false;
TAILQ_FOREACH(net, &asoc->nets, sctp_next) { TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
sa = (struct sockaddr *)&net->ro._l_addr; sa = (struct sockaddr *)&net->ro._l_addr;
if (sa->sa_family != sa_touse->sa_family) { if (sa->sa_family != sa_touse->sa_family) {
...@@ -5868,7 +5888,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, ...@@ -5868,7 +5888,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc,
sa4 = (struct sockaddr_in *)sa; sa4 = (struct sockaddr_in *)sa;
if (sa4->sin_addr.s_addr == if (sa4->sin_addr.s_addr ==
sin4.sin_addr.s_addr) { sin4.sin_addr.s_addr) {
fnd = 1; fnd = true;
break; break;
} }
} }
...@@ -5878,21 +5898,31 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, ...@@ -5878,21 +5898,31 @@ sctp_are_there_new_addresses(struct sctp_association *asoc,
sa6 = (struct sockaddr_in6 *)sa; sa6 = (struct sockaddr_in6 *)sa;
if (SCTP6_ARE_ADDR_EQUAL( if (SCTP6_ARE_ADDR_EQUAL(
sa6, &sin6)) { sa6, &sin6)) {
fnd = 1; fnd = true;
break; break;
} }
} }
#endif #endif
} }
if (!fnd) { if (!fnd) {
/* New addr added! no need to look further */ /*
return (1); * If sending an ABORT in case of an additional
* address, don't use the new address error
* cause.
* This looks no different than if no listener
* was present.
*/
*op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Address added");
return (true);
} }
} }
offset += SCTP_SIZE32(plen); offset += SCTP_SIZE32(plen);
if (offset >= limit) {
break;
}
phdr = sctp_get_next_param(in_initpkt, offset, &params, sizeof(params)); phdr = sctp_get_next_param(in_initpkt, offset, &params, sizeof(params));
} }
return (0); return (false);
} }
/* /*
...@@ -5908,7 +5938,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, ...@@ -5908,7 +5938,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
struct sockaddr *src, struct sockaddr *dst, struct sockaddr *src, struct sockaddr *dst,
struct sctphdr *sh, struct sctp_init_chunk *init_chk, struct sctphdr *sh, struct sctp_init_chunk *init_chk,
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
uint8_t mflowtype, uint32_t mflowid, uint8_t mflowtype, uint32_t mflowid,
#endif #endif
uint32_t vrf_id, uint16_t port) uint32_t vrf_id, uint16_t port)
{ {
...@@ -5955,16 +5985,10 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, ...@@ -5955,16 +5985,10 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
} }
if ((asoc != NULL) && if ((asoc != NULL) &&
(SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_WAIT)) { (SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_WAIT)) {
if (sctp_are_there_new_addresses(asoc, init_pkt, offset, src)) { if (sctp_are_there_new_addresses(asoc, init_pkt, offset, offset + ntohs(init_chk->ch.chunk_length), src, &op_err)) {
/* /*
* new addresses, out of here in non-cookie-wait states * new addresses, out of here in non-cookie-wait states
*
* Send an ABORT, without the new address error cause.
* This looks no different than if no listener
* was present.
*/ */
op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code),
"Address added");
sctp_send_abort(init_pkt, iphlen, src, dst, sh, 0, op_err, sctp_send_abort(init_pkt, iphlen, src, dst, sh, 0, op_err,
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
mflowtype, mflowid, inp->fibnum, mflowtype, mflowid, inp->fibnum,
...@@ -12928,15 +12952,24 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, ...@@ -12928,15 +12952,24 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb,
stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0, 1); stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0, 1);
for (i = 0; i < stcb->asoc.streamoutcnt; i++) { for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); TAILQ_INIT(&stcb->asoc.strmout[i].outqueue);
/* FIX ME FIX ME */
/* This should be a SS_COPY operation FIX ME STREAM SCHEDULER EXPERT */
stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]);
stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues; stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues;
#if defined(SCTP_DETAILED_STR_STATS)
for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) {
stcb->asoc.strmout[i].abandoned_sent[j] = oldstream[i].abandoned_sent[j];
stcb->asoc.strmout[i].abandoned_unsent[j] = oldstream[i].abandoned_unsent[j];
}
#else
stcb->asoc.strmout[i].abandoned_sent[0] = oldstream[i].abandoned_sent[0];
stcb->asoc.strmout[i].abandoned_unsent[0] = oldstream[i].abandoned_unsent[0];
#endif
stcb->asoc.strmout[i].next_mid_ordered = oldstream[i].next_mid_ordered; stcb->asoc.strmout[i].next_mid_ordered = oldstream[i].next_mid_ordered;
stcb->asoc.strmout[i].next_mid_unordered = oldstream[i].next_mid_unordered; stcb->asoc.strmout[i].next_mid_unordered = oldstream[i].next_mid_unordered;
stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete;
stcb->asoc.strmout[i].sid = i; stcb->asoc.strmout[i].sid = i;
stcb->asoc.strmout[i].state = oldstream[i].state; stcb->asoc.strmout[i].state = oldstream[i].state;
/* FIX ME FIX ME */
/* This should be a SS_COPY operation FIX ME STREAM SCHEDULER EXPERT */
stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]);
/* now anything on those queues? */ /* now anything on those queues? */
TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) { TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) {
TAILQ_REMOVE(&oldstream[i].outqueue, sp, next); TAILQ_REMOVE(&oldstream[i].outqueue, sp, next);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_structs.h 365071 2020-09-01 21:19:14Z mjg $"); __FBSDID("$FreeBSD$");
#endif #endif
#ifndef _NETINET_SCTP_STRUCTS_H_ #ifndef _NETINET_SCTP_STRUCTS_H_
...@@ -598,6 +598,20 @@ struct sctp_stream_in { ...@@ -598,6 +598,20 @@ struct sctp_stream_in {
TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out); TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out);
TAILQ_HEAD(sctplist_listhead, sctp_stream_queue_pending); TAILQ_HEAD(sctplist_listhead, sctp_stream_queue_pending);
/*
* This union holds all data necessary for
* different stream schedulers.
*/
struct scheduling_data {
struct sctp_stream_out *locked_on_sending;
/* circular looking for output selection */
struct sctp_stream_out *last_out_stream;
union {
struct sctpwheel_listhead wheel;
struct sctplist_listhead list;
} out;
};
/* Round-robin schedulers */ /* Round-robin schedulers */
struct ss_rr { struct ss_rr {
/* next link in wheel */ /* next link in wheel */
...@@ -620,20 +634,6 @@ struct ss_fb { ...@@ -620,20 +634,6 @@ struct ss_fb {
int32_t rounds; int32_t rounds;
}; };
/*
* This union holds all data necessary for
* different stream schedulers.
*/
struct scheduling_data {
struct sctp_stream_out *locked_on_sending;
/* circular looking for output selection */
struct sctp_stream_out *last_out_stream;
union {
struct sctpwheel_listhead wheel;
struct sctplist_listhead list;
} out;
};
/* /*
* This union holds all parameters per stream * This union holds all parameters per stream
* necessary for different stream schedulers. * necessary for different stream schedulers.
...@@ -651,8 +651,6 @@ union scheduling_parameters { ...@@ -651,8 +651,6 @@ union scheduling_parameters {
#define SCTP_STREAM_RESET_PENDING 0x03 #define SCTP_STREAM_RESET_PENDING 0x03
#define SCTP_STREAM_RESET_IN_FLIGHT 0x04 #define SCTP_STREAM_RESET_IN_FLIGHT 0x04
#define SCTP_MAX_STREAMS_AT_ONCE_RESET 200
/* This struct is used to track the traffic on outbound streams */ /* This struct is used to track the traffic on outbound streams */
struct sctp_stream_out { struct sctp_stream_out {
struct sctp_streamhead outqueue; struct sctp_streamhead outqueue;
...@@ -676,6 +674,8 @@ struct sctp_stream_out { ...@@ -676,6 +674,8 @@ struct sctp_stream_out {
uint8_t state; uint8_t state;
}; };
#define SCTP_MAX_STREAMS_AT_ONCE_RESET 200
/* used to keep track of the addresses yet to try to add/delete */ /* used to keep track of the addresses yet to try to add/delete */
TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr); TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr);
struct sctp_asconf_addr { struct sctp_asconf_addr {
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 366482 2020-10-06 11:08:52Z tuexen $"); __FBSDID("$FreeBSD$");
#endif #endif
#include <netinet/sctp_os.h> #include <netinet/sctp_os.h>
...@@ -1333,9 +1333,8 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, ...@@ -1333,9 +1333,8 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
* that were dropped must be notified to the upper layer as * that were dropped must be notified to the upper layer as
* failed to send. * failed to send.
*/ */
asoc->strmout[i].next_mid_ordered = 0;
asoc->strmout[i].next_mid_unordered = 0;
TAILQ_INIT(&asoc->strmout[i].outqueue); TAILQ_INIT(&asoc->strmout[i].outqueue);
asoc->ss_functions.sctp_ss_init_stream(stcb, &asoc->strmout[i], NULL);
asoc->strmout[i].chunks_on_queues = 0; asoc->strmout[i].chunks_on_queues = 0;
#if defined(SCTP_DETAILED_STR_STATS) #if defined(SCTP_DETAILED_STR_STATS)
for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) { for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) {
...@@ -1346,10 +1345,11 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, ...@@ -1346,10 +1345,11 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
asoc->strmout[i].abandoned_sent[0] = 0; asoc->strmout[i].abandoned_sent[0] = 0;
asoc->strmout[i].abandoned_unsent[0] = 0; asoc->strmout[i].abandoned_unsent[0] = 0;
#endif #endif
asoc->strmout[i].next_mid_ordered = 0;
asoc->strmout[i].next_mid_unordered = 0;
asoc->strmout[i].sid = i; asoc->strmout[i].sid = i;
asoc->strmout[i].last_msg_incomplete = 0; asoc->strmout[i].last_msg_incomplete = 0;
asoc->strmout[i].state = SCTP_STREAM_OPENING; asoc->strmout[i].state = SCTP_STREAM_OPENING;
asoc->ss_functions.sctp_ss_init_stream(stcb, &asoc->strmout[i], NULL);
} }
asoc->ss_functions.sctp_ss_init(stcb, asoc, 0); asoc->ss_functions.sctp_ss_init(stcb, asoc, 0);
...@@ -2117,14 +2117,13 @@ sctp_timeout_handler(void *t) ...@@ -2117,14 +2117,13 @@ sctp_timeout_handler(void *t)
SCTP_SOCKET_UNLOCK(SCTP_INP_SO(inp), 1); SCTP_SOCKET_UNLOCK(SCTP_INP_SO(inp), 1);
#endif #endif
inp = NULL; inp = NULL;
goto out_no_decr; goto out_decr;
case SCTP_TIMER_TYPE_ASOCKILL: case SCTP_TIMER_TYPE_ASOCKILL:
KASSERT(inp != NULL && stcb != NULL && net == NULL, KASSERT(inp != NULL && stcb != NULL && net == NULL,
("timeout of type %d: inp = %p, stcb = %p, net = %p", ("timeout of type %d: inp = %p, stcb = %p, net = %p",
type, inp, stcb, net)); type, inp, stcb, net));
SCTP_STAT_INCR(sctps_timoassockill); SCTP_STAT_INCR(sctps_timoassockill);
/* Can we free it yet? */ /* Can we free it yet? */
SCTP_INP_DECR_REF(inp);
sctp_timer_stop(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL, sctp_timer_stop(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL,
SCTP_FROM_SCTPUTIL + SCTP_LOC_1); SCTP_FROM_SCTPUTIL + SCTP_LOC_1);
#if defined(__APPLE__) && !defined(__Userspace__) #if defined(__APPLE__) && !defined(__Userspace__)
...@@ -2145,7 +2144,7 @@ sctp_timeout_handler(void *t) ...@@ -2145,7 +2144,7 @@ sctp_timeout_handler(void *t)
* duplicate unlock or unlock of a free mtx :-0 * duplicate unlock or unlock of a free mtx :-0
*/ */
stcb = NULL; stcb = NULL;
goto out_no_decr; goto out_decr;
case SCTP_TIMER_TYPE_ADDR_WQ: case SCTP_TIMER_TYPE_ADDR_WQ:
KASSERT(inp == NULL && stcb == NULL && net == NULL, KASSERT(inp == NULL && stcb == NULL && net == NULL,
("timeout of type %d: inp = %p, stcb = %p, net = %p", ("timeout of type %d: inp = %p, stcb = %p, net = %p",
...@@ -2214,7 +2213,6 @@ out_decr: ...@@ -2214,7 +2213,6 @@ out_decr:
if (net != NULL) { if (net != NULL) {
sctp_free_remote_addr(net); sctp_free_remote_addr(net);
} }
out_no_decr:
SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d handler finished.\n", type); SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d handler finished.\n", type);
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
CURVNET_RESTORE(); CURVNET_RESTORE();
......
...@@ -92,7 +92,7 @@ extern u_short ip_id; ...@@ -92,7 +92,7 @@ extern u_short ip_id;
#include <stdlib.h> #include <stdlib.h>
#if defined(_WIN32) #if defined(_WIN32)
static inline void static inline void __declspec(noreturn)
#else #else
static inline void __attribute__((__noreturn__)) static inline void __attribute__((__noreturn__))
#endif #endif
......
...@@ -55,7 +55,7 @@ function get_gyp() ...@@ -55,7 +55,7 @@ function get_gyp()
function get_json() function get_json()
{ {
GIT_REPO="https://github.com/nlohmann/json.git" GIT_REPO="https://github.com/nlohmann/json.git"
GIT_TAG="v3.9.0" GIT_TAG="v3.9.1"
DEST="deps/json" DEST="deps/json"
get_dep "${GIT_REPO}" "${GIT_TAG}" "${DEST}" get_dep "${GIT_REPO}" "${GIT_TAG}" "${DEST}"
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论