mirror of
https://github.com/espressif/openthread.git
synced 2026-07-05 11:50:22 +00:00
Compare commits
61 Commits
v2026.06.0
...
v2026.07.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 593fc53fcf | |||
| c34311ff50 | |||
| ac689dd9a4 | |||
| 9b8d5b7471 | |||
| 7874555efb | |||
| 6e8570e233 | |||
| ff121bfce3 | |||
| 4394c0944b | |||
| 5f9fe671e9 | |||
| 879b54bc29 | |||
| 9cc2cb3e96 | |||
| 54323a2953 | |||
| da08ac73fd | |||
| 9c8374a44c | |||
| 0a6d0e793f | |||
| a411e563d6 | |||
| f833942769 | |||
| bf9d441ebd | |||
| 252918bf10 | |||
| b1d4150426 | |||
| fcf7b4cef5 | |||
| 11acd4a26e | |||
| 1f8d922465 | |||
| 5e68d008b5 | |||
| 0fbee98fd5 | |||
| a055c4b9b8 | |||
| 1b80561802 | |||
| a49c1f5c98 | |||
| c238bd9a62 | |||
| 8abf9667c3 | |||
| 87b971ef96 | |||
| 44f5382330 | |||
| 2d602dcd9c | |||
| baaf93a74f | |||
| 926dc828d2 | |||
| ec498f0c0e | |||
| 9403edeaaf | |||
| fee7292f15 | |||
| c801d291b3 | |||
| 9b180d4c09 | |||
| 260f44f2d3 | |||
| 709a1b00a3 | |||
| 21c983f0fb | |||
| 1316bcebc8 | |||
| 318b4b0771 | |||
| c4a85578f5 | |||
| b72d7144ee | |||
| b2093f4f9e | |||
| 15e1c233bf | |||
| 3d7b9fb686 | |||
| ab3c6600a0 | |||
| ecd4c92465 | |||
| b69c905763 | |||
| c410733490 | |||
| 1b238bffc0 | |||
| c01cad7ba2 | |||
| 7ad13c8adb | |||
| f6598900cf | |||
| 136bdb6e2a | |||
| 675162556b | |||
| 32b96a0d98 |
+13
-13
@@ -49,7 +49,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -73,14 +73,14 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Run linkspector
|
||||
uses: umbrelladocs/action-linkspector@963b6264d7de32c904942a70b488d3407453049e # v1.5.1
|
||||
uses: umbrelladocs/action-linkspector@6c637d70424624231467a4ca918be54fa3b792d0 # v1.5.4
|
||||
env:
|
||||
PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome
|
||||
with:
|
||||
@@ -92,7 +92,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
@@ -111,7 +111,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -151,7 +151,7 @@ jobs:
|
||||
CXX: ${{ matrix.compiler_cpp }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -170,7 +170,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -189,7 +189,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -246,7 +246,7 @@ jobs:
|
||||
gcc_extract_dir: arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -279,7 +279,7 @@ jobs:
|
||||
CXX: g++-${{ matrix.gcc_ver }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -312,7 +312,7 @@ jobs:
|
||||
CXX: clang++-${{ matrix.clang_ver }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -335,7 +335,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -366,7 +366,7 @@ jobs:
|
||||
CXX: ${{ matrix.CXX }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -89,12 +89,12 @@ jobs:
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
|
||||
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
|
||||
|
||||
- name: Build and push by digest
|
||||
if: success()
|
||||
id: build
|
||||
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
|
||||
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
|
||||
with:
|
||||
file: etc/docker/environment/Dockerfile
|
||||
platforms: ${{ matrix.platform }}
|
||||
@@ -125,7 +125,7 @@ jobs:
|
||||
- build
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -143,7 +143,7 @@ jobs:
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
|
||||
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -63,7 +63,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: block
|
||||
allowed-endpoints: >
|
||||
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
@@ -82,7 +82,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -118,7 +118,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -150,7 +150,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
@@ -180,7 +180,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
PR_BODY: "${{ github.event.pull_request.body }}"
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -73,7 +73,7 @@ jobs:
|
||||
rsync -r --exclude=.git --exclude=build --exclude=ot_testing "${OPENTHREAD_DIR}/." third_party/openthread/repo
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
|
||||
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
|
||||
|
||||
- name: Build DinD Runner Image
|
||||
run: |
|
||||
|
||||
@@ -168,7 +168,7 @@ jobs:
|
||||
script/test combine_coverage
|
||||
- name: Upload Coverage
|
||||
continue-on-error: true
|
||||
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
|
||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
with:
|
||||
|
||||
@@ -58,7 +58,7 @@ jobs:
|
||||
REAL_DEVICE: 0
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -80,7 +80,7 @@ jobs:
|
||||
PYTHONPATH=./tests/scripts/thread-cert pytype tools/otci
|
||||
- name: Build
|
||||
run: |
|
||||
./script/cmake-build simulation -DOT_THREAD_VERSION=1.4 -DOT_DUA=ON -DOT_MLR=ON -DOT_BACKBONE_ROUTER=ON \
|
||||
./script/cmake-build simulation -DOT_THREAD_VERSION=1.4 -DOT_MLR=ON -DOT_BACKBONE_ROUTER=ON \
|
||||
-DOT_CSL_RECEIVER=ON -DOT_SIMULATION_VIRTUAL_TIME=${VIRTUAL_TIME}
|
||||
- name: Install OTCI Python Library
|
||||
run: |
|
||||
|
||||
@@ -58,7 +58,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -164,7 +164,7 @@ jobs:
|
||||
STRESS_LEVEL: ${{ matrix.stress_level }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -214,7 +214,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
CXXFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -150,7 +150,7 @@ jobs:
|
||||
OT_READLINE: 'readline'
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -196,7 +196,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -226,7 +226,7 @@ jobs:
|
||||
OT_READLINE: 'off'
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -259,7 +259,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -295,7 +295,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -314,7 +314,7 @@ jobs:
|
||||
run: |
|
||||
script/test combine_coverage
|
||||
- name: Upload Coverage
|
||||
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
|
||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
with:
|
||||
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -103,7 +103,7 @@ jobs:
|
||||
COVERAGE: 1
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -136,7 +136,7 @@ jobs:
|
||||
OT_VT_USE_UNIX_SOCKET: 1
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -180,7 +180,7 @@ jobs:
|
||||
VIRTUAL_TIME: 0
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -231,7 +231,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -250,7 +250,7 @@ jobs:
|
||||
run: |
|
||||
script/test combine_coverage
|
||||
- name: Upload Coverage
|
||||
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
|
||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
with:
|
||||
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ jobs:
|
||||
TORANJ_EVENT_NAME: ${{ github.event_name }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -94,7 +94,7 @@ jobs:
|
||||
TORANJ_CLI: 1
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -131,7 +131,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -189,7 +189,7 @@ jobs:
|
||||
runs-on: macos-14
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -212,7 +212,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -231,7 +231,7 @@ jobs:
|
||||
run: |
|
||||
script/test combine_coverage
|
||||
- name: Upload Coverage
|
||||
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
|
||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
with:
|
||||
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -67,7 +67,7 @@ jobs:
|
||||
COVERAGE: 1
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -109,7 +109,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
@@ -128,7 +128,7 @@ jobs:
|
||||
run: |
|
||||
script/test combine_coverage
|
||||
- name: Upload Coverage
|
||||
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
|
||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
with:
|
||||
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
||||
|
||||
|
||||
@@ -215,6 +215,7 @@
|
||||
* @defgroup plat-radio Radio
|
||||
* @defgroup plat-settings Settings
|
||||
* @defgroup plat-spi-slave SPI Slave
|
||||
* @defgroup plat-tcp TCP - Platform
|
||||
* @defgroup plat-time Time Service
|
||||
* @defgroup plat-toolchain Toolchain
|
||||
* @defgroup plat-trel TREL - Platform
|
||||
|
||||
@@ -210,7 +210,6 @@ ot_option(OT_DNS_DSO OPENTHREAD_CONFIG_DNS_DSO_ENABLE "DNS Stateful Operations (
|
||||
ot_option(OT_DNS_UPSTREAM_QUERY OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE "Allow sending DNS queries to upstream")
|
||||
ot_option(OT_DNSSD_DISCOVERY_PROXY OPENTHREAD_CONFIG_DNSSD_DISCOVERY_PROXY_ENABLE "DNS-SD discovery proxy")
|
||||
ot_option(OT_DNSSD_SERVER OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE "DNS-SD server")
|
||||
ot_option(OT_DUA OPENTHREAD_CONFIG_DUA_ENABLE "Domain Unicast Address (DUA)")
|
||||
ot_option(OT_DYNAMIC_STORE_FRAME_AHEAD_COUNTER OPENTHREAD_CONFIG_DYNAMIC_STORE_FRAME_AHEAD_COUNTER_ENABLE "dynamic store frame ahead counter")
|
||||
ot_option(OT_ECDSA OPENTHREAD_CONFIG_ECDSA_ENABLE "ECDSA")
|
||||
ot_option(OT_EXTERNAL_HEAP OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE "external heap")
|
||||
@@ -251,6 +250,7 @@ ot_option(OT_PLATFORM_KEY_REF OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE "
|
||||
ot_option(OT_PLATFORM_LOG_CRASH_DUMP OPENTHREAD_CONFIG_PLATFORM_LOG_CRASH_DUMP_ENABLE "platform log crash dump")
|
||||
ot_option(OT_PLATFORM_NETIF OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE "platform netif")
|
||||
ot_option(OT_PLATFORM_POWER_CALIBRATION OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE "power calibration")
|
||||
ot_option(OT_PLATFORM_TCP OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE "Platform TCP")
|
||||
ot_option(OT_PLATFORM_UDP OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE "platform UDP")
|
||||
ot_option(OT_REFERENCE_DEVICE OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE "test harness reference device")
|
||||
ot_option(OT_SEEKER OPENTHREAD_CONFIG_SEEKER_ENABLE "seeker")
|
||||
|
||||
@@ -138,9 +138,6 @@ if (openthread_enable_core_config_args) {
|
||||
# Enable ECDSA support
|
||||
openthread_config_ecdsa_enable = false
|
||||
|
||||
# Enable Domain Unicast Address feature for Thread 1.2
|
||||
openthread_config_dua_enable = false
|
||||
|
||||
# Enable Multicast Listener Registration feature for Thread 1.2
|
||||
openthread_config_mlr_enable = false
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1
|
||||
#define OPENTHREAD_CONFIG_DNS_DSO_ENABLE 1
|
||||
#define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 1
|
||||
#define OPENTHREAD_CONFIG_DUA_ENABLE 1
|
||||
#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
|
||||
#define OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE 1
|
||||
#define OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE 1
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1
|
||||
#define OPENTHREAD_CONFIG_DNS_DSO_ENABLE 0
|
||||
#define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 0
|
||||
#define OPENTHREAD_CONFIG_DUA_ENABLE 1
|
||||
#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
|
||||
#define OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE 0
|
||||
#define OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE 0
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1
|
||||
#define OPENTHREAD_CONFIG_DNS_DSO_ENABLE 0
|
||||
#define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 0
|
||||
#define OPENTHREAD_CONFIG_DUA_ENABLE 1
|
||||
#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
|
||||
#define OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE 0
|
||||
#define OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE 0
|
||||
|
||||
@@ -90,6 +90,7 @@ add_library(openthread-simulation
|
||||
simul_utils.c
|
||||
spi-stubs.c
|
||||
system.c
|
||||
tcp.c
|
||||
trel.c
|
||||
uart.c
|
||||
virtual_time/alarm-sim.c
|
||||
|
||||
@@ -28,12 +28,15 @@
|
||||
|
||||
#include "platform-simulation.h"
|
||||
|
||||
#if OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <openthread/error.h>
|
||||
#include <openthread/logging.h>
|
||||
#include <openthread/tcat.h>
|
||||
#include <openthread/platform/ble.h>
|
||||
|
||||
@@ -43,7 +46,10 @@
|
||||
#define PLAT_BLE_MSG_DATA_MAX 2048
|
||||
static uint8_t sBleBuffer[PLAT_BLE_MSG_DATA_MAX];
|
||||
|
||||
static int sFd = -1;
|
||||
static int sFd = -1;
|
||||
static bool sIsConnected = false;
|
||||
static bool sIsDisconnecting = false;
|
||||
static bool sIsEnabled = false;
|
||||
|
||||
static const uint16_t kPortBase = 10000;
|
||||
static uint16_t sPort = 0;
|
||||
@@ -103,33 +109,59 @@ otError otPlatBleGetAdvertisementBuffer(otInstance *aInstance, uint8_t **aAdvert
|
||||
otError otPlatBleEnable(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
initFds();
|
||||
if (!sIsEnabled)
|
||||
{
|
||||
initFds();
|
||||
sIsEnabled = true;
|
||||
sIsConnected = false;
|
||||
sIsDisconnecting = false;
|
||||
}
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatBleDisable(otInstance *aInstance)
|
||||
{
|
||||
deinitFds();
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
if (sIsEnabled)
|
||||
{
|
||||
deinitFds();
|
||||
sIsEnabled = false;
|
||||
}
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aInterval);
|
||||
if (sIsConnected || !sIsEnabled)
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
}
|
||||
otLogDebgPlat("BLE adv start (interval %u)", aInterval);
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatBleGapAdvStop(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
if (!sIsEnabled)
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
}
|
||||
otLogDebgPlat("BLE adv stop");
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatBleGapDisconnect(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
if (!sIsConnected)
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
}
|
||||
// Only flag the disconnection here. The 'disconnected' event is delivered asynchronously
|
||||
// by platformBleProcess() (via otPlatBleGapOnDisconnected), per API contract.
|
||||
sIsDisconnecting = true;
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
@@ -164,7 +196,6 @@ void platformBleDeinit(void) { deinitFds(); }
|
||||
|
||||
void platformBleUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, struct timeval *aTimeout, int *aMaxFd)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aTimeout);
|
||||
OT_UNUSED_VARIABLE(aWriteFdSet);
|
||||
|
||||
if (aReadFdSet != NULL && sFd != -1)
|
||||
@@ -176,6 +207,13 @@ void platformBleUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, struct time
|
||||
*aMaxFd = sFd;
|
||||
}
|
||||
}
|
||||
|
||||
// A pending disconnection must be delivered promptly; ensure the main loop does not block.
|
||||
if (sIsDisconnecting && aTimeout != NULL)
|
||||
{
|
||||
aTimeout->tv_sec = 0;
|
||||
aTimeout->tv_usec = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void platformBleProcess(otInstance *aInstance, const fd_set *aReadFdSet, const fd_set *aWriteFdSet)
|
||||
@@ -184,6 +222,14 @@ void platformBleProcess(otInstance *aInstance, const fd_set *aReadFdSet, const f
|
||||
|
||||
otEXPECT(sFd != -1);
|
||||
|
||||
// Deliver a pending disconnection (requested earlier via otPlatBleGapDisconnect)
|
||||
if (sIsDisconnecting)
|
||||
{
|
||||
sIsConnected = false;
|
||||
otPlatBleGapOnDisconnected(aInstance, 0);
|
||||
sIsDisconnecting = false;
|
||||
}
|
||||
|
||||
if (FD_ISSET(sFd, aReadFdSet))
|
||||
{
|
||||
socklen_t len = sizeof(sSockaddr);
|
||||
@@ -193,6 +239,14 @@ void platformBleProcess(otInstance *aInstance, const fd_set *aReadFdSet, const f
|
||||
if (rval > 0)
|
||||
{
|
||||
otBleRadioPacket myPacket;
|
||||
|
||||
if (!sIsConnected)
|
||||
{
|
||||
sIsConnected = true;
|
||||
otLogDebgPlat("BLE client connected");
|
||||
otPlatBleGapOnConnected(aInstance, 0);
|
||||
}
|
||||
|
||||
myPacket.mValue = sBleBuffer;
|
||||
myPacket.mLength = (uint16_t)rval;
|
||||
myPacket.mPower = 0;
|
||||
@@ -211,10 +265,27 @@ void platformBleProcess(otInstance *aInstance, const fd_set *aReadFdSet, const f
|
||||
DieNow(OT_EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
/* Weak stubs for callbacks defined in the FTD/MTD core library, not available for RCP targets. */
|
||||
|
||||
OT_TOOL_WEAK void otPlatBleGapOnConnected(otInstance *aInstance, uint16_t aConnectionId)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aConnectionId);
|
||||
assert(false);
|
||||
}
|
||||
|
||||
OT_TOOL_WEAK void otPlatBleGapOnDisconnected(otInstance *aInstance, uint16_t aConnectionId)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aConnectionId);
|
||||
assert(false);
|
||||
}
|
||||
|
||||
OT_TOOL_WEAK void otPlatBleGattServerOnWriteRequest(otInstance *aInstance,
|
||||
uint16_t aHandle,
|
||||
const otBleRadioPacket *aPacket)
|
||||
@@ -223,9 +294,6 @@ OT_TOOL_WEAK void otPlatBleGattServerOnWriteRequest(otInstance *aIns
|
||||
OT_UNUSED_VARIABLE(aHandle);
|
||||
OT_UNUSED_VARIABLE(aPacket);
|
||||
assert(false);
|
||||
/* In case of rcp there is a problem with linking to otPlatBleGattServerOnWriteRequest
|
||||
* which is available in FTD/MTD library.
|
||||
*/
|
||||
}
|
||||
|
||||
void otPlatBleGetLinkCapabilities(otInstance *aInstance, otBleLinkCapabilities *aBleLinkCapabilities)
|
||||
@@ -241,6 +309,10 @@ otError otPlatBleGapAdvSetData(otInstance *aInstance, uint8_t *aAdvertisementDat
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aAdvertisementData);
|
||||
OT_UNUSED_VARIABLE(aAdvertisementLen);
|
||||
if (!sIsEnabled)
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
}
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
@@ -249,11 +321,17 @@ otError otPlatBleGapAdvUpdateData(otInstance *aInstance, uint8_t *aAdvertisement
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aAdvertisementData);
|
||||
OT_UNUSED_VARIABLE(aAdvertisementLen);
|
||||
if (!sIsEnabled)
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
}
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
bool otPlatBleSupportsMultiRadio(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
|
||||
|
||||
@@ -645,7 +645,6 @@ void radioSendMessage(otInstance *aInstance)
|
||||
{
|
||||
uint64_t sfdTxTime = otPlatTimeGet();
|
||||
|
||||
sRadioContext.mCslPresent = sTransmitFrame.mInfo.mTxInfo.mCslPresent;
|
||||
otEXPECT(otMacFrameProcessTxSfd(&sTransmitFrame, sfdTxTime, &sRadioContext) == OT_ERROR_NONE);
|
||||
}
|
||||
|
||||
@@ -1061,10 +1060,7 @@ static uint8_t generateAckIeData(uint8_t *aLinkMetricsIeData,
|
||||
uint8_t offset = 0;
|
||||
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
|
||||
sRadioContext.mCslPresent =
|
||||
(sRadioContext.mCslPeriod > 0) && otMacFrameSrcAddrMatchCslReceiverPeer(aReceivedFrame, &sRadioContext);
|
||||
|
||||
if (sRadioContext.mCslPresent)
|
||||
if ((sRadioContext.mCslPeriod > 0) && otMacFrameSrcAddrMatchCslReceiverPeer(aReceivedFrame, &sRadioContext))
|
||||
{
|
||||
offset += otMacFrameGenerateCslIeTemplate(sAckIeData);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2026, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "platform-simulation.h"
|
||||
|
||||
#include <openthread/platform/tcp.h>
|
||||
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE
|
||||
|
||||
otError otPlatTcpEnableListener(otPlatTcpListener *aListener, const otPlatTcpSockAddr *aLocalSockAddr)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aListener);
|
||||
OT_UNUSED_VARIABLE(aLocalSockAddr);
|
||||
|
||||
return OT_ERROR_FAILED;
|
||||
}
|
||||
|
||||
void otPlatTcpDisableListener(otPlatTcpListener *aListener) { OT_UNUSED_VARIABLE(aListener); }
|
||||
|
||||
otError otPlatTcpConnect(otPlatTcpConnection *aConn,
|
||||
const otPlatTcpSockAddr *aPeerSockAddr,
|
||||
const otPlatTcpSockAddr *aLocalSockAddr)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aConn);
|
||||
OT_UNUSED_VARIABLE(aPeerSockAddr);
|
||||
OT_UNUSED_VARIABLE(aLocalSockAddr);
|
||||
|
||||
return OT_ERROR_FAILED;
|
||||
}
|
||||
|
||||
void otPlatTcpNotifyTxPending(otPlatTcpConnection *aConn) { OT_UNUSED_VARIABLE(aConn); }
|
||||
|
||||
uint16_t otPlatTcpSend(otPlatTcpConnection *aConn, const uint8_t *aBuffer, uint16_t aLength)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aConn);
|
||||
OT_UNUSED_VARIABLE(aBuffer);
|
||||
OT_UNUSED_VARIABLE(aLength);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void otPlatTcpClose(otPlatTcpConnection *aConn) { OT_UNUSED_VARIABLE(aConn); }
|
||||
|
||||
void otPlatTcpAbort(otPlatTcpConnection *aConn) { OT_UNUSED_VARIABLE(aConn); }
|
||||
|
||||
#endif // #if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE
|
||||
@@ -205,7 +205,7 @@ otError otMacFrameGenerateEnhAck(const otRadioFrame *aFrame,
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
|
||||
void otMacFrameSetCslIe(otRadioFrame *aFrame, uint16_t aCslPeriod, uint16_t aCslPhase)
|
||||
{
|
||||
static_cast<Mac::Frame *>(aFrame)->SetCslIe(aCslPeriod, aCslPhase);
|
||||
static_cast<Mac::Frame *>(aFrame)->UpdateCslIe(aCslPeriod, aCslPhase);
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
|
||||
|
||||
@@ -264,44 +264,37 @@ uint8_t otMacFrameGenerateCslIeTemplate(uint8_t *aDest)
|
||||
{
|
||||
assert(aDest != nullptr);
|
||||
|
||||
reinterpret_cast<Mac::HeaderIe *>(aDest)->SetId(Mac::CslIe::kHeaderIeId);
|
||||
reinterpret_cast<Mac::HeaderIe *>(aDest)->SetLength(sizeof(Mac::CslIe));
|
||||
reinterpret_cast<Mac::CslIe *>(aDest)->Init();
|
||||
|
||||
return sizeof(Mac::HeaderIe) + sizeof(Mac::CslIe);
|
||||
return sizeof(Mac::CslIe);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
|
||||
uint8_t otMacFrameGenerateEnhAckProbingIe(uint8_t *aDest, const uint8_t *aIeData, uint8_t aIeDataLength)
|
||||
{
|
||||
uint8_t len = sizeof(Mac::VendorIeHeader) + aIeDataLength;
|
||||
Mac::LinkMetricsProbingIe *probingIe = reinterpret_cast<Mac::LinkMetricsProbingIe *>(aDest);
|
||||
|
||||
assert(aDest != nullptr);
|
||||
|
||||
reinterpret_cast<Mac::HeaderIe *>(aDest)->SetId(Mac::ThreadIe::kHeaderIeId);
|
||||
reinterpret_cast<Mac::HeaderIe *>(aDest)->SetLength(len);
|
||||
|
||||
aDest += sizeof(Mac::HeaderIe);
|
||||
|
||||
reinterpret_cast<Mac::VendorIeHeader *>(aDest)->SetVendorOui(Mac::ThreadIe::kVendorOuiThreadCompanyId);
|
||||
reinterpret_cast<Mac::VendorIeHeader *>(aDest)->SetSubType(Mac::ThreadIe::kEnhAckProbingIe);
|
||||
probingIe->Init(aIeDataLength);
|
||||
|
||||
if (aIeData != nullptr)
|
||||
{
|
||||
aDest += sizeof(Mac::VendorIeHeader);
|
||||
memcpy(aDest, aIeData, aIeDataLength);
|
||||
probingIe->WriteMetricsDataFrom(aIeData);
|
||||
}
|
||||
|
||||
return sizeof(Mac::HeaderIe) + len;
|
||||
return probingIe->GetSize();
|
||||
}
|
||||
|
||||
void otMacFrameSetEnhAckProbingIe(otRadioFrame *aFrame, const uint8_t *aData, uint8_t aDataLen)
|
||||
{
|
||||
assert(aFrame != nullptr && aData != nullptr);
|
||||
|
||||
reinterpret_cast<Mac::Frame *>(aFrame)->SetEnhAckProbingIe(aData, aDataLen);
|
||||
reinterpret_cast<Mac::Frame *>(aFrame)->UpdateEnhAckProbingIe(aData, aDataLen);
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
|
||||
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
|
||||
static uint16_t ComputeCslPhase(uint32_t aRadioTime, otRadioContext *aRadioContext)
|
||||
{
|
||||
@@ -411,7 +404,7 @@ otError otMacFrameProcessTxSfd(otRadioFrame *aFrame, uint64_t aRadioTime, otRadi
|
||||
VerifyOrExit(!otMacFrameIsSecurityEnabled(aFrame) || !aFrame->mInfo.mTxInfo.mIsSecurityProcessed);
|
||||
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
|
||||
if (aRadioContext->mCslPresent) // CSL IE should be filled for every transmit attempt
|
||||
if (static_cast<Mac::Frame *>(aFrame)->Has<Mac::CslIe>()) // CSL IE should be filled for every transmit attempt
|
||||
{
|
||||
otMacFrameSetCslIe(aFrame, aRadioContext->mCslPeriod, ComputeCslPhase(aRadioTime, aRadioContext));
|
||||
}
|
||||
|
||||
@@ -349,7 +349,6 @@ typedef struct otRadioContext
|
||||
uint16_t mCslPeriod; ///< In unit of 10 symbols.
|
||||
otShortAddress mCslShortAddress; ///< The short address of the CSL receiver's peer.
|
||||
otExtAddress mCslExtAddress; ///< The extended address of the CSL receiver's peer.
|
||||
bool mCslPresent : 1; ///< Indicates whether the CSL header IE is present.
|
||||
otShortAddress mShortAddress;
|
||||
otShortAddress mAlternateShortAddress;
|
||||
otRadioKeyType mKeyType;
|
||||
|
||||
@@ -112,6 +112,7 @@ source_set("openthread") {
|
||||
"platform/radio.h",
|
||||
"platform/settings.h",
|
||||
"platform/spi-slave.h",
|
||||
"platform/tcp.h",
|
||||
"platform/time.h",
|
||||
"platform/toolchain.h",
|
||||
"platform/trel.h",
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include <openthread/error.h>
|
||||
#include <openthread/instance.h>
|
||||
#include <openthread/ip6.h>
|
||||
#include <openthread/netdata.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -175,17 +174,6 @@ uint8_t otBackboneRouterGetRegistrationJitter(otInstance *aInstance);
|
||||
*/
|
||||
void otBackboneRouterSetRegistrationJitter(otInstance *aInstance, uint8_t aJitter);
|
||||
|
||||
/**
|
||||
* Gets the local Domain Prefix configuration.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aConfig A pointer to the Domain Prefix configuration.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully got the Domain Prefix configuration.
|
||||
* @retval OT_ERROR_NOT_FOUND No Domain Prefix was configured.
|
||||
*/
|
||||
otError otBackboneRouterGetDomainPrefix(otInstance *aInstance, otBorderRouterConfig *aConfig);
|
||||
|
||||
/**
|
||||
* Configures the response status for the next Multicast Listener Registration.
|
||||
*
|
||||
@@ -300,37 +288,6 @@ otError otBackboneRouterMulticastListenerGetNext(otInstance
|
||||
otBackboneRouterMulticastListenerIterator *aIterator,
|
||||
otBackboneRouterMulticastListenerInfo *aListenerInfo);
|
||||
|
||||
/**
|
||||
* Represents the Domain Prefix events.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
OT_BACKBONE_ROUTER_DOMAIN_PREFIX_ADDED = 0, ///< Domain Prefix was added.
|
||||
OT_BACKBONE_ROUTER_DOMAIN_PREFIX_REMOVED = 1, ///< Domain Prefix was removed.
|
||||
OT_BACKBONE_ROUTER_DOMAIN_PREFIX_CHANGED = 2, ///< Domain Prefix was changed.
|
||||
} otBackboneRouterDomainPrefixEvent;
|
||||
|
||||
/**
|
||||
* Pointer is called whenever the Domain Prefix changed.
|
||||
*
|
||||
* @param[in] aContext The user context pointer.
|
||||
* @param[in] aEvent The Domain Prefix event.
|
||||
* @param[in] aDomainPrefix The new Domain Prefix if added or changed, NULL otherwise.
|
||||
*/
|
||||
typedef void (*otBackboneRouterDomainPrefixCallback)(void *aContext,
|
||||
otBackboneRouterDomainPrefixEvent aEvent,
|
||||
const otIp6Prefix *aDomainPrefix);
|
||||
/**
|
||||
* Sets the Backbone Router Domain Prefix callback.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aCallback A pointer to the Domain Prefix callback.
|
||||
* @param[in] aContext A user context pointer.
|
||||
*/
|
||||
void otBackboneRouterSetDomainPrefixCallback(otInstance *aInstance,
|
||||
otBackboneRouterDomainPrefixCallback aCallback,
|
||||
void *aContext);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <openthread/dataset.h>
|
||||
#include <openthread/error.h>
|
||||
#include <openthread/ip6.h>
|
||||
#include <openthread/netdiag.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -61,7 +62,6 @@ extern "C" {
|
||||
#define OT_BORDER_AGENT_THREAD_VERSION_SIZE (16) ///< Max size of Thread Version string in `otBorderAgentTxtDataInfo`.
|
||||
#define OT_BORDER_AGENT_VENDOR_NAME_SIZE (32) ///< Max size of Vendor Name string in `otBorderAgentTxtDataInfo`.
|
||||
#define OT_BORDER_AGENT_MODEL_NAME_SIZE (32) ///< Max size of Model Name string in `otBorderAgentTxtDataInfo`.
|
||||
#define OT_BORDER_AGENT_VENDOR_OUI_SIZE (3) ///< Size of Vendor OUI (in bytes) in `otBorderAgentTxtDataInfo`.
|
||||
|
||||
/**
|
||||
* Represents the Connection Mode in a Border Agent State Bitmap.
|
||||
@@ -169,7 +169,7 @@ typedef struct otBorderAgentTxtDataInfo
|
||||
otExtAddress mExtAddress; ///< Extended Address.
|
||||
char mVendorName[OT_BORDER_AGENT_VENDOR_NAME_SIZE]; ///< Vendor Name string.
|
||||
char mModelName[OT_BORDER_AGENT_MODEL_NAME_SIZE]; ///< Model Name string.
|
||||
uint8_t mVendorOui[OT_BORDER_AGENT_VENDOR_OUI_SIZE]; ///< Vendor OUI (24-bit).
|
||||
otThreadVendorOui mVendorOui; ///< Vendor OUI.
|
||||
} otBorderAgentTxtDataInfo;
|
||||
|
||||
/**
|
||||
|
||||
@@ -603,7 +603,6 @@ otError otBorderRoutingGetNextRouterEntry(otInstance *aI
|
||||
*
|
||||
* - It has added at least one external route entry.
|
||||
* - It has added at least one prefix entry with both the default-route and on-mesh flags set.
|
||||
* - It has added at least one domain prefix (with both the domain and on-mesh flags set).
|
||||
*
|
||||
* The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
|
||||
*
|
||||
@@ -629,7 +628,6 @@ otError otBorderRoutingGetNextPeerBrEntry(otInstance *
|
||||
*
|
||||
* - It has added at least one external route entry.
|
||||
* - It has added at least one prefix entry with both the default-route and on-mesh flags set.
|
||||
* - It has added at least one domain prefix (with both the domain and on-mesh flags set).
|
||||
*
|
||||
* The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
|
||||
*
|
||||
|
||||
@@ -52,7 +52,7 @@ extern "C" {
|
||||
*
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (601)
|
||||
#define OPENTHREAD_API_VERSION (609)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <openthread/error.h>
|
||||
#include <openthread/instance.h>
|
||||
#include <openthread/ip6.h>
|
||||
#include <openthread/netdiag.h>
|
||||
#include <openthread/thread.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
@@ -62,11 +63,15 @@ extern "C" {
|
||||
/**
|
||||
* Represents the set of configurations used when discovering mesh topology indicating which items to
|
||||
* discover.
|
||||
*
|
||||
* The `mExtraTlvTypes` pointer can be NULL if `mExtraTlvTypesLength` is zero.
|
||||
*/
|
||||
typedef struct otMeshDiagDiscoverConfig
|
||||
{
|
||||
bool mDiscoverIp6Addresses : 1; ///< Whether or not to discover IPv6 addresses of every router.
|
||||
bool mDiscoverChildTable : 1; ///< Whether or not to discover children of every router.
|
||||
bool mDiscoverIp6Addresses : 1; ///< Whether or not to discover IPv6 addresses of every router.
|
||||
bool mDiscoverChildTable : 1; ///< Whether or not to discover children of every router.
|
||||
const uint8_t *mExtraTlvTypes; ///< An array of extra Net Diag TLV types to request from every router.
|
||||
uint8_t mExtraTlvTypesLength; ///< The length of the `mExtraTlvTypes` array. Can be zero.
|
||||
} otMeshDiagDiscoverConfig;
|
||||
|
||||
/**
|
||||
@@ -83,6 +88,18 @@ typedef struct otMeshDiagIp6AddrIterator otMeshDiagIp6AddrIterator;
|
||||
*/
|
||||
typedef struct otMeshDiagChildIterator otMeshDiagChildIterator;
|
||||
|
||||
/**
|
||||
* An opaque iterator to iterate over the list of extra Network Diagnostic TLVs returned by a router.
|
||||
*
|
||||
* Pointers to instances of this type are provided in `otMeshDiagRouterInfo`.
|
||||
*/
|
||||
typedef struct otMeshDiagTlvIterator otMeshDiagTlvIterator;
|
||||
|
||||
/**
|
||||
* Represents information about a parsed Network Diagnostic TLV.
|
||||
*/
|
||||
typedef otNetworkDiagTlv otMeshDiagTlvInfo;
|
||||
|
||||
/**
|
||||
* Specifies that Thread Version is unknown.
|
||||
*
|
||||
@@ -136,6 +153,16 @@ typedef struct otMeshDiagRouterInfo
|
||||
* if the router did not provide the list.
|
||||
*/
|
||||
otMeshDiagChildIterator *mChildIterator;
|
||||
|
||||
/**
|
||||
* A pointer to an iterator to go through the list of extra Network Diagnostic TLVs returned by the router.
|
||||
*
|
||||
* The pointer is valid only while `otMeshDiagRouterInfo` is valid. It can be used in `otMeshDiagGetNextTlvInfo`
|
||||
* to iterate through the extra TLVs returned by the router.
|
||||
*
|
||||
* The pointer may be NULL if there are no extra TLVs (in `otMeshDiagDiscoverConfig`).
|
||||
*/
|
||||
otMeshDiagTlvIterator *mTlvIterator;
|
||||
} otMeshDiagRouterInfo;
|
||||
|
||||
/**
|
||||
@@ -168,6 +195,39 @@ typedef void (*otMeshDiagDiscoverCallback)(otError aError, otMeshDiagRouterInfo
|
||||
/**
|
||||
* Starts network topology discovery.
|
||||
*
|
||||
* This function initiates a query to discover routers in the Thread network.
|
||||
*
|
||||
* The @p aConfig configuration controls what optional topology information is discovered:
|
||||
* - If `mDiscoverIp6Addresses` is set to true, the list of IPv6 addresses for each router is discovered.
|
||||
* - If `mDiscoverChildTable` is set to true, the list of children for each router is discovered.
|
||||
*
|
||||
* The @p aConfig parameter can be used to request additional standard Network Diagnostic TLVs to be retrieved from
|
||||
* each discovered router during topology discovery. These extra TLVs can then be accessed via the `mTlvIterator` in
|
||||
* the callback's router info.
|
||||
*
|
||||
* The following restrictions and recommendations apply to the use of `mExtraTlvTypes`:
|
||||
* - It MUST NOT contain any of the TLV types that are already requested by the discovery process itself.
|
||||
* These are:
|
||||
* - `OT_NETWORK_DIAGNOSTIC_TLV_SHORT_ADDRESS`
|
||||
* - `OT_NETWORK_DIAGNOSTIC_TLV_EXT_ADDRESS`
|
||||
* - `OT_NETWORK_DIAGNOSTIC_TLV_ROUTE`
|
||||
* - `OT_NETWORK_DIAGNOSTIC_TLV_VERSION`
|
||||
* - `OT_NETWORK_DIAGNOSTIC_TLV_IP6_ADDR_LIST`
|
||||
* - `OT_NETWORK_DIAGNOSTIC_TLV_CHILD_TABLE`
|
||||
* If any of these types are included in @p aConfig.mExtraTlvTypes, `OT_ERROR_INVALID_ARGS` is returned.
|
||||
* - The total number of requested TLV types is limited to 32. This limit applies to all TLV types combined, including
|
||||
* those automatically added by the discovery process and any additional TLVs specified by the caller in
|
||||
* `mExtraTlvTypes`. If the total count exceeds this limit, `OT_ERROR_NO_BUFS` is returned.
|
||||
* - It is highly recommended to keep the number of additional TLVs small. Requesting many or large TLVs increases the
|
||||
* size of the Network Diagnostics responses, which can cause message fragmentation, higher network traffic, or
|
||||
* response packet drops.
|
||||
* - Additional TLVs should be restricted to small metadata elements useful during topology discovery (for example,
|
||||
* `OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_NAME`, `OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_MODEL`, etc).
|
||||
* For retrieving larger information (like counters, etc.), separate individual queries should be sent to specific
|
||||
* nodes instead of using this method.
|
||||
* - The @p aConfig struct and the memory pointed to by its @p mExtraTlvTypes array do not need to persist beyond
|
||||
* the call to this function.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance.
|
||||
* @param[in] aConfig The configuration to use for discovery (e.g., which items to discover).
|
||||
* @param[in] aCallback The callback to report the discovered routers.
|
||||
@@ -176,7 +236,8 @@ typedef void (*otMeshDiagDiscoverCallback)(otError aError, otMeshDiagRouterInfo
|
||||
* @retval OT_ERROR_NONE The network topology discovery started successfully.
|
||||
* @retval OT_ERROR_BUSY A previous discovery request is still ongoing.
|
||||
* @retval OT_ERROR_INVALID_STATE Device is not attached.
|
||||
* @retval OT_ERROR_NO_BUFS Could not allocate buffer to send discovery messages.
|
||||
* @retval OT_ERROR_NO_BUFS Could not allocate buffer to send discovery messages or too many extra TLVs.
|
||||
* @retval OT_ERROR_INVALID_ARGS Invalid @p aConfig (e.g., includes restricted extra TLVs as listed above).
|
||||
*/
|
||||
otError otMeshDiagDiscoverTopology(otInstance *aInstance,
|
||||
const otMeshDiagDiscoverConfig *aConfig,
|
||||
@@ -220,6 +281,20 @@ otError otMeshDiagGetNextIp6Address(otMeshDiagIp6AddrIterator *aIterator, otIp6A
|
||||
*/
|
||||
otError otMeshDiagGetNextChildInfo(otMeshDiagChildIterator *aIterator, otMeshDiagChildInfo *aChildInfo);
|
||||
|
||||
/**
|
||||
* Iterates through the discovered extra Network Diagnostic TLVs of a router.
|
||||
*
|
||||
* This function MUST be used from the callback `otMeshDiagDiscoverCallback()` and use the `mTlvIterator` from the
|
||||
* `aRouterInfo` struct that is provided as input to the callback.
|
||||
*
|
||||
* @param[in,out] aIterator The TLV iterator to use.
|
||||
* @param[out] aTlvInfo A pointer to return the extra TLV info (if any).
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully retrieved the next extra TLV. @p aTlvInfo and @p aIterator are updated.
|
||||
* @retval OT_ERROR_NOT_FOUND No more extra TLVs. Reached the end of the list.
|
||||
*/
|
||||
otError otMeshDiagGetNextTlvInfo(otMeshDiagTlvIterator *aIterator, otMeshDiagTlvInfo *aTlvInfo);
|
||||
|
||||
/**
|
||||
* Represents information about a child entry from `otMeshDiagQueryChildTable()`.
|
||||
*
|
||||
|
||||
@@ -73,7 +73,7 @@ typedef struct otBorderRouterConfig
|
||||
bool mOnMesh : 1; ///< Whether this prefix is considered on-mesh.
|
||||
bool mStable : 1; ///< Whether this configuration is considered Stable Network Data.
|
||||
bool mNdDns : 1; ///< Whether this border router can supply DNS information via ND.
|
||||
bool mDp : 1; ///< Whether prefix is a Thread Domain Prefix (added since Thread 1.2).
|
||||
bool mDp : 1; ///< Reserved (previously Thread Domain Prefix flag).
|
||||
uint16_t mRloc16; ///< The border router's RLOC16 (value ignored on config add).
|
||||
} otBorderRouterConfig;
|
||||
|
||||
|
||||
+109
-18
@@ -94,6 +94,7 @@ extern "C" {
|
||||
#define OT_NETWORK_DIAGNOSTIC_TLV_BR_DHCP6_PD_OMR_PREFIX 41 ///< Border Router DHCPv6-PD OMR Prefix TLV
|
||||
#define OT_NETWORK_DIAGNOSTIC_TLV_BR_LOCAL_OL_PREFIX 42 ///< Border Router Local On-link Prefix TLV
|
||||
#define OT_NETWORK_DIAGNOSTIC_TLV_BR_FAVORED_OL_PREFIX 43 ///< Border Router Favored On-link Prefix TLV
|
||||
#define OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_OUI 44 ///< Vendor OUI TLV
|
||||
|
||||
#define OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_NAME_TLV_LENGTH 32 ///< Max length of Vendor Name TLV.
|
||||
#define OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_MODEL_TLV_LENGTH 32 ///< Max length of Vendor Model TLV.
|
||||
@@ -273,6 +274,50 @@ typedef struct otNetworkDiagChildTable
|
||||
*/
|
||||
typedef otBorderRoutingState otNetworkDiagBrState;
|
||||
|
||||
/**
|
||||
* Specifies the maximum size of a Thread Vendor OUI in bytes.
|
||||
*/
|
||||
#define OT_THREAD_VENDOR_OUI_MAX_SIZE 5
|
||||
|
||||
/**
|
||||
* Specifies the bit length of a MAC Address Block Large (MA-L) Vendor OUI.
|
||||
*/
|
||||
#define OT_THREAD_VENDOR_OUI_MA_L_BIT_LENGTH 24
|
||||
|
||||
/**
|
||||
* Specifies the bit length of a MAC Address Block Medium (MA-M) Vendor OUI.
|
||||
*/
|
||||
#define OT_THREAD_VENDOR_OUI_MA_M_BIT_LENGTH 28
|
||||
|
||||
/**
|
||||
* Specifies the bit length of a MAC Address Block Small (MA-S) Vendor OUI.
|
||||
*/
|
||||
#define OT_THREAD_VENDOR_OUI_MA_S_BIT_LENGTH 36
|
||||
|
||||
/**
|
||||
* Represents a Thread Vendor OUI (Organizationally Unique Identifier) which can have different lengths.
|
||||
*
|
||||
* A Vendor OUI can be assigned in one of the following formats:
|
||||
*
|
||||
* - 24-bit Prefix (MA-L): Exactly 3 bytes (24 bits).
|
||||
* Example: `00-1A-2B` is represented with `mBitLength = 24` and `mBytes = [0x00, 0x1A, 0x2B, 0x00, 0x00]`.
|
||||
*
|
||||
* - 28-bit Prefix (MA-M): Exactly 3.5 bytes (28 bits).
|
||||
* The half-byte (4 bits) at the end of the prefix occupies the Most Significant Nibble of the 4th byte.
|
||||
* The Least Significant Nibble of the 4th byte is set to zero.
|
||||
* Example: `00-1A-2B-3` is represented with `mBitLength = 28` and `mBytes = [0x00, 0x1A, 0x2B, 0x30, 0x00]`.
|
||||
*
|
||||
* - 36-bit Prefix (MA-S): Exactly 4.5 bytes (36 bits).
|
||||
* The half-byte (4 bits) at the end of the prefix occupies the Most Significant Nibble of the 5th byte.
|
||||
* The Least Significant Nibble of the 5th byte is set to zero.
|
||||
* Example: `00-1A-2B-3C-4` is represented with `mBitLength = 36` and `mBytes = [0x00, 0x1A, 0x2B, 0x3C, 0x40]`.
|
||||
*/
|
||||
typedef struct otThreadVendorOui
|
||||
{
|
||||
uint8_t mBitLength; ///< The OUI prefix length in bits (24, 28, or 36).
|
||||
uint8_t mBytes[OT_THREAD_VENDOR_OUI_MAX_SIZE]; ///< The OUI bytes in big-endian order.
|
||||
} otThreadVendorOui;
|
||||
|
||||
/**
|
||||
* Represents a Network Diagnostic TLV.
|
||||
*/
|
||||
@@ -304,6 +349,7 @@ typedef struct otNetworkDiagTlv
|
||||
char mVendorSwVersion[OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_SW_VERSION_TLV_LENGTH + 1];
|
||||
char mThreadStackVersion[OT_NETWORK_DIAGNOSTIC_MAX_THREAD_STACK_VERSION_TLV_LENGTH + 1];
|
||||
char mVendorAppUrl[OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_APP_URL_TLV_LENGTH + 1];
|
||||
otThreadVendorOui mVendorOui;
|
||||
otChannelMask mNonPreferredChannels;
|
||||
otNetworkDiagData mChannelPages;
|
||||
otNetworkDiagChildTable mChildTable;
|
||||
@@ -426,19 +472,78 @@ const char *otThreadGetVendorSwVersion(otInstance *aInstance);
|
||||
const char *otThreadGetVendorAppUrl(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Represents an unspecified Vendor OUI.
|
||||
* Gets the vendor OUI.
|
||||
*
|
||||
* If no vendor OUI is yet set/configured on device, the `mBitLength` in @p aOui will be zero.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aOui A pointer to an `otThreadVendorOui` to return the vendor OUI.
|
||||
*/
|
||||
#define OT_THREAD_UNSPECIFIED_VENDOR_OUI (0xffffffff)
|
||||
void otThreadGetVendorOuiInfo(otInstance *aInstance, otThreadVendorOui *aOui);
|
||||
|
||||
/**
|
||||
* Get the vendor OUI-24
|
||||
* Sets the vendor OUI.
|
||||
*
|
||||
* Requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aOui A pointer to the `otThreadVendorOui` to set.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the vendor OUI.
|
||||
* @retval OT_ERROR_INVALID_ARGS @p aOui has an invalid length.
|
||||
*/
|
||||
otError otThreadSetVendorOuiInfo(otInstance *aInstance, const otThreadVendorOui *aOui);
|
||||
|
||||
#define OT_THREAD_VENDOR_OUI_STRING_SIZE 16 ///< Recommended size for string representation of a vendor OUI.
|
||||
|
||||
/**
|
||||
* Converts a given vendor OUI to a human-readable string.
|
||||
*
|
||||
* The generated string format is hyphen-separated uppercase hexadecimal bytes (e.g., "00-1A-2B" for a 24-bit OUI).
|
||||
* For 28-bit and 36-bit OUIs, the trailing 4-bit nibble is appended as a single hexadecimal digit (e.g., "00-1A-2B-3"
|
||||
* for a 28-bit OUI). If @p aOui is invalid or unspecified, the string "unspecified" is returned.
|
||||
*
|
||||
* If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be truncated
|
||||
* but the outputted string is always null-terminated.
|
||||
*
|
||||
* @param[in] aOui The vendor OUI to convert.
|
||||
* @param[out] aBuffer A pointer to a char array to output the string (MUST NOT be NULL).
|
||||
* @param[in] aSize The size of @p aBuffer (in bytes). Recommended to use `OT_THREAD_VENDOR_OUI_STRING_SIZE`.
|
||||
*/
|
||||
void otThreadVendorOuiToString(const otThreadVendorOui *aOui, char *aBuffer, uint16_t aSize);
|
||||
|
||||
#define OT_THREAD_UNSPECIFIED_VENDOR_OUI (0xffffffff) ///< Represents an unspecified Vendor OUI.
|
||||
|
||||
/**
|
||||
* Gets the vendor OUI-24.
|
||||
*
|
||||
* @deprecated This function is deprecated. Use `otThreadGetVendorOuiInfo()` instead.
|
||||
*
|
||||
* If the configured Vendor OUI has a prefix length greater than 24 bits, this function returns the most significant
|
||||
* 24 bits (first 3 bytes) of the OUI to maintain backward compatibility.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The vendor OUI-24 value in hex format, or `OT_THREAD_UNSPECIFIED_VENDOR_OUI` is not specified.
|
||||
* @returns The vendor OUI-24 value, or `OT_THREAD_UNSPECIFIED_VENDOR_OUI` if not specified.
|
||||
*/
|
||||
uint32_t otThreadGetVendorOui(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Sets the vendor OUI-24.
|
||||
*
|
||||
* @deprecated This function is deprecated. Use `otThreadSetVendorOuiInfo()` instead.
|
||||
*
|
||||
* Requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aVendorOui The vendor OUI-24 value in Hexadecimal representation (e.g., OUI 64-16-66 is represented as
|
||||
* `0x641666`). Must be a 24-bit value.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the vendor OUI.
|
||||
* @retval OT_ERROR_INVALID_ARGS @p aVendorOui is not a valid 24-bit value.
|
||||
*/
|
||||
otError otThreadSetVendorOui(otInstance *aInstance, uint32_t aVendorOui);
|
||||
|
||||
/**
|
||||
* Set the vendor name string.
|
||||
*
|
||||
@@ -508,20 +613,6 @@ otError otThreadSetVendorSwVersion(otInstance *aInstance, const char *aVendorSwV
|
||||
*/
|
||||
otError otThreadSetVendorAppUrl(otInstance *aInstance, const char *aVendorAppUrl);
|
||||
|
||||
/**
|
||||
* Set the vendor OUI-24.
|
||||
*
|
||||
* Requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aVendorOui The vendor OUI-24 value in Hexadecimal representation (e.g., OUI 64-16-66 is represented as
|
||||
* `0x641666`). Must be a 24-bit value.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the vendor OUI.
|
||||
* @retval OT_ERROR_INVALID_ARGS @p aVendorOui is not a valid 24-bit value.
|
||||
*/
|
||||
otError otThreadSetVendorOui(otInstance *aInstance, uint32_t aVendorOui);
|
||||
|
||||
/**
|
||||
* Callback function pointer to notify when a Network Diagnostic Reset request message is received for the
|
||||
* `OT_NETWORK_DIAGNOSTIC_TLV_NON_PREFERRED_CHANNELS` TLV.
|
||||
|
||||
@@ -74,10 +74,10 @@ extern "C" {
|
||||
#define OT_BLE_ADV_INTERVAL_MAX 0x4000
|
||||
|
||||
/**
|
||||
* Default interval for advertising packet (ms).
|
||||
* Default interval for advertising packet in OT_BLE_ADV_INTERVAL_UNIT units (100 ms).
|
||||
*/
|
||||
|
||||
#define OT_BLE_ADV_INTERVAL_DEFAULT 100
|
||||
#define OT_BLE_ADV_INTERVAL_DEFAULT 160
|
||||
|
||||
/**
|
||||
* Unit used to calculate interval duration (0.625ms).
|
||||
@@ -104,13 +104,13 @@ extern "C" {
|
||||
#define OT_BLE_ATT_MTU_DEFAULT 23
|
||||
|
||||
/**
|
||||
* Default power value for BLE.
|
||||
* Default Tx power value for BLE in dBm.
|
||||
*/
|
||||
|
||||
#define OT_BLE_DEFAULT_POWER 0
|
||||
|
||||
/**
|
||||
* TOBLE service UUID
|
||||
* ToBLE service UUID (a GATT service UUID for Thread over BLE)
|
||||
*/
|
||||
|
||||
#define OT_TOBLE_SERVICE_UUID 0xfffb
|
||||
@@ -130,7 +130,7 @@ typedef struct otBleLinkCapabilities
|
||||
*/
|
||||
typedef struct otBleRadioPacket
|
||||
{
|
||||
uint8_t *mValue; ///< The value of an attribute
|
||||
uint8_t *mValue; ///< Pointer to the packet data
|
||||
uint16_t mLength; ///< Length of the @p mValue.
|
||||
int8_t mPower; ///< Transmit/receive power in dBm.
|
||||
} otBleRadioPacket;
|
||||
@@ -171,18 +171,16 @@ otError otPlatBleDisable(otInstance *aInstance);
|
||||
* @section Bluetooth Low Energy GAP.
|
||||
***************************************************************************/
|
||||
/**
|
||||
* Gets BLE Advertising buffer.
|
||||
* Gets a platform-provided buffer for BLE advertising data.
|
||||
*
|
||||
* @note This function shall be used only for BLE Peripheral role.
|
||||
* Returned buffer should have enough space to fit max advertisement
|
||||
* defined by specification.
|
||||
* The platform must provide a buffer of at least @p OT_TCAT_ADVERTISEMENT_MAX_LEN bytes.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aAdvertisementData The formatted TCAT advertisement frame.
|
||||
* @param[in] aAdvertisementLen The TCAT advertisement frame length.
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[out] aAdvertisementBuffer A pointer to be set to the platform-provided advertisement buffer.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Advertising procedure has been started.
|
||||
* @retval OT_ERROR_NO_BUFS No bufferspace available.
|
||||
* @retval OT_ERROR_NONE Successfully retrieved the advertisement buffer.
|
||||
* @retval OT_ERROR_NO_BUFS No buffer space available.
|
||||
*/
|
||||
otError otPlatBleGetAdvertisementBuffer(otInstance *aInstance, uint8_t **aAdvertisementBuffer);
|
||||
|
||||
@@ -190,13 +188,15 @@ otError otPlatBleGetAdvertisementBuffer(otInstance *aInstance, uint8_t **aAdvert
|
||||
* Sets BLE Advertising data.
|
||||
*
|
||||
* @note This function shall be used only for BLE Peripheral role.
|
||||
* It shall only be called while advertising is not active.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aAdvertisementData The formatted TCAT advertisement frame.
|
||||
* @param[in] aAdvertisementLen The TCAT advertisement frame length.
|
||||
* @param[in] aAdvertisementLen The length of the @p aAdvertisementData frame.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Advertising procedure has been started.
|
||||
* @retval OT_ERROR_NONE Advertising data set successfully.
|
||||
* @retval OT_ERROR_INVALID_STATE BLE Device is in invalid state.
|
||||
* @retval OT_ERROR_FAILED Setting of data failed.
|
||||
* @retval OT_ERROR_INVALID_ARGS Invalid value has been supplied.
|
||||
*/
|
||||
otError otPlatBleGapAdvSetData(otInstance *aInstance, uint8_t *aAdvertisementData, uint16_t aAdvertisementLen);
|
||||
@@ -205,12 +205,14 @@ otError otPlatBleGapAdvSetData(otInstance *aInstance, uint8_t *aAdvertisementDat
|
||||
* Updates BLE Advertising data.
|
||||
*
|
||||
* @note This function shall be used only for BLE Peripheral role.
|
||||
* It shall only be called while advertising is active.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aAdvertisementData The formatted TCAT advertisement frame.
|
||||
* @param[in] aAdvertisementLen The TCAT advertisement frame length.
|
||||
* @param[in] aAdvertisementLen The length of the @p aAdvertisementData frame.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Advertising procedure has been started.
|
||||
* @retval OT_ERROR_NONE Advertising data updated successfully.
|
||||
* @retval OT_ERROR_INVALID_STATE BLE Device is in invalid state.
|
||||
* @retval OT_ERROR_FAILED Update of data failed.
|
||||
* @retval OT_ERROR_INVALID_ARGS Invalid value has been supplied.
|
||||
*/
|
||||
@@ -222,11 +224,15 @@ otError otPlatBleGapAdvUpdateData(otInstance *aInstance, uint8_t *aAdvertisement
|
||||
* The BLE device shall use undirected advertising with no filter applied.
|
||||
* A single BLE Advertising packet must be sent on all advertising
|
||||
* channels (37, 38 and 39).
|
||||
* The advertising shall remain active until either otPlatBleGapAdvStop() is
|
||||
* called or a BLE Central Device connects (otPlatBleGapOnConnected()).
|
||||
* The BLE platform is not obliged to exactly match the requested interval
|
||||
* between subsequent advertising packets: it is a requested/desired value.
|
||||
*
|
||||
* @note This function shall be used only for BLE Peripheral role.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aInterval The interval between subsequent advertising packets
|
||||
* @param[in] aInterval The requested interval between subsequent advertising packets
|
||||
* in OT_BLE_ADV_INTERVAL_UNIT units.
|
||||
* Shall be within OT_BLE_ADV_INTERVAL_MIN and
|
||||
* OT_BLE_ADV_INTERVAL_MAX range or OT_BLE_ADV_INTERVAL_DEFAULT
|
||||
@@ -251,8 +257,8 @@ otError otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval);
|
||||
otError otPlatBleGapAdvStop(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* The BLE driver calls this method to notify OpenThread that a BLE Central Device has
|
||||
* been connected.
|
||||
* The BLE driver calls this function to notify OpenThread that a BLE Central Device has
|
||||
* been connected. The BLE driver MUST stop advertising before calling this function.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aConnectionId The identifier of the open connection.
|
||||
@@ -260,8 +266,9 @@ otError otPlatBleGapAdvStop(otInstance *aInstance);
|
||||
extern void otPlatBleGapOnConnected(otInstance *aInstance, uint16_t aConnectionId);
|
||||
|
||||
/**
|
||||
* The BLE driver calls this method to notify OpenThread that the BLE Central Device
|
||||
* has been disconnected.
|
||||
* The BLE driver calls this function to notify OpenThread that the BLE Central Device
|
||||
* has been disconnected. The BLE driver MUST NOT start advertising before or after this
|
||||
* call: this is controlled explicitly via otPlatBleGapAdvStart().
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aConnectionId The identifier of the closed connection.
|
||||
@@ -272,7 +279,11 @@ extern void otPlatBleGapOnDisconnected(otInstance *aInstance, uint16_t aConnecti
|
||||
* Disconnects BLE connection.
|
||||
*
|
||||
* The BLE device shall use the Remote User Terminated Connection (0x13) reason
|
||||
* code when disconnecting from the peer BLE device..
|
||||
* code when disconnecting from the peer BLE device.
|
||||
*
|
||||
* This function only triggers the disconnection procedure. When OT_ERROR_NONE is returned,
|
||||
* the platform MUST report completion of the disconnection asynchronously, by invoking
|
||||
* otPlatBleGapOnDisconnected().
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
@@ -297,7 +308,7 @@ otError otPlatBleGapDisconnect(otInstance *aInstance);
|
||||
otError otPlatBleGattMtuGet(otInstance *aInstance, uint16_t *aMtu);
|
||||
|
||||
/**
|
||||
* The BLE driver calls this method to notify OpenThread that ATT_MTU has been updated.
|
||||
* The BLE driver calls this function to notify OpenThread that ATT_MTU has been updated.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aMtu The updated ATT_MTU value. It MUST be >=OT_BLE_ATT_MTU_MIN.
|
||||
@@ -315,7 +326,7 @@ extern void otPlatBleGattOnMtuUpdate(otInstance *aInstance, uint16_t aMtu);
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aHandle The handle of the attribute to be indicated.
|
||||
* @param[in] aPacket A pointer to the packet contains value to be indicated.
|
||||
* @param[in] aPacket A pointer to the packet containing the value to be indicated.
|
||||
*
|
||||
* @retval OT_ERROR_NONE ATT Handle Value Indication has been sent.
|
||||
* @retval OT_ERROR_INVALID_STATE BLE Device is in invalid state.
|
||||
@@ -325,29 +336,31 @@ extern void otPlatBleGattOnMtuUpdate(otInstance *aInstance, uint16_t aMtu);
|
||||
otError otPlatBleGattServerIndicate(otInstance *aInstance, uint16_t aHandle, const otBleRadioPacket *aPacket);
|
||||
|
||||
/**
|
||||
* The BLE driver calls this method to notify OpenThread that an ATT Write Request
|
||||
* The BLE driver calls this function to notify OpenThread that an ATT Write Request
|
||||
* packet has been received.
|
||||
*
|
||||
* @note This function shall be used only for GATT Server.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aHandle The handle of the attribute to be written.
|
||||
* @param[in] aPacket A pointer to the packet contains value to be written to the attribute.
|
||||
* @param[in] aPacket A pointer to the packet containing the value to be written to the attribute.
|
||||
*/
|
||||
extern void otPlatBleGattServerOnWriteRequest(otInstance *aInstance, uint16_t aHandle, const otBleRadioPacket *aPacket);
|
||||
|
||||
/**
|
||||
* Function to retrieve from platform BLE link capabilities.
|
||||
* Retrieve BLE link capabilities from the platform.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[out] aBleLinkCapabilities The pointer to retrieve the BLE ling capabilities.
|
||||
* @param[out] aBleLinkCapabilities The pointer to retrieve the BLE link capabilities into.
|
||||
*/
|
||||
void otPlatBleGetLinkCapabilities(otInstance *aInstance, otBleLinkCapabilities *aBleLinkCapabilities);
|
||||
|
||||
/**
|
||||
* Function to retrieve from platform multiradio support of BLE and IEEE.
|
||||
* Check if the platform has multi-radio support for BLE and IEEE 802.15.4.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @returns TRUE if the platform supports simultaneous BLE and IEEE 802.15.4 operation, FALSE otherwise.
|
||||
*/
|
||||
bool otPlatBleSupportsMultiRadio(otInstance *aInstance);
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,439 @@
|
||||
/*
|
||||
* Copyright (c) 2026, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
* This file includes the abstraction for the platform TCP
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_PLATFORM_TCP_H_
|
||||
#define OPENTHREAD_PLATFORM_TCP_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <openthread/error.h>
|
||||
#include <openthread/instance.h>
|
||||
#include <openthread/ip6.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup plat-tcp
|
||||
*
|
||||
* @brief
|
||||
* This module includes the platform abstraction for TCP connections and listeners.
|
||||
*
|
||||
* All APIs in this module are applicable only when `OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE` feature is enabled.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents platform-specific data associated with a connection or a listener.
|
||||
*
|
||||
* This union is provided to add flexibility for the platform. A platform can choose to store a file descriptor
|
||||
* (e.g., an `int` for a POSIX socket) or a pointer to an arbitrary context or state structure needed by the
|
||||
* platform implementation.
|
||||
*
|
||||
* The OpenThread stack guarantees that the `otPlatTcpPlatformData` is fully cleared (all bytes set to zero) when a
|
||||
* new listener or connection instance is initialized.
|
||||
*
|
||||
* For an `otPlatTcpListener`, the `otPlatTcpEnableListener()` call provides an opportunity for the platform to allocate
|
||||
* or update this information. The OpenThread stack guarantees that `otPlatTcpDisableListener()` will be invoked on any
|
||||
* previously enabled listener, providing a deterministic point for the platform implementation to perform cleanup
|
||||
* (e.g., deallocating memory or context structures).
|
||||
*
|
||||
* For an `otPlatTcpConnection`, the `otPlatTcpConnect()` call or the `otPlatTcpAccept()` callback indicate when a new
|
||||
* connection instance is provided, allowing the platform data to be initialized. The platform is responsible for
|
||||
* cleaning up this data either before invoking `otPlatTcpHandleDisconnected()` (which invalidates the connection) or
|
||||
* from an `otPlatTcpAbort()` call. The OpenThread stack guarantees that it will eventually disconnect or abort any
|
||||
* active connection, ensuring a reliable cleanup path.
|
||||
*/
|
||||
typedef union
|
||||
{
|
||||
int mDescriptor; ///< A value (like a file descriptor).
|
||||
void *mContext; ///< Pointer to arbitrary platform data.
|
||||
} otPlatTcpPlatformData;
|
||||
|
||||
/**
|
||||
* Represents a TCP listener.
|
||||
*
|
||||
* The OpenThread core owns and manages the `otPlatTcpListener` instances. The platform should track the pointers
|
||||
* to these instances and use them when invoking the callbacks. The `otPlatTcpListener *` can be viewed as
|
||||
* a "descriptor" or "handle" to the listener.
|
||||
*/
|
||||
typedef struct otPlatTcpListener
|
||||
{
|
||||
otPlatTcpPlatformData mData; ///< Platform implementation specific data.
|
||||
} otPlatTcpListener;
|
||||
|
||||
/**
|
||||
* Represents a TCP connection.
|
||||
*
|
||||
* The OpenThread core owns and manages the `otPlatTcpConnection` instances. The platform should track the pointers
|
||||
* to these instances and pass them when invoking the `otPlatTcpHandle*` callbacks. The `otPlatTcpConnection *` can
|
||||
* be viewed as a "descriptor" or "handle" to the connection.
|
||||
*
|
||||
* The `otPlatTcpConnection` instance remains valid as long as the connection is active.
|
||||
*/
|
||||
typedef struct otPlatTcpConnection
|
||||
{
|
||||
otPlatTcpPlatformData mData; ///< Platform implementation specific data.
|
||||
} otPlatTcpConnection;
|
||||
|
||||
/**
|
||||
* Represents a TCP socket address.
|
||||
*/
|
||||
typedef struct otPlatTcpSockAddr
|
||||
{
|
||||
otSockAddr mSockAddr; ///< The socket address (IP address and port number). Use IPv4-mapped IPv6 for IPv4.
|
||||
uint32_t mIfIndex; ///< Interface index. Zero indicates any/unspecified.
|
||||
} otPlatTcpSockAddr;
|
||||
|
||||
/**
|
||||
* Defines the reason for a TCP connection disconnection.
|
||||
*/
|
||||
typedef enum otPlatTcpDisconnectReason
|
||||
{
|
||||
OT_PLAT_TCP_DISCONNECT_REASON_CLOSED, ///< Connection was gracefully closed.
|
||||
OT_PLAT_TCP_DISCONNECT_REASON_TIMEOUT, ///< Connection timed out (e.g., failed to connect or keepalive failure).
|
||||
OT_PLAT_TCP_DISCONNECT_REASON_REFUSED, ///< Connection was refused by the peer (RST received during handshake).
|
||||
OT_PLAT_TCP_DISCONNECT_REASON_RESET, ///< Connection was reset by the peer (RST received on established conn).
|
||||
OT_PLAT_TCP_DISCONNECT_REASON_ERROR, ///< Connection was aborted due to other errors.
|
||||
} otPlatTcpDisconnectReason;
|
||||
|
||||
/**
|
||||
* Enables a TCP listener.
|
||||
*
|
||||
* The platform should start listening for incoming TCP connections on the provided @p aLocalSockAddr. When an
|
||||
* incoming connection request is received, the platform must invoke the `otPlatTcpAccept()` callback to accept the
|
||||
* request.
|
||||
*
|
||||
* The @p aLocalSockAddr specifies the local interface, address, and port to bind to. Importantly, the port number
|
||||
* within @p aLocalSockAddr must not be zero. The IP address may be unspecified (all zeros) to indicate that the
|
||||
* listener should accept connections on any local address.
|
||||
*
|
||||
* @param[in] aListener The TCP listener.
|
||||
* @param[in] aLocalSockAddr The local socket address to listen on.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully enabled or disabled the listener.
|
||||
* @retval OT_ERROR_ALREADY Already listening on the same port/address.
|
||||
* @retval OT_ERROR_FAILED Failed to enable the listener.
|
||||
*/
|
||||
otError otPlatTcpEnableListener(otPlatTcpListener *aListener, const otPlatTcpSockAddr *aLocalSockAddr);
|
||||
|
||||
/**
|
||||
* Disables a TCP listener.
|
||||
*
|
||||
* The platform should stop listening for incoming connections on the socket associated with the listener.
|
||||
* Any incoming connection requests that have not yet been accepted should be discarded.
|
||||
*
|
||||
* @param[in] aListener The TCP listener.
|
||||
*/
|
||||
void otPlatTcpDisableListener(otPlatTcpListener *aListener);
|
||||
|
||||
/**
|
||||
* Callback to accept an incoming TCP connection request on an active listener.
|
||||
*
|
||||
* This function is implemented and provided by the OpenThread stack for the platform to use.
|
||||
*
|
||||
* The callback returns a pointer to an `otPlatTcpConnection` for the new connection. If the callback returns NULL,
|
||||
* the incoming connection is rejected.
|
||||
*
|
||||
* @param[in] aListener The TCP listener.
|
||||
* @param[in] aPeerSockAddr The peer's socket address.
|
||||
*
|
||||
* @returns A pointer for the newly accepted connection, or NULL to reject the connection request.
|
||||
*/
|
||||
extern otPlatTcpConnection *otPlatTcpAccept(otPlatTcpListener *aListener, const otPlatTcpSockAddr *aPeerSockAddr);
|
||||
|
||||
/**
|
||||
* Initiates a TCP connection to a peer.
|
||||
*
|
||||
* The platform should initiate a TCP connection to the @p aPeerSockAddr.
|
||||
*
|
||||
* The @p aLocalSockAddr specifies the local address and port to bind to before connecting. It can be NULL if the
|
||||
* OpenThread stack does not specify a preference. If provided, fields within @p aLocalSockAddr may still be left
|
||||
* unspecified (e.g., the IP address can be all zeros, or the port can be zero). In all such cases, the platform
|
||||
* and the underlying TCP stack should automatically select an appropriate local IP address and/or an ephemeral port.
|
||||
*
|
||||
* If `OT_ERROR_NONE` is returned (indicating successful initialization of the connection process), the platform must
|
||||
* subsequently report the status. Upon successful connection establishment, the platform must invoke the
|
||||
* `otPlatTcpHandleConnected` callback. If it fails to establish the connection, the `otPlatTcpHandleDisconnected`
|
||||
* callback must be called to indicate the failure.
|
||||
*
|
||||
* @param[in] aConn The TCP connection.
|
||||
* @param[in] aPeerSockAddr The peer's socket address.
|
||||
* @param[in] aLocalSockAddr The local socket address. Can be NULL.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully initiated the connection.
|
||||
* @retval OT_ERROR_FAILED Failed to initiate the connection.
|
||||
*/
|
||||
otError otPlatTcpConnect(otPlatTcpConnection *aConn,
|
||||
const otPlatTcpSockAddr *aPeerSockAddr,
|
||||
const otPlatTcpSockAddr *aLocalSockAddr);
|
||||
|
||||
/**
|
||||
* Indicates whether the TCP connection is currently in the connecting state.
|
||||
*
|
||||
* This function is provided by the OpenThread stack. The platform can use it to determine if a TCP connection is still
|
||||
* waiting for the TCP handshake to complete.
|
||||
*
|
||||
* @param[in] aConn The TCP connection.
|
||||
*
|
||||
* @retval TRUE The connection is currently in the connecting state.
|
||||
* @retval FALSE The connection is not in the connecting state.
|
||||
*/
|
||||
extern bool otPlatTcpIsConnecting(otPlatTcpConnection *aConn);
|
||||
|
||||
/**
|
||||
* Callback to notify the connection establishment.
|
||||
*
|
||||
* This callback is implemented and provided by the OpenThread stack. It must be invoked by the platform to indicate
|
||||
* that the TCP handshake is complete and that the connection is now established.
|
||||
*
|
||||
* The platform must call this after a successful call to `otPlatTcpConnect()` when the connection is established.
|
||||
* For incoming connection requests (on an `otPlatTcpListener`), the platform must call this after the
|
||||
* `otPlatTcpAccept()` callback returns successfully and when the connection is established.
|
||||
*
|
||||
* @param[in] aConn The TCP connection.
|
||||
*/
|
||||
extern void otPlatTcpHandleConnected(otPlatTcpConnection *aConn);
|
||||
|
||||
/**
|
||||
* Notifies the platform that there is pending data for transmission.
|
||||
*
|
||||
* This function is called by the OpenThread stack when it has new data for transmission. After this call, the platform
|
||||
* should indicate when it is ready to accept the data by invoking the `otPlatTcpHandleTxReady()` callback.
|
||||
*
|
||||
* The platform can also use `otPlatTcpIsTxPending()` to check if there is pending data for transmission.
|
||||
*
|
||||
* It is permissible for the platform implementation to invoke the `otPlatTcpHandleTxReady()` callback directly from
|
||||
* within `otPlatTcpNotifyTxPending()` before returning, if the underlying TCP transmit buffer is already available.
|
||||
* The OpenThread stack will handle this correctly.
|
||||
*
|
||||
* @param[in] aConn The TCP connection.
|
||||
*/
|
||||
void otPlatTcpNotifyTxPending(otPlatTcpConnection *aConn);
|
||||
|
||||
/**
|
||||
* Indicates whether the TCP connection has pending data for transmission.
|
||||
*
|
||||
* This function is provided by the OpenThread stack. The platform can use it to check if there is any pending data
|
||||
* for transmission over the TCP connection.
|
||||
*
|
||||
* @param[in] aConn The TCP connection.
|
||||
*
|
||||
* @retval TRUE The connection has pending transmit data.
|
||||
* @retval FALSE The connection does not have pending transmit data.
|
||||
*/
|
||||
extern bool otPlatTcpIsTxPending(otPlatTcpConnection *aConn);
|
||||
|
||||
/**
|
||||
* Callback to notify that the platform is ready to accept more transmit data.
|
||||
*
|
||||
* This function is implemented and provided by the OpenThread stack for the platform to use.
|
||||
*
|
||||
* The platform should invoke this callback when it is ready to accept more data for transmission over the TCP
|
||||
* connection, in response to a prior `otPlatTcpNotifyTxPending()` call. Upon being called, the OpenThread stack will
|
||||
* use `otPlatTcpSend()` to provide the pending TX data to the platform. The stack may call `otPlatTcpSend()` multiple
|
||||
* times during the execution of this callback.
|
||||
*
|
||||
* @param[in] aConn The TCP connection.
|
||||
*/
|
||||
extern void otPlatTcpHandleTxReady(otPlatTcpConnection *aConn);
|
||||
|
||||
/**
|
||||
* Sends data over an active TCP connection.
|
||||
*
|
||||
* This function is called by the OpenThread stack to provide data for the platform to transmit. The data is provided
|
||||
* in a buffer. The platform should copy as much data as it can from the given buffer into its underlying platform
|
||||
* transmit buffer.
|
||||
*
|
||||
* The provided @p aBuffer is temporary. The platform must not store the pointer or assume the content remains valid
|
||||
* after this function returns. All required data must be copied during this call.
|
||||
*
|
||||
* The OpenThread stack typically invokes this function from the `otPlatTcpHandleTxReady()` callback. However, the
|
||||
* platform implementation must not assume this and should support being called at any time. If there is no space
|
||||
* available to accept any data, the platform can return zero.
|
||||
*
|
||||
* The OpenThread stack may call this function multiple times back-to-back to provide all queued transmit content
|
||||
* in chunks. The platform should be prepared to handle consecutive calls efficiently.
|
||||
*
|
||||
* @param[in] aConn The TCP connection.
|
||||
* @param[in] aBuffer A pointer to the buffer containing the data to send.
|
||||
* @param[in] aLength The length (in bytes) of the data in the buffer.
|
||||
*
|
||||
* @returns The actual number of bytes accepted for transmission.
|
||||
*/
|
||||
uint16_t otPlatTcpSend(otPlatTcpConnection *aConn, const uint8_t *aBuffer, uint16_t aLength);
|
||||
|
||||
/**
|
||||
* Callback to notify the reception of data on a connection.
|
||||
*
|
||||
* This function is implemented and provided by the OpenThread stack for the platform to use.
|
||||
*
|
||||
* The platform invokes this callback to provide received data to the OpenThread stack. The provided @p aBuffer
|
||||
* only needs to remain valid for the duration of this call. The OpenThread stack will process and copy the
|
||||
* bytes as needed, and will not retain the @p aBuffer pointer after the function returns.
|
||||
*
|
||||
* Since TCP is a stream protocol, data can arrive in arbitrarily sized chunks. The platform does not need to
|
||||
* buffer or reassemble these; it can invoke this callback immediately as data is received, even if it is expecting
|
||||
* more data. The OpenThread stack handles all stream-level behavior, processing, and retention of the
|
||||
* received data. This helps simplify the platform implementation.
|
||||
*
|
||||
* On certain platforms (such as standard POSIX), a return value of 0 from `read()` or `recv()` indicates an
|
||||
* End-of-File (EOF) or graceful closure by the peer. The platform implementation must check for this condition and
|
||||
* report it by invoking `otPlatTcpHandleDisconnected()` with the reason set to `OT_PLAT_TCP_DISCONNECT_REASON_CLOSED`.
|
||||
* Importantly, calling `otPlatTcpHandleReceive()` with `aLength` set to zero does not signify a graceful closure in
|
||||
* the `otPlatTcp` APIs; such a call is treated as a no-op receive event by the OpenThread stack and is ignored.
|
||||
*
|
||||
* @param[in] aConn The TCP connection.
|
||||
* @param[in] aBuffer A pointer to the buffer containing the received data. Must not be NULL if @p aLength > 0.
|
||||
* @param[in] aLength The length (in bytes) of the received data.
|
||||
*/
|
||||
extern void otPlatTcpHandleReceive(otPlatTcpConnection *aConn, const uint8_t *aBuffer, uint16_t aLength);
|
||||
|
||||
/**
|
||||
* Gracefully closes the TCP connection.
|
||||
*
|
||||
* This function initiates a graceful closure of the connection. The platform should transmit any remaining data
|
||||
* before performing the standard TCP connection termination.
|
||||
*
|
||||
* Once the connection is fully disconnected, or if it is already closed, or if an error occurs during the close
|
||||
* operation, the platform must indicate this by invoking the `otPlatTcpHandleDisconnected` callback.
|
||||
*
|
||||
* The platform must always call `otPlatTcpHandleDisconnected()` to report the final outcome of the connection.
|
||||
* It is permissible for the platform implementation to invoke this callback directly from within `otPlatTcpClose()`
|
||||
* before returning. The OpenThread stack will handle this correctly.
|
||||
*
|
||||
* @param[in] aConn The TCP connection.
|
||||
*/
|
||||
void otPlatTcpClose(otPlatTcpConnection *aConn);
|
||||
|
||||
/**
|
||||
* Aborts the TCP connection.
|
||||
*
|
||||
* This function forcefully terminates the connection. Any unsent data is discarded.
|
||||
*
|
||||
* After this call, the platform must forget the @p aConn. Importantly, it must not invoke any callbacks using the
|
||||
* @p aConn any longer, including `otPlatTcpHandleDisconnected`. This effectively indicates to the platform that the
|
||||
* OpenThread core is de-allocating the @p aConn instance and it is no longer valid.
|
||||
*
|
||||
* @param[in] aConn The TCP connection.
|
||||
*/
|
||||
void otPlatTcpAbort(otPlatTcpConnection *aConn);
|
||||
|
||||
/**
|
||||
* Callback to notify the connection disconnection.
|
||||
*
|
||||
* This function is implemented and provided by the OpenThread stack for the platform to use.
|
||||
*
|
||||
* This callback should be invoked by the platform when it fails to establish a connection, when an established
|
||||
* connection is successfully closed (by both endpoints), when it times out, or is reset or aborted.
|
||||
*
|
||||
* After this callback is invoked, the `otPlatTcpConnection` instance is no longer valid. The platform must not use it
|
||||
* in any future callbacks.
|
||||
*
|
||||
* @param[in] aConn The TCP connection.
|
||||
* @param[in] aReason The reason for the disconnection.
|
||||
*/
|
||||
extern void otPlatTcpHandleDisconnected(otPlatTcpConnection *aConn, otPlatTcpDisconnectReason aReason);
|
||||
|
||||
/**
|
||||
* Gets the OpenThread instance associated with a given TCP connection.
|
||||
*
|
||||
* This function is provided by OpenThread core. Platform implementations can use it to get the OpenThread instance
|
||||
* associated with an active `otPlatTcpConnection`.
|
||||
*
|
||||
* @param[in] aConn The TCP connection.
|
||||
*
|
||||
* @returns The OpenThread instance.
|
||||
*/
|
||||
extern otInstance *otPlatTcpGetInstanceForConnection(otPlatTcpConnection *aConn);
|
||||
|
||||
/**
|
||||
* Gets the OpenThread instance associated with a given TCP listener.
|
||||
*
|
||||
* This function is provided by OpenThread core. Platform implementations can use it to get the OpenThread instance
|
||||
* associated with an active `otPlatTcpListener`.
|
||||
*
|
||||
* @param[in] aListener The TCP listener.
|
||||
*
|
||||
* @returns The OpenThread instance.
|
||||
*/
|
||||
extern otInstance *otPlatTcpGetInstanceForListener(otPlatTcpListener *aListener);
|
||||
|
||||
/**
|
||||
* Iterates through the active TCP listeners.
|
||||
*
|
||||
* This function can be used to iterate over all currently active TCP listeners associated with the OpenThread
|
||||
* instance. It allows platform implementations to process or manage listeners without needing to maintain their own
|
||||
* list of active listeners.
|
||||
*
|
||||
* The iteration is guaranteed to remain consistent even if callbacks (e.g., `otPlatTcpAccept`) are invoked during the
|
||||
* process.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance.
|
||||
* @param[in] aPrevListener A pointer to the previous listener, or `NULL` to start the iteration from the beginning.
|
||||
*
|
||||
* @returns A pointer to the next listener, or `NULL` if there are no more listeners.
|
||||
*/
|
||||
extern otPlatTcpListener *otPlatTcpIterateListeners(otInstance *aInstance, otPlatTcpListener *aPrevListener);
|
||||
|
||||
/**
|
||||
* Iterates through the active TCP connections.
|
||||
*
|
||||
* This function can be used to iterate over all currently active TCP connections associated with the OpenThread
|
||||
* instance. It allows platform implementations to process or manage connections without needing to maintain their own
|
||||
* list of active connections.
|
||||
*
|
||||
* The iteration is guaranteed to remain consistent and safe even if callbacks are invoked during the process. For
|
||||
* example, if a connection is reported as disconnected via `otPlatTcpHandleDisconnected` during iteration, the
|
||||
* OpenThread stack ensures that the connection entry remains valid until the iteration is completed.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance.
|
||||
* @param[in] aPrevConn A pointer to the previous connection, or `NULL` to start the iteration from the beginning.
|
||||
*
|
||||
* @returns A pointer to the next connection, or `NULL` if there are no more connections.
|
||||
*/
|
||||
extern otPlatTcpConnection *otPlatTcpIterateConnections(otInstance *aInstance, otPlatTcpConnection *aPrevConn);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_PLATFORM_TCP_H_
|
||||
@@ -628,38 +628,6 @@ const char *otThreadGetDomainName(otInstance *aInstance);
|
||||
*/
|
||||
otError otThreadSetDomainName(otInstance *aInstance, const char *aDomainName);
|
||||
|
||||
/**
|
||||
* Sets or clears the Interface Identifier manually specified for the Thread Domain Unicast Address.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.
|
||||
*
|
||||
* @note Only available since Thread 1.2.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aIid A pointer to the Interface Identifier to set or NULL to clear.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set/cleared the Interface Identifier.
|
||||
* @retval OT_ERROR_INVALID_ARGS The specified Interface Identifier is reserved.
|
||||
*
|
||||
* @sa otThreadGetFixedDuaInterfaceIdentifier
|
||||
*/
|
||||
otError otThreadSetFixedDuaInterfaceIdentifier(otInstance *aInstance, const otIp6InterfaceIdentifier *aIid);
|
||||
|
||||
/**
|
||||
* Gets the Interface Identifier manually specified for the Thread Domain Unicast Address.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.
|
||||
*
|
||||
* @note Only available since Thread 1.2.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns A pointer to the Interface Identifier which was set manually, or NULL if none was set.
|
||||
*
|
||||
* @sa otThreadSetFixedDuaInterfaceIdentifier
|
||||
*/
|
||||
const otIp6InterfaceIdentifier *otThreadGetFixedDuaInterfaceIdentifier(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Gets the thrKeySequenceCounter.
|
||||
*
|
||||
|
||||
@@ -394,11 +394,17 @@ void otThreadSetNetworkIdTimeout(otInstance *aInstance, uint8_t aTimeout);
|
||||
uint8_t otThreadGetRouterUpgradeThreshold(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the ROUTER_UPGRADE_THRESHOLD parameter used in the Leader role.
|
||||
* Sets the ROUTER_UPGRADE_THRESHOLD parameter.
|
||||
*
|
||||
* @note This API is reserved for testing and demo purposes only. Changing settings with
|
||||
* this API will render a production application non-compliant with the Thread Specification.
|
||||
*
|
||||
* This API historically set a single threshold value that was used for both local role transitions (deciding when
|
||||
* the device itself should upgrade to a router) and by the leader (deciding whether to allow other devices to
|
||||
* upgrade). These behaviors have now been separated into distinct router and leader thresholds. To preserve backward
|
||||
* compatibility with existing applications and test scripts, this function continues to configure both thresholds
|
||||
* (both the local router upgrade threshold and the leader upgrade threshold).
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aThreshold The ROUTER_UPGRADE_THRESHOLD value.
|
||||
*
|
||||
|
||||
@@ -54,7 +54,6 @@ build_nrf52840()
|
||||
"-DOT_DIAGNOSTIC=ON"
|
||||
"-DOT_DNSSD_SERVER=ON"
|
||||
"-DOT_DNS_CLIENT=ON"
|
||||
"-DOT_DUA=ON"
|
||||
"-DOT_ECDSA=ON"
|
||||
"-DOT_FULL_LOGS=ON"
|
||||
"-DOT_JAM_DETECTION=ON"
|
||||
|
||||
@@ -158,23 +158,23 @@ build_all_features()
|
||||
# Build Thread 1.4 with full features
|
||||
reset_source
|
||||
CFLAGS="${cppflags[*]} ${CFLAGS}" CXXFLAGS="${cppflags[*]} ${CXXFLAGS}" \
|
||||
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON
|
||||
"$(dirname "$0")"/cmake-build simulation "${options[@]}"
|
||||
|
||||
# Build Thread 1.4 with external heap and msg pool using heap
|
||||
reset_source
|
||||
CFLAGS="${cppflags[*]} ${CFLAGS} -DOPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1" \
|
||||
CXXFLAGS="${cppflags[*]} ${CXXFLAGS} -DOPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1" \
|
||||
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON
|
||||
"$(dirname "$0")"/cmake-build simulation "${options[@]}"
|
||||
|
||||
# Build Thread 1.4 with full features and no log
|
||||
reset_source
|
||||
CFLAGS="${cppflags[*]} ${CFLAGS}" CXXFLAGS="${cppflags[*]} ${CXXFLAGS}" \
|
||||
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON -DOT_LOG_OUTPUT=NONE
|
||||
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_LOG_OUTPUT=NONE
|
||||
|
||||
# Build Thread 1.4 with full features and full logs
|
||||
reset_source
|
||||
CFLAGS="${cppflags[*]} ${CFLAGS}" CXXFLAGS="${cppflags[*]} ${CXXFLAGS}" \
|
||||
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON -DOT_FULL_LOGS=ON
|
||||
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_FULL_LOGS=ON
|
||||
|
||||
# Build with Vendor Extension
|
||||
reset_source
|
||||
@@ -188,7 +188,7 @@ build_all_features()
|
||||
|
||||
# Build Thread 1.4 with full features and OT_ASSERT=OFF
|
||||
reset_source
|
||||
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON -DOT_ASSERT=OFF
|
||||
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_ASSERT=OFF
|
||||
|
||||
# Build with RAM settings
|
||||
reset_source
|
||||
|
||||
@@ -112,7 +112,6 @@ OT_CLANG_TIDY_BUILD_OPTS=(
|
||||
'-DOT_DNS_UPSTREAM_QUERY=ON'
|
||||
"-DOT_DNSSD_DISCOVERY_PROXY=ON"
|
||||
'-DOT_DNSSD_SERVER=ON'
|
||||
'-DOT_DUA=ON'
|
||||
'-DOT_MLR=ON'
|
||||
'-DOT_ECDSA=ON'
|
||||
'-DOT_HISTORY_TRACKER=ON'
|
||||
|
||||
@@ -125,7 +125,6 @@ build_simulation()
|
||||
fi
|
||||
|
||||
if [[ ${version} != "1.1" ]]; then
|
||||
options+=("-DOT_DUA=ON")
|
||||
options+=("-DOT_MLR=ON")
|
||||
fi
|
||||
|
||||
@@ -184,7 +183,6 @@ build_posix()
|
||||
)
|
||||
|
||||
if [[ ${version} != "1.1" ]]; then
|
||||
options+=("-DOT_DUA=ON")
|
||||
options+=("-DOT_MLR=ON")
|
||||
options+=("-DOT_LINK_METRICS_INITIATOR=ON")
|
||||
options+=("-DOT_LINK_METRICS_SUBJECT=ON")
|
||||
@@ -346,14 +344,12 @@ do_build_otbr_docker()
|
||||
"-DOT_ANYCAST_LOCATOR=ON"
|
||||
"-DOT_COVERAGE=ON"
|
||||
"-DOT_DNS_CLIENT=ON"
|
||||
"-DOT_DUA=ON"
|
||||
"-DOT_MLR=ON"
|
||||
"-DOT_NETDATA_PUBLISHER=ON"
|
||||
"-DOT_SLAAC=ON"
|
||||
"-DOT_SRP_CLIENT=ON"
|
||||
"-DOT_FULL_LOGS=ON"
|
||||
"-DOT_UPTIME=ON"
|
||||
"-DOTBR_DUA_ROUTING=ON"
|
||||
"-DOTBR_DHCP6_PD=ON"
|
||||
)
|
||||
local args=(
|
||||
|
||||
@@ -63,6 +63,8 @@ openthread_cli_sources = [
|
||||
"cli_network_data.hpp",
|
||||
"cli_ping.cpp",
|
||||
"cli_ping.hpp",
|
||||
"cli_plat_tcp.cpp",
|
||||
"cli_plat_tcp.hpp",
|
||||
"cli_srp_client.cpp",
|
||||
"cli_srp_client.hpp",
|
||||
"cli_srp_server.cpp",
|
||||
|
||||
@@ -51,6 +51,7 @@ set(COMMON_SOURCES
|
||||
cli_mesh_diag.cpp
|
||||
cli_network_data.cpp
|
||||
cli_ping.cpp
|
||||
cli_plat_tcp.cpp
|
||||
cli_srp_client.cpp
|
||||
cli_srp_server.cpp
|
||||
cli_tcat.cpp
|
||||
|
||||
+1
-57
@@ -50,7 +50,6 @@ Done
|
||||
- [discover](#discover-channel)
|
||||
- [dns](#dns-config)
|
||||
- [domainname](#domainname)
|
||||
- [dua](#dua-iid)
|
||||
- [eidcache](#eidcache)
|
||||
- [eui64](#eui64)
|
||||
- [extaddr](#extaddr)
|
||||
@@ -174,30 +173,6 @@ BBR Primary: None
|
||||
Done
|
||||
```
|
||||
|
||||
### bbr mgmt dua \<status\|coap-code\> [meshLocalIid]
|
||||
|
||||
Configure the response status for DUA.req with meshLocalIid in payload. Without meshLocalIid, simply respond any coming DUA.req next with the specified status or COAP code.
|
||||
|
||||
Only for testing/reference device.
|
||||
|
||||
known status value:
|
||||
|
||||
- 0: ST_DUA_SUCCESS
|
||||
- 1: ST_DUA_REREGISTER
|
||||
- 2: ST_DUA_INVALID
|
||||
- 3: ST_DUA_DUPLICATE
|
||||
- 4: ST_DUA_NO_RESOURCES
|
||||
- 5: ST_DUA_BBR_NOT_PRIMARY
|
||||
- 6: ST_DUA_GENERAL_FAILURE
|
||||
- 160: COAP code 5.00
|
||||
|
||||
```bash
|
||||
> bbr mgmt dua 1 2f7c235e5025a2fd
|
||||
Done
|
||||
> bbr mgmt dua 160
|
||||
Done
|
||||
```
|
||||
|
||||
### bbr mgmt mlr listener
|
||||
|
||||
Show the Multicast Listeners.
|
||||
@@ -1959,34 +1934,6 @@ Set the Thread Domain Name for Thread 1.2 device.
|
||||
Done
|
||||
```
|
||||
|
||||
### dua iid
|
||||
|
||||
Get the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
|
||||
|
||||
```bash
|
||||
> dua iid
|
||||
0004000300020001
|
||||
Done
|
||||
```
|
||||
|
||||
### dua iid \<iid\>
|
||||
|
||||
Set the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
|
||||
|
||||
```bash
|
||||
> dua iid 0004000300020001
|
||||
Done
|
||||
```
|
||||
|
||||
### dua iid clear
|
||||
|
||||
Clear the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
|
||||
|
||||
```bash
|
||||
> dua iid clear
|
||||
Done
|
||||
```
|
||||
|
||||
### eidcache
|
||||
|
||||
Print the EID-to-RLOC cache entries.
|
||||
@@ -3596,7 +3543,7 @@ Done
|
||||
|
||||
### prefix
|
||||
|
||||
Get the prefix list in the local Network Data. Note: For the Thread 1.2 border router with backbone capability, the local Domain Prefix would be listed as well (with flag `D`), with preceding `-` if backbone functionality is disabled.
|
||||
Get the prefix list in the local Network Data.
|
||||
|
||||
```bash
|
||||
> prefix
|
||||
@@ -3609,8 +3556,6 @@ Done
|
||||
|
||||
Add a valid prefix to the Network Data.
|
||||
|
||||
Note: The Domain Prefix flag (`D`) is only available for Thread 1.2.
|
||||
|
||||
- p: Preferred flag
|
||||
- a: Stateless IPv6 Address Autoconfiguration flag
|
||||
- d: DHCPv6 IPv6 Address Configuration flag
|
||||
@@ -3619,7 +3564,6 @@ Note: The Domain Prefix flag (`D`) is only available for Thread 1.2.
|
||||
- o: On Mesh flag
|
||||
- s: Stable flag
|
||||
- n: Nd Dns flag
|
||||
- D: Domain Prefix flag
|
||||
- prf: Default router preference, which may be 'high', 'med', or 'low'.
|
||||
|
||||
```bash
|
||||
|
||||
@@ -430,7 +430,6 @@ Peer BRs are other devices within the Thread mesh that provide external IP conne
|
||||
|
||||
- It has added at least one external route entry.
|
||||
- It has added at least one prefix entry with both the default-route and on-mesh flags set.
|
||||
- It has added at least one domain prefix (with both the domain and on-mesh flags set).
|
||||
|
||||
The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
|
||||
|
||||
|
||||
@@ -466,7 +466,6 @@ The flags are as follows:
|
||||
- `o`: On Mesh flag
|
||||
- `s`: Stable flag
|
||||
- `n`: Nd Dns flag
|
||||
- `D`: Domain Prefix flag
|
||||
|
||||
Print the history as a table.
|
||||
|
||||
|
||||
@@ -283,7 +283,6 @@ Publish an on-mesh prefix entry.
|
||||
- o: On Mesh flag
|
||||
- s: Stable flag
|
||||
- n: Nd Dns flag
|
||||
- D: Domain Prefix flag (only available for Thread 1.2).
|
||||
- prf: Preference, which may be 'high', 'med', or 'low'.
|
||||
|
||||
```bash
|
||||
@@ -352,7 +351,6 @@ On-mesh prefixes are listed under `Prefixes` header:
|
||||
- o: On Mesh flag
|
||||
- s: Stable flag
|
||||
- n: Nd Dns flag
|
||||
- D: Domain Prefix flag (only available for Thread 1.2).
|
||||
- Preference `high`, `med`, or `low`
|
||||
- RLOC16 of device which added the on-mesh prefix
|
||||
|
||||
|
||||
+21
-92
@@ -108,6 +108,9 @@ Interpreter::Interpreter(Instance *aInstance, otCliOutputCallback aCallback, voi
|
||||
#if OPENTHREAD_CONFIG_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_TCP_ENABLE
|
||||
, mTcp(aInstance, *this)
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
|
||||
, mPlatTcp(aInstance, *this)
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_COAP_API_ENABLE
|
||||
, mCoap(aInstance, *this)
|
||||
#endif
|
||||
@@ -753,8 +756,8 @@ void Interpreter::OutputBorderAgentTxtDataInfo(uint8_t aIndentSize, const otBord
|
||||
|
||||
if (aInfo.mHasVendorOui)
|
||||
{
|
||||
OutputLine(aIndentSize, "VendorOui: %02X-%02X-%02X", aInfo.mVendorOui[0], aInfo.mVendorOui[1],
|
||||
aInfo.mVendorOui[2]);
|
||||
OutputFormat(aIndentSize, "VendorOui: ");
|
||||
OutputVendorOuiLine(aInfo.mVendorOui);
|
||||
}
|
||||
|
||||
if (aInfo.mHasStateBitmap)
|
||||
@@ -1102,70 +1105,6 @@ template <> otError Interpreter::Process<Cmd("domainname")>(Arg aArgs[])
|
||||
return ProcessGetSet(aArgs, otThreadGetDomainName, otThreadSetDomainName);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
template <> otError Interpreter::Process<Cmd("dua")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
/**
|
||||
* @cli dua iid
|
||||
* @code
|
||||
* dua iid
|
||||
* 0004000300020001
|
||||
* Done
|
||||
* @endcode
|
||||
* @par api_copy
|
||||
* #otThreadGetFixedDuaInterfaceIdentifier
|
||||
*/
|
||||
if (aArgs[0] == "iid")
|
||||
{
|
||||
if (aArgs[1].IsEmpty())
|
||||
{
|
||||
const otIp6InterfaceIdentifier *iid = otThreadGetFixedDuaInterfaceIdentifier(GetInstancePtr());
|
||||
|
||||
if (iid != nullptr)
|
||||
{
|
||||
OutputBytesLine(iid->mFields.m8);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @cli dua iid (set,clear)
|
||||
* @code
|
||||
* dua iid 0004000300020001
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dua iid clear
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dua iid @ca{iid|clear}
|
||||
* `dua iid clear` passes a `nullptr` to #otThreadSetFixedDuaInterfaceIdentifier.
|
||||
* Otherwise, you can pass the `iid`.
|
||||
* @par api_copy
|
||||
* #otThreadSetFixedDuaInterfaceIdentifier
|
||||
*/
|
||||
else if (aArgs[1] == "clear")
|
||||
{
|
||||
error = otThreadSetFixedDuaInterfaceIdentifier(GetInstancePtr(), nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
otIp6InterfaceIdentifier iid;
|
||||
|
||||
SuccessOrExit(error = aArgs[1].ParseAsHexString(iid.mFields.m8));
|
||||
error = otThreadSetFixedDuaInterfaceIdentifier(GetInstancePtr(), &iid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error = OT_ERROR_INVALID_COMMAND;
|
||||
}
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
|
||||
#endif // (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
|
||||
/**
|
||||
@@ -5514,9 +5453,6 @@ template <> otError Interpreter::Process<Cmd("prefix")>(Arg aArgs[])
|
||||
* @endcode
|
||||
* @par
|
||||
* Get the prefix list in the local Network Data.
|
||||
* @note For the Thread 1.2 border router with backbone capability, the local Domain Prefix
|
||||
* is listed as well and includes the `D` flag. If backbone functionality is disabled, a dash
|
||||
* `-` is printed before the local Domain Prefix.
|
||||
* @par
|
||||
* For more information about #otBorderRouterConfig flags, refer to @overview.
|
||||
* @sa otBorderRouterGetNextOnMeshPrefix
|
||||
@@ -5530,15 +5466,6 @@ template <> otError Interpreter::Process<Cmd("prefix")>(Arg aArgs[])
|
||||
{
|
||||
mNetworkData.OutputPrefix(config);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
||||
if (otBackboneRouterGetState(GetInstancePtr()) == OT_BACKBONE_ROUTER_STATE_DISABLED)
|
||||
{
|
||||
SuccessOrExit(otBackboneRouterGetDomainPrefix(GetInstancePtr(), &config));
|
||||
OutputFormat("- ");
|
||||
mNetworkData.OutputPrefix(config);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* @cli prefix add
|
||||
@@ -7011,6 +6938,10 @@ template <> otError Interpreter::Process<Cmd("tcat")>(Arg aArgs[]) { return mTca
|
||||
template <> otError Interpreter::Process<Cmd("tcp")>(Arg aArgs[]) { return mTcp.Process(aArgs); }
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
|
||||
template <> otError Interpreter::Process<Cmd("plattcp")>(Arg aArgs[]) { return mPlatTcp.Process(aArgs); }
|
||||
#endif
|
||||
|
||||
template <> otError Interpreter::Process<Cmd("udp")>(Arg aArgs[]) { return mUdp.Process(aArgs); }
|
||||
|
||||
template <> otError Interpreter::Process<Cmd("unsecureport")>(Arg aArgs[])
|
||||
@@ -7669,23 +7600,16 @@ template <> otError Interpreter::Process<Cmd("vendor")>(Arg aArgs[])
|
||||
* Done
|
||||
* @endcode
|
||||
* @par api_copy
|
||||
* #otThreadGetVendorOui
|
||||
* #otThreadGetVendorOuiInfo
|
||||
*/
|
||||
else if (aArgs[0] == "oui")
|
||||
{
|
||||
if (aArgs[1].IsEmpty())
|
||||
{
|
||||
uint32_t oui = otThreadGetVendorOui(GetInstancePtr());
|
||||
otThreadVendorOui oui;
|
||||
|
||||
if (oui == OT_THREAD_UNSPECIFIED_VENDOR_OUI)
|
||||
{
|
||||
OutputLine("unspecified");
|
||||
}
|
||||
else
|
||||
{
|
||||
OutputLine("%02X-%02X-%02X", static_cast<uint8_t>((oui >> 16) & 0xff),
|
||||
static_cast<uint8_t>((oui >> 8) & 0xff), static_cast<uint8_t>(oui & 0xff));
|
||||
}
|
||||
otThreadGetVendorOuiInfo(GetInstancePtr(), &oui);
|
||||
OutputVendorOuiLine(oui);
|
||||
|
||||
error = OT_ERROR_NONE;
|
||||
}
|
||||
@@ -7833,6 +7757,7 @@ template <> otError Interpreter::Process<Cmd("networkdiagnostic")>(Arg aArgs[])
|
||||
* - `41`: Border Router DHCPv6-PD OMR Prefix TLV
|
||||
* - `42`: Border Router Local On-link Prefix TLV
|
||||
* - `43`: Border Router Favored On-link Prefix TLV
|
||||
* - `44`: Vendor OUI TLV
|
||||
*
|
||||
* @par
|
||||
* Sends a network diagnostic request to retrieve specified Type Length Values (TLVs)
|
||||
@@ -8003,6 +7928,10 @@ void Interpreter::HandleDiagnosticGetResponse(otError aError,
|
||||
case OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_APP_URL:
|
||||
OutputLine("Vendor App URL: %s", diagTlv.mData.mVendorAppUrl);
|
||||
break;
|
||||
case OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_OUI:
|
||||
OutputFormat("Vendor OUI: ");
|
||||
OutputVendorOuiLine(diagTlv.mData.mVendorOui);
|
||||
break;
|
||||
case OT_NETWORK_DIAGNOSTIC_TLV_THREAD_STACK_VERSION:
|
||||
OutputLine("Thread Stack Version: %s", diagTlv.mData.mThreadStackVersion);
|
||||
break;
|
||||
@@ -8671,9 +8600,6 @@ otError Interpreter::ProcessCommand(Arg aArgs[])
|
||||
#if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
CmdEntry("domainname"),
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
CmdEntry("dua"),
|
||||
#endif
|
||||
#if OPENTHREAD_FTD
|
||||
CmdEntry("eidcache"),
|
||||
#endif
|
||||
@@ -8774,6 +8700,9 @@ otError Interpreter::ProcessCommand(Arg aArgs[])
|
||||
CmdEntry("ping"),
|
||||
#endif
|
||||
CmdEntry("platform"),
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
|
||||
CmdEntry("plattcp"),
|
||||
#endif
|
||||
CmdEntry("pollperiod"),
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
|
||||
CmdEntry("preferrouterid"),
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
#include "cli/cli_mesh_diag.hpp"
|
||||
#include "cli/cli_network_data.hpp"
|
||||
#include "cli/cli_ping.hpp"
|
||||
#include "cli/cli_plat_tcp.hpp"
|
||||
#include "cli/cli_srp_client.hpp"
|
||||
#include "cli/cli_srp_server.hpp"
|
||||
#include "cli/cli_tcat.hpp"
|
||||
@@ -445,6 +446,10 @@ private:
|
||||
TcpExample mTcp;
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
|
||||
PlatTcp mPlatTcp;
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_COAP_API_ENABLE
|
||||
Coap mCoap;
|
||||
#endif
|
||||
|
||||
@@ -670,7 +670,6 @@ template <> otError Br::Process<Cmd("peers")>(Arg aArgs[])
|
||||
* Data entries:
|
||||
* - It has added at least one external route entry.
|
||||
* - It has added at least one prefix entry with both the default-route and on-mesh flags set.
|
||||
* - It has added at least one domain prefix (with both the domain and on-mesh flags set).
|
||||
* The list of peer BRs specifically excludes the current device, even if its is itself acting as a BR.
|
||||
* Info per BR entry:
|
||||
* - RLOC16 of the BR
|
||||
|
||||
@@ -97,6 +97,18 @@
|
||||
#define OPENTHREAD_CONFIG_CLI_IFCONFIG_INIT_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
|
||||
*
|
||||
* Indicates whether the plat-tcp CLI commands are enabled.
|
||||
*
|
||||
* These CLI commands are intended primarily for testing and evaluation of the `otPlatTcp` API implementations.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
|
||||
#define OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CLI_TCP_ENABLE
|
||||
*
|
||||
|
||||
+2
-1
@@ -452,7 +452,8 @@ otError Dns::GetDnsConfig(Arg aArgs[], otDnsQueryConfig *&aConfig)
|
||||
|
||||
VerifyOrExit(!aArgs[0].IsEmpty(), aConfig = nullptr);
|
||||
|
||||
SuccessOrExit(error = ParseToIp6Address(GetInstancePtr(), aArgs[0], aConfig->mServerSockAddr.mAddress, nat64Synth));
|
||||
SuccessOrExit(error = ParseOrSynthesizeIp6Address(aArgs[0], aConfig->mServerSockAddr.mAddress, nat64Synth));
|
||||
|
||||
if (nat64Synth)
|
||||
{
|
||||
OutputFormat("Synthesized IPv6 DNS server address: ");
|
||||
|
||||
@@ -1305,7 +1305,6 @@ void History::OutputRxTxEntryTableFormat(const otHistoryTrackerMessageInfo &aInf
|
||||
* * `o`: On mesh flag.
|
||||
* * `s`: Stable flag.
|
||||
* * `n`: Nd Dns flag.
|
||||
* * `D`: Domain prefix flag.
|
||||
* * Pref: Preference. Values can be either `high`, `med`, or `low`.
|
||||
* * RLOC16
|
||||
* @sa otHistoryTrackerIterateOnMeshPrefixHistory
|
||||
|
||||
@@ -125,6 +125,7 @@ template <> otError MeshDiag::Process<Cmd("topology")>(Arg aArgs[])
|
||||
otError error = OT_ERROR_NONE;
|
||||
otMeshDiagDiscoverConfig config;
|
||||
|
||||
ClearAllBytes(config);
|
||||
config.mDiscoverIp6Addresses = false;
|
||||
config.mDiscoverChildTable = false;
|
||||
|
||||
|
||||
@@ -96,11 +96,6 @@ void NetworkData::PrefixFlagsToString(const otBorderRouterConfig &aConfig, Flags
|
||||
*flagsPtr++ = 'n';
|
||||
}
|
||||
|
||||
if (aConfig.mDp)
|
||||
{
|
||||
*flagsPtr++ = 'D';
|
||||
}
|
||||
|
||||
*flagsPtr = '\0';
|
||||
}
|
||||
|
||||
@@ -804,7 +799,6 @@ exit:
|
||||
* * o: On Mesh flag
|
||||
* * s: Stable flag
|
||||
* * n: Nd Dns flag
|
||||
* * D: Domain Prefix flag (only available for Thread 1.2).
|
||||
* * Preference `high`, `med`, or `low`
|
||||
* * RLOC16 of device which added the on-mesh prefix
|
||||
* @par
|
||||
|
||||
@@ -96,7 +96,7 @@ otError PingSender::Process(Arg aArgs[])
|
||||
aArgs++;
|
||||
}
|
||||
|
||||
SuccessOrExit(error = ParseToIp6Address(GetInstancePtr(), aArgs[0], config.mDestination, nat64Synth));
|
||||
SuccessOrExit(error = ParseOrSynthesizeIp6Address(aArgs[0], config.mDestination, nat64Synth));
|
||||
|
||||
if (nat64Synth)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
/*
|
||||
* Copyright (c) 2026, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements a TCP CLI tool.
|
||||
*/
|
||||
|
||||
#include "openthread-core-config.h"
|
||||
|
||||
#include "cli_config.h"
|
||||
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
|
||||
|
||||
#include "cli_plat_tcp.hpp"
|
||||
|
||||
#include "instance/instance.hpp"
|
||||
|
||||
namespace ot {
|
||||
namespace Cli {
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
// PlatTcp::Listener
|
||||
|
||||
PlatTcp::Listener::Listener(Instance &aInstance, PlatTcp &aOwner)
|
||||
: Ip6::PlatTcp::Listener(aInstance, Accept, nullptr)
|
||||
, mOwner(aOwner)
|
||||
{
|
||||
}
|
||||
|
||||
Ip6::PlatTcp::Connection *PlatTcp::Listener::Accept(Ip6::PlatTcp::Listener &aListener, const SockAddr &aPeerSockAddr)
|
||||
{
|
||||
return static_cast<Listener &>(aListener).mOwner.Accept(aPeerSockAddr);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
// PlatTcp::Connection
|
||||
|
||||
PlatTcp::Connection::Connection(Instance &aInstance, PlatTcp &aOwner)
|
||||
: Ip6::PlatTcp::Connection(aInstance, HandleEvent, nullptr)
|
||||
, mOwner(aOwner)
|
||||
{
|
||||
}
|
||||
|
||||
void PlatTcp::Connection::HandleEvent(Ip6::PlatTcp::Connection &aConnection, const Event aEvent)
|
||||
{
|
||||
return static_cast<Connection &>(aConnection).mOwner.HandleEvent(aEvent);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
// PlatTcp
|
||||
|
||||
PlatTcp::PlatTcp(otInstance *aInstance, OutputImplementer &aOutputImplementer)
|
||||
: Utils(aInstance, aOutputImplementer)
|
||||
, mListener(AsCoreType(aInstance), *this)
|
||||
, mConnection(AsCoreType(aInstance), *this)
|
||||
, mIsBound(false)
|
||||
{
|
||||
}
|
||||
|
||||
PlatTcp::Connection *PlatTcp::Accept(const SockAddr &aPeerSockAddr)
|
||||
{
|
||||
OutputLine("PlatTcp: Accept %s", aPeerSockAddr.ToString().AsCString());
|
||||
|
||||
return &mConnection;
|
||||
}
|
||||
|
||||
void PlatTcp::HandleEvent(Connection::Event aEvent)
|
||||
{
|
||||
OutputLine("PlatTcp:: HandleEvent %s", Connection::EventToString(aEvent));
|
||||
|
||||
if (aEvent == Connection::kEventDisconnected)
|
||||
{
|
||||
OutputLine("PlatTcp:: DisconnectReason: %s",
|
||||
Connection::DisconnectReasonToString(mConnection.GetDisconnectReason()));
|
||||
}
|
||||
|
||||
if (aEvent == Connection::kEventReceive)
|
||||
{
|
||||
const Message *rxMessage = mConnection.GetRxMessage();
|
||||
|
||||
VerifyOrExit(rxMessage != nullptr);
|
||||
OutputLine("PlatTcp: Received %u bytes", rxMessage->GetLength());
|
||||
|
||||
for (uint16_t offset = 0; offset < rxMessage->GetLength();)
|
||||
{
|
||||
uint8_t buffer[32];
|
||||
uint16_t readLength = rxMessage->ReadBytes(offset, buffer, sizeof(buffer));
|
||||
|
||||
OutputSpaces(4);
|
||||
OutputBytesLine(buffer, readLength);
|
||||
|
||||
offset += readLength;
|
||||
}
|
||||
|
||||
mConnection.FreeRxMessage();
|
||||
}
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
otError PlatTcp::GetSockAddr(Arg aArgs[], SockAddr &aSockAddr)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint16_t port;
|
||||
uint32_t ifIndex;
|
||||
|
||||
aSockAddr.Clear();
|
||||
|
||||
VerifyOrExit(!aArgs[0].IsEmpty());
|
||||
SuccessOrExit(error = aArgs[0].ParseAsIp6Address(aSockAddr.GetAddress()));
|
||||
|
||||
VerifyOrExit(!aArgs[1].IsEmpty());
|
||||
SuccessOrExit(error = aArgs[1].ParseAsUint16(port));
|
||||
aSockAddr.SetPort(port);
|
||||
|
||||
VerifyOrExit(!aArgs[2].IsEmpty());
|
||||
SuccessOrExit(error = aArgs[2].ParseAsUint32(ifIndex));
|
||||
aSockAddr.SetIfIndex(ifIndex);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError PlatTcp::Process<Cmd("listener")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
if (aArgs[0].IsEmpty())
|
||||
{
|
||||
OutputEnabledDisabledStatus(mListener.GetState() == Listener::kStateEnabled);
|
||||
}
|
||||
else if (aArgs[0] == "enable")
|
||||
{
|
||||
SockAddr sockAddr;
|
||||
|
||||
SuccessOrExit(error = GetSockAddr(&aArgs[1], sockAddr));
|
||||
OutputLine("Enabling listener on %s", sockAddr.ToString().AsCString());
|
||||
error = mListener.Enable(sockAddr);
|
||||
}
|
||||
else if (aArgs[0] == "disable")
|
||||
{
|
||||
VerifyOrExit(aArgs[1].IsEmpty(), error = OT_ERROR_INVALID_ARGS);
|
||||
mListener.Disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
error = OT_ERROR_INVALID_COMMAND;
|
||||
}
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError PlatTcp::Process<Cmd("bind")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
SockAddr newSockAddr;
|
||||
|
||||
VerifyOrExit(mConnection.GetState() == Connection::kStateUnused, error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
if (aArgs[0].IsEmpty())
|
||||
{
|
||||
mIsBound = false;
|
||||
mLocalSockAddr.Clear();
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
SuccessOrExit(error = GetSockAddr(aArgs, newSockAddr));
|
||||
mLocalSockAddr = newSockAddr;
|
||||
mIsBound = true;
|
||||
OutputLine("LocalSockAddr: %s", mLocalSockAddr.ToString().AsCString());
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError PlatTcp::Process<Cmd("connect")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
SockAddr peerSockAddr;
|
||||
|
||||
SuccessOrExit(error = GetSockAddr(aArgs, peerSockAddr));
|
||||
|
||||
if (mIsBound)
|
||||
{
|
||||
OutputLine("Binding to %s, connecting to %s", mLocalSockAddr.ToString().AsCString(),
|
||||
peerSockAddr.ToString().AsCString());
|
||||
error = mConnection.BindAndConnect(mLocalSockAddr, peerSockAddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
OutputLine("Connecting to %s", peerSockAddr.ToString().AsCString());
|
||||
error = mConnection.Connect(peerSockAddr);
|
||||
}
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError PlatTcp::Process<Cmd("send")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
OwnedPtr<Message> message;
|
||||
uint16_t length;
|
||||
|
||||
SuccessOrExit(error = aArgs[0].ParseAsUint16(length));
|
||||
VerifyOrExit(aArgs[1].IsEmpty(), error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
message.Reset(AsCoreType(GetInstancePtr()).Get<MessagePool>().Allocate(Message::kTypeOther));
|
||||
VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS);
|
||||
|
||||
for (uint16_t i = 0; i < length; i++)
|
||||
{
|
||||
SuccessOrExit(error = message->Append<uint8_t>(static_cast<uint8_t>(i & 0xff) ^ (i >> 8)));
|
||||
}
|
||||
|
||||
error = mConnection.Send(message.PassOwnership());
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError PlatTcp::Process<Cmd("close")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
VerifyOrExit(aArgs[0].IsEmpty(), error = OT_ERROR_INVALID_ARGS);
|
||||
mConnection.Close();
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError PlatTcp::Process<Cmd("abort")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
VerifyOrExit(aArgs[0].IsEmpty(), error = OT_ERROR_INVALID_ARGS);
|
||||
mConnection.Abort();
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError PlatTcp::Process(Arg aArgs[])
|
||||
{
|
||||
#define CmdEntry(aCommandString) {aCommandString, &PlatTcp::Process<Cmd(aCommandString)>}
|
||||
|
||||
static constexpr Command kCommands[] = {CmdEntry("abort"), CmdEntry("bind"), CmdEntry("close"),
|
||||
CmdEntry("connect"), CmdEntry("listener"), CmdEntry("send")};
|
||||
|
||||
static_assert(BinarySearch::IsSorted(kCommands), "kCommands is not sorted");
|
||||
|
||||
otError error = OT_ERROR_INVALID_COMMAND;
|
||||
const Command *command;
|
||||
|
||||
if (aArgs[0].IsEmpty() || (aArgs[0] == "help"))
|
||||
{
|
||||
OutputCommandTable(kCommands);
|
||||
ExitNow(error = aArgs[0].IsEmpty() ? error : OT_ERROR_NONE);
|
||||
}
|
||||
|
||||
command = BinarySearch::Find(aArgs[0].GetCString(), kCommands);
|
||||
VerifyOrExit(command != nullptr);
|
||||
|
||||
error = (this->*command->mHandler)(aArgs + 1);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
} // namespace Cli
|
||||
} // namespace ot
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (c) 2026, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file contains definitions for a plat-TCP CLI tool.
|
||||
*/
|
||||
|
||||
#ifndef OT_CLI_CLI_PLAT_TCP_HPP_
|
||||
#define OT_CLI_CLI_PLAT_TCP_HPP_
|
||||
|
||||
#include "openthread-core-config.h"
|
||||
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
|
||||
|
||||
#include "cli/cli_config.h"
|
||||
#include "cli/cli_utils.hpp"
|
||||
|
||||
#include "net/plat_tcp.hpp"
|
||||
|
||||
namespace ot {
|
||||
namespace Cli {
|
||||
|
||||
/**
|
||||
* Implements a CLI-based plat-TCP example.
|
||||
*
|
||||
* These CLI commands are intended primarily for testing and evaluation of the `otPlatTcp` API implementations.
|
||||
*/
|
||||
class PlatTcp : private Utils
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param[in] aInstance The OpenThread Instance.
|
||||
* @param[in] aOutputImplementer An `OutputImplementer`.
|
||||
*/
|
||||
PlatTcp(otInstance *aInstance, OutputImplementer &aOutputImplementer);
|
||||
|
||||
/**
|
||||
* Processes a CLI sub-command.
|
||||
*
|
||||
* @param[in] aArgs An array of command line arguments.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully executed the CLI command.
|
||||
* @retval OT_ERROR_PENDING The CLI command was successfully started but final result is pending.
|
||||
* @retval OT_ERROR_INVALID_COMMAND Invalid or unknown CLI command.
|
||||
* @retval OT_ERROR_INVALID_ARGS Invalid arguments.
|
||||
* @retval ... Error during execution of the CLI command.
|
||||
*/
|
||||
otError Process(Arg aArgs[]);
|
||||
|
||||
private:
|
||||
using Command = CommandEntry<PlatTcp>;
|
||||
|
||||
using SockAddr = Ip6::PlatTcp::SockAddr;
|
||||
|
||||
class Listener : public Ip6::PlatTcp::Listener
|
||||
{
|
||||
public:
|
||||
Listener(Instance &aInstance, PlatTcp &aOwner);
|
||||
|
||||
private:
|
||||
static Ip6::PlatTcp::Connection *Accept(Ip6::PlatTcp::Listener &aListener, const SockAddr &aPeerSockAddr);
|
||||
|
||||
PlatTcp &mOwner;
|
||||
};
|
||||
|
||||
class Connection : public Ip6::PlatTcp::Connection
|
||||
{
|
||||
public:
|
||||
Connection(Instance &aInstance, PlatTcp &aOwner);
|
||||
|
||||
private:
|
||||
static void HandleEvent(Ip6::PlatTcp::Connection &aConnection, Event aEvent);
|
||||
|
||||
PlatTcp &mOwner;
|
||||
};
|
||||
|
||||
template <CommandId kCommandId> otError Process(Arg aArgs[]);
|
||||
|
||||
otError GetSockAddr(Arg aArgs[], SockAddr &aSockAddr);
|
||||
Connection *Accept(const SockAddr &aPeerSockAddr);
|
||||
void HandleEvent(Connection::Event aEvent);
|
||||
|
||||
Listener mListener;
|
||||
Connection mConnection;
|
||||
SockAddr mLocalSockAddr;
|
||||
bool mIsBound;
|
||||
};
|
||||
|
||||
} // namespace Cli
|
||||
} // namespace ot
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
|
||||
|
||||
#endif // OT_CLI_CLI_PLAT_TCP_HPP_
|
||||
+1
-1
@@ -400,7 +400,7 @@ template <> otError TcpExample::Process<Cmd("connect")>(Arg aArgs[])
|
||||
|
||||
VerifyOrExit(mInitialized, error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
SuccessOrExit(error = ParseToIp6Address(GetInstancePtr(), aArgs[0], sockaddr.mAddress, nat64Synth));
|
||||
SuccessOrExit(error = ParseOrSynthesizeIp6Address(aArgs[0], sockaddr.mAddress, nat64Synth));
|
||||
|
||||
if (nat64Synth)
|
||||
{
|
||||
|
||||
+2
-2
@@ -144,7 +144,7 @@ template <> otError UdpExample::Process<Cmd("connect")>(Arg aArgs[])
|
||||
otSockAddr sockaddr;
|
||||
bool nat64Synth;
|
||||
|
||||
SuccessOrExit(error = ParseToIp6Address(GetInstancePtr(), aArgs[0], sockaddr.mAddress, nat64Synth));
|
||||
SuccessOrExit(error = ParseOrSynthesizeIp6Address(aArgs[0], sockaddr.mAddress, nat64Synth));
|
||||
|
||||
if (nat64Synth)
|
||||
{
|
||||
@@ -281,7 +281,7 @@ template <> otError UdpExample::Process<Cmd("send")>(Arg aArgs[])
|
||||
{
|
||||
bool nat64Synth;
|
||||
|
||||
SuccessOrExit(error = ParseToIp6Address(GetInstancePtr(), aArgs[0], messageInfo.mPeerAddr, nat64Synth));
|
||||
SuccessOrExit(error = ParseOrSynthesizeIp6Address(aArgs[0], messageInfo.mPeerAddr, nat64Synth));
|
||||
|
||||
if (nat64Synth)
|
||||
{
|
||||
|
||||
+29
-18
@@ -231,6 +231,20 @@ void Utils::OutputSockAddrLine(const otSockAddr &aSockAddr)
|
||||
OutputNewLine();
|
||||
}
|
||||
|
||||
void Utils::OutputVendorOui(const otThreadVendorOui &aOui)
|
||||
{
|
||||
char string[OT_THREAD_VENDOR_OUI_STRING_SIZE];
|
||||
|
||||
otThreadVendorOuiToString(&aOui, string, sizeof(string));
|
||||
OutputFormat("%s", string);
|
||||
}
|
||||
|
||||
void Utils::OutputVendorOuiLine(const otThreadVendorOui &aOui)
|
||||
{
|
||||
OutputVendorOui(aOui);
|
||||
OutputNewLine();
|
||||
}
|
||||
|
||||
void Utils::OutputDnsTxtData(const uint8_t *aTxtData, uint16_t aTxtDataLength)
|
||||
{
|
||||
OutputDnsTxtData(/* aKeyValuePerLine */ false, 0, aTxtData, aTxtDataLength);
|
||||
@@ -629,25 +643,27 @@ const char *Utils::PreferenceToString(signed int aPreference)
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD || OPENTHREAD_MTD
|
||||
otError Utils::ParseToIp6Address(otInstance *aInstance, const Arg &aArg, otIp6Address &aAddress, bool &aSynthesized)
|
||||
{
|
||||
Error error = OT_ERROR_NONE;
|
||||
|
||||
VerifyOrExit(!aArg.IsEmpty(), error = OT_ERROR_INVALID_ARGS);
|
||||
error = aArg.ParseAsIp6Address(aAddress);
|
||||
otError Utils::ParseOrSynthesizeIp6Address(const Arg &aArg, otIp6Address &aAddress, bool &aSynthesized)
|
||||
{
|
||||
Error error;
|
||||
otIp4Address ip4Address;
|
||||
|
||||
aSynthesized = false;
|
||||
|
||||
if (error != OT_ERROR_NONE)
|
||||
{
|
||||
// It might be an IPv4 address, let's have a try.
|
||||
otIp4Address ip4Address;
|
||||
error = aArg.ParseAsIp6Address(aAddress);
|
||||
|
||||
// Do not touch the error value if we failed to parse it as an IPv4 address.
|
||||
SuccessOrExit(aArg.ParseAsIp4Address(ip4Address));
|
||||
SuccessOrExit(error = otNat64SynthesizeIp6Address(aInstance, &ip4Address, &aAddress));
|
||||
aSynthesized = true;
|
||||
if (error == OT_ERROR_NONE)
|
||||
{
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
// Try to parse it as an IPv4 address and synthesize.
|
||||
|
||||
SuccessOrExit(error = aArg.ParseAsIp4Address(ip4Address));
|
||||
SuccessOrExit(error = otNat64SynthesizeIp6Address(GetInstancePtr(), &ip4Address, &aAddress));
|
||||
aSynthesized = true;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
@@ -708,11 +724,6 @@ otError Utils::ParsePrefix(Arg aArgs[], otBorderRouterConfig &aConfig)
|
||||
aConfig.mNdDns = true;
|
||||
break;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
||||
case 'D':
|
||||
aConfig.mDp = true;
|
||||
break;
|
||||
#endif
|
||||
case '-':
|
||||
break;
|
||||
|
||||
|
||||
+19
-8
@@ -42,6 +42,7 @@
|
||||
#include <openthread/border_routing.h>
|
||||
#include <openthread/cli.h>
|
||||
#include <openthread/joiner.h>
|
||||
#include <openthread/netdiag.h>
|
||||
#include <openthread/thread.h>
|
||||
|
||||
#include "cli_config.h"
|
||||
@@ -431,6 +432,20 @@ public:
|
||||
*/
|
||||
void OutputSockAddrLine(const otSockAddr &aSockAddr);
|
||||
|
||||
/**
|
||||
* Outputs the Vendor OUI to the CLI console.
|
||||
*
|
||||
* @param[in] aOui A reference to the Vendor OUI.
|
||||
*/
|
||||
void OutputVendorOui(const otThreadVendorOui &aOui);
|
||||
|
||||
/**
|
||||
* Outputs the Vendor OUI to the CLI console and appends a newline.
|
||||
*
|
||||
* @param[in] aOui A reference to the Vendor OUI.
|
||||
*/
|
||||
void OutputVendorOuiLine(const otThreadVendorOui &aOui);
|
||||
|
||||
/**
|
||||
* Outputs DNS TXT data to the CLI console.
|
||||
*
|
||||
@@ -674,24 +689,20 @@ public:
|
||||
static const char *PreferenceToString(signed int aPreference);
|
||||
|
||||
/**
|
||||
* Parses the argument as an IP address.
|
||||
* Parses the argument as an IPv6 address or synthesizes it from an IPv4 address.
|
||||
*
|
||||
* If the argument string is an IPv4 address, this method will try to synthesize an IPv6 address using preferred
|
||||
* NAT64 prefix in the network data.
|
||||
*
|
||||
* @param[in] aInstance A pointer to OpenThread instance.
|
||||
* @param[in] aArg The argument string to parse.
|
||||
* @param[out] aAddress A reference to an `otIp6Address` to output the parsed IPv6 address.
|
||||
* @param[out] aAddress A reference to an `otIp6Address` to output the parsed/synthesized IPv6 address.
|
||||
* @param[out] aSynthesized Whether @p aAddress is synthesized from an IPv4 address.
|
||||
*
|
||||
* @retval OT_ERROR_NONE The argument was parsed successfully.
|
||||
* @retval OT_ERROR_NONE The argument was parsed/synthesized successfully.
|
||||
* @retval OT_ERROR_INVALID_ARGS The argument is empty or does not contain a valid IP address.
|
||||
* @retval OT_ERROR_INVALID_STATE No valid NAT64 prefix in the network data.
|
||||
*/
|
||||
static otError ParseToIp6Address(otInstance *aInstance,
|
||||
const Arg &aArg,
|
||||
otIp6Address &aAddress,
|
||||
bool &aSynthesized);
|
||||
otError ParseOrSynthesizeIp6Address(const Arg &aArg, otIp6Address &aAddress, bool &aSynthesized);
|
||||
|
||||
/**
|
||||
* Parses the argument as a Joiner Discerner.
|
||||
|
||||
+2
-6
@@ -103,10 +103,6 @@ if (openthread_enable_core_config_args) {
|
||||
macro = "OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE"
|
||||
value = openthread_config_dns_client_enable
|
||||
},
|
||||
{
|
||||
macro = "OPENTHREAD_CONFIG_DUA_ENABLE"
|
||||
value = openthread_config_dua_enable
|
||||
},
|
||||
{
|
||||
macro = "OPENTHREAD_CONFIG_ECDSA_ENABLE"
|
||||
value = openthread_config_ecdsa_enable
|
||||
@@ -640,6 +636,8 @@ openthread_core_files = [
|
||||
"net/nd_agent.hpp",
|
||||
"net/netif.cpp",
|
||||
"net/netif.hpp",
|
||||
"net/plat_tcp.cpp",
|
||||
"net/plat_tcp.hpp",
|
||||
"net/slaac_address.cpp",
|
||||
"net/slaac_address.hpp",
|
||||
"net/sntp_client.cpp",
|
||||
@@ -694,8 +692,6 @@ openthread_core_files = [
|
||||
"thread/csl_tx_scheduler.hpp",
|
||||
"thread/discover_scanner.cpp",
|
||||
"thread/discover_scanner.hpp",
|
||||
"thread/dua_manager.cpp",
|
||||
"thread/dua_manager.hpp",
|
||||
"thread/energy_scan_server.cpp",
|
||||
"thread/energy_scan_server.hpp",
|
||||
"thread/indirect_sender.cpp",
|
||||
|
||||
@@ -210,6 +210,7 @@ set(COMMON_SOURCES
|
||||
net/nd6.cpp
|
||||
net/nd_agent.cpp
|
||||
net/netif.cpp
|
||||
net/plat_tcp.cpp
|
||||
net/slaac_address.cpp
|
||||
net/sntp_client.cpp
|
||||
net/socket.cpp
|
||||
@@ -237,7 +238,6 @@ set(COMMON_SOURCES
|
||||
thread/child_table.cpp
|
||||
thread/csl_tx_scheduler.cpp
|
||||
thread/discover_scanner.cpp
|
||||
thread/dua_manager.cpp
|
||||
thread/energy_scan_server.cpp
|
||||
thread/indirect_sender.cpp
|
||||
thread/key_manager.cpp
|
||||
|
||||
@@ -82,18 +82,6 @@ void otBackboneRouterSetRegistrationJitter(otInstance *aInstance, uint8_t aJitte
|
||||
return AsCoreType(aInstance).Get<BackboneRouter::Local>().SetRegistrationJitter(aJitter);
|
||||
}
|
||||
|
||||
otError otBackboneRouterGetDomainPrefix(otInstance *aInstance, otBorderRouterConfig *aConfig)
|
||||
{
|
||||
return AsCoreType(aInstance).Get<BackboneRouter::Local>().GetDomainPrefix(AsCoreType(aConfig));
|
||||
}
|
||||
|
||||
void otBackboneRouterSetDomainPrefixCallback(otInstance *aInstance,
|
||||
otBackboneRouterDomainPrefixCallback aCallback,
|
||||
void *aContext)
|
||||
{
|
||||
return AsCoreType(aInstance).Get<BackboneRouter::Local>().SetDomainPrefixCallback(aCallback, aContext);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE
|
||||
void otBackboneRouterSetMulticastListenerCallback(otInstance *aInstance,
|
||||
otBackboneRouterMulticastListenerCallback aCallback,
|
||||
|
||||
@@ -49,36 +49,12 @@ otError otBorderRouterGetNetData(otInstance *aInstance, bool aStable, uint8_t *a
|
||||
|
||||
otError otBorderRouterAddOnMeshPrefix(otInstance *aInstance, const otBorderRouterConfig *aConfig)
|
||||
{
|
||||
Error error = kErrorNone;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
||||
if (aConfig->mDp)
|
||||
{
|
||||
error = AsCoreType(aInstance).Get<BackboneRouter::Local>().SetDomainPrefix(AsCoreType(aConfig));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
error = AsCoreType(aInstance).Get<NetworkData::Local>().AddOnMeshPrefix(AsCoreType(aConfig));
|
||||
}
|
||||
|
||||
return error;
|
||||
return AsCoreType(aInstance).Get<NetworkData::Local>().AddOnMeshPrefix(AsCoreType(aConfig));
|
||||
}
|
||||
|
||||
otError otBorderRouterRemoveOnMeshPrefix(otInstance *aInstance, const otIp6Prefix *aPrefix)
|
||||
{
|
||||
Error error = kErrorNone;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
||||
error = AsCoreType(aInstance).Get<BackboneRouter::Local>().RemoveDomainPrefix(AsCoreType(aPrefix));
|
||||
|
||||
if (error == kErrorNotFound)
|
||||
#endif
|
||||
{
|
||||
error = AsCoreType(aInstance).Get<NetworkData::Local>().RemoveOnMeshPrefix(AsCoreType(aPrefix));
|
||||
}
|
||||
|
||||
return error;
|
||||
return AsCoreType(aInstance).Get<NetworkData::Local>().RemoveOnMeshPrefix(AsCoreType(aPrefix));
|
||||
}
|
||||
|
||||
otError otBorderRouterGetNextOnMeshPrefix(otInstance *aInstance,
|
||||
|
||||
@@ -64,22 +64,11 @@ void otCryptoAesCcm(const otCryptoKey *aKey,
|
||||
bool aEncrypt,
|
||||
void *aTag)
|
||||
{
|
||||
AesCcm aesCcm;
|
||||
|
||||
AssertPointerIsNotNull(aNonce);
|
||||
AssertPointerIsNotNull(aPlainText);
|
||||
AssertPointerIsNotNull(aCipherText);
|
||||
AssertPointerIsNotNull(aTag);
|
||||
|
||||
aesCcm.SetKey(AsCoreType(aKey));
|
||||
aesCcm.Init(aHeaderLength, aLength, aTagLength, aNonce, aNonceLength);
|
||||
|
||||
if (aHeaderLength != 0)
|
||||
{
|
||||
OT_ASSERT(aHeader != nullptr);
|
||||
aesCcm.Header(aHeader, aHeaderLength);
|
||||
}
|
||||
|
||||
aesCcm.Payload(aPlainText, aCipherText, aLength, aEncrypt ? AesCcm::kEncrypt : AesCcm::kDecrypt);
|
||||
aesCcm.Finalize(aTag);
|
||||
AesCcm::Perform(aEncrypt ? AesCcm::kEncrypt : AesCcm::kDecrypt, AsCoreType(aKey), aTagLength, aNonce, aNonceLength,
|
||||
aHeader, aHeaderLength, aPlainText, aCipherText, aLength, aTag);
|
||||
}
|
||||
|
||||
@@ -60,6 +60,11 @@ otError otMeshDiagGetNextChildInfo(otMeshDiagChildIterator *aIterator, otMeshDia
|
||||
return AsCoreType(aIterator).GetNextChildInfo(AsCoreType(aChildInfo));
|
||||
}
|
||||
|
||||
otError otMeshDiagGetNextTlvInfo(otMeshDiagTlvIterator *aIterator, otMeshDiagTlvInfo *aTlvInfo)
|
||||
{
|
||||
return AsCoreType(aIterator).GetNextTlvInfo(*aTlvInfo);
|
||||
}
|
||||
|
||||
otError otMeshDiagQueryChildTable(otInstance *aInstance,
|
||||
uint16_t aRloc16,
|
||||
otMeshDiagQueryChildTableCallback aCallback,
|
||||
|
||||
@@ -85,7 +85,24 @@ const char *otThreadGetVendorAppUrl(otInstance *aInstance)
|
||||
return AsCoreType(aInstance).Get<VendorInfo>().GetAppUrl();
|
||||
}
|
||||
|
||||
uint32_t otThreadGetVendorOui(otInstance *aInstance) { return AsCoreType(aInstance).Get<VendorInfo>().GetOui(); }
|
||||
void otThreadGetVendorOuiInfo(otInstance *aInstance, otThreadVendorOui *aOui)
|
||||
{
|
||||
AssertPointerIsNotNull(aOui);
|
||||
|
||||
*aOui = AsCoreType(aInstance).Get<VendorInfo>().GetOui();
|
||||
}
|
||||
|
||||
void otThreadVendorOuiToString(const otThreadVendorOui *aOui, char *aBuffer, uint16_t aSize)
|
||||
{
|
||||
AsCoreType(aOui).ToString(aBuffer, aSize);
|
||||
}
|
||||
|
||||
uint32_t otThreadGetVendorOui(otInstance *aInstance)
|
||||
{
|
||||
// This API is deprecated. Use `otThreadGetVendorOuiInfo()` instead
|
||||
|
||||
return AsCoreType(aInstance).Get<VendorInfo>().GetOui().GetAsOui24();
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE
|
||||
|
||||
@@ -109,9 +126,28 @@ otError otThreadSetVendorAppUrl(otInstance *aInstance, const char *aVendorAppUrl
|
||||
return AsCoreType(aInstance).Get<VendorInfo>().SetAppUrl(aVendorAppUrl);
|
||||
}
|
||||
|
||||
otError otThreadSetVendorOuiInfo(otInstance *aInstance, const otThreadVendorOui *aOui)
|
||||
{
|
||||
return AsCoreType(aInstance).Get<VendorInfo>().SetOui(AsCoreType(aOui));
|
||||
}
|
||||
|
||||
otError otThreadSetVendorOui(otInstance *aInstance, uint32_t aVendorOui)
|
||||
{
|
||||
return AsCoreType(aInstance).Get<VendorInfo>().SetOui(aVendorOui);
|
||||
// This API is deprecated, use `otThreadSetVendorOuiInfo()` instead
|
||||
|
||||
Error error;
|
||||
VendorInfo::Oui oui;
|
||||
|
||||
VerifyOrExit(aVendorOui <= 0xffffff, error = kErrorInvalidArgs);
|
||||
|
||||
oui.Clear();
|
||||
oui.mBitLength = 24;
|
||||
BigEndian::WriteUint24(aVendorOui, oui.mBytes);
|
||||
|
||||
error = AsCoreType(aInstance).Get<VendorInfo>().SetOui(oui);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE
|
||||
|
||||
@@ -73,7 +73,7 @@ otError otThreadGetLeaderRloc(otInstance *aInstance, otIp6Address *aLeaderRloc)
|
||||
Error error = kErrorNone;
|
||||
|
||||
VerifyOrExit(!AsCoreType(aInstance).Get<Mle::Mle>().HasRloc16(Mle::kInvalidRloc16), error = kErrorDetached);
|
||||
AsCoreType(aInstance).Get<Mle::Mle>().GetLeaderRloc(AsCoreType(aLeaderRloc));
|
||||
AsCoreType(aInstance).Get<Mle::Mle>().ComposeLeaderRloc(AsCoreType(aLeaderRloc));
|
||||
|
||||
exit:
|
||||
return error;
|
||||
@@ -189,7 +189,7 @@ otError otThreadGetServiceAloc(otInstance *aInstance, uint8_t aServiceId, otIp6A
|
||||
Error error = kErrorNone;
|
||||
|
||||
VerifyOrExit(!AsCoreType(aInstance).Get<Mle::Mle>().HasRloc16(Mle::kInvalidRloc16), error = kErrorDetached);
|
||||
AsCoreType(aInstance).Get<Mle::Mle>().GetServiceAloc(aServiceId, AsCoreType(aServiceAloc));
|
||||
AsCoreType(aInstance).Get<Mle::Mle>().ComposeServiceAloc(aServiceId, AsCoreType(aServiceAloc));
|
||||
|
||||
exit:
|
||||
return error;
|
||||
@@ -238,37 +238,6 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
otError otThreadSetFixedDuaInterfaceIdentifier(otInstance *aInstance, const otIp6InterfaceIdentifier *aIid)
|
||||
{
|
||||
Error error = kErrorNone;
|
||||
|
||||
if (aIid)
|
||||
{
|
||||
error = AsCoreType(aInstance).Get<DuaManager>().SetFixedDuaInterfaceIdentifier(AsCoreType(aIid));
|
||||
}
|
||||
else
|
||||
{
|
||||
AsCoreType(aInstance).Get<DuaManager>().ClearFixedDuaInterfaceIdentifier();
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
const otIp6InterfaceIdentifier *otThreadGetFixedDuaInterfaceIdentifier(otInstance *aInstance)
|
||||
{
|
||||
Instance &instance = AsCoreType(aInstance);
|
||||
const otIp6InterfaceIdentifier *iid = nullptr;
|
||||
|
||||
if (instance.Get<DuaManager>().IsFixedDuaInterfaceIdentifierSet())
|
||||
{
|
||||
iid = &instance.Get<DuaManager>().GetFixedDuaInterfaceIdentifier();
|
||||
}
|
||||
|
||||
return iid;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
|
||||
#endif // (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
|
||||
uint32_t otThreadGetKeySequenceCounter(otInstance *aInstance)
|
||||
|
||||
@@ -152,6 +152,7 @@ uint8_t otThreadGetRouterUpgradeThreshold(otInstance *aInstance)
|
||||
void otThreadSetRouterUpgradeThreshold(otInstance *aInstance, uint8_t aThreshold)
|
||||
{
|
||||
AsCoreType(aInstance).Get<Mle::Mle>().SetRouterUpgradeThreshold(aThreshold);
|
||||
AsCoreType(aInstance).Get<Mle::Mle>().SetLeaderUpgradeThreshold(aThreshold);
|
||||
}
|
||||
|
||||
uint8_t otThreadGetChildRouterLinks(otInstance *aInstance)
|
||||
|
||||
@@ -116,12 +116,10 @@ bool BackboneTmfAgent::IsBackboneTmfMessage(const Ip6::MessageInfo &aMessageInfo
|
||||
// A Backbone TMF message must comply with following rules:
|
||||
// The destination must be one of:
|
||||
// 1. All Network BBRs (Link-Local scope)
|
||||
// 2. All Domain BBRs (Link-Local scope)
|
||||
// 3. A Backbone Link-Local address
|
||||
// 2. A Backbone Link-Local address
|
||||
// The source must be a Backbone Link-local address.
|
||||
return (Get<BackboneRouter::Local>().IsEnabled() && src.IsLinkLocalUnicast() &&
|
||||
(dst.IsLinkLocalUnicast() || dst == Get<BackboneRouter::Local>().GetAllNetworkBackboneRoutersAddress() ||
|
||||
dst == Get<BackboneRouter::Local>().GetAllDomainBackboneRoutersAddress()));
|
||||
(dst.IsLinkLocalUnicast() || dst == Get<BackboneRouter::Local>().GetAllNetworkBackboneRoutersAddress()));
|
||||
}
|
||||
|
||||
void BackboneTmfAgent::SubscribeMulticast(const Ip6::Address &aAddress)
|
||||
|
||||
@@ -90,13 +90,7 @@ Leader::Leader(Instance &aInstance)
|
||||
Reset();
|
||||
}
|
||||
|
||||
void Leader::Reset(void)
|
||||
{
|
||||
mConfig.MarkAsAbsent();
|
||||
|
||||
// Domain Prefix Length 0 indicates no available Domain Prefix in the Thread network.
|
||||
mDomainPrefix.SetLength(0);
|
||||
}
|
||||
void Leader::Reset(void) { mConfig.MarkAsAbsent(); }
|
||||
|
||||
Error Leader::ReadConfig(Config &aConfig) const
|
||||
{
|
||||
@@ -136,18 +130,6 @@ const char *Leader::PrimaryEventToString(PrimaryEvent aEvent)
|
||||
return kStrings[aEvent];
|
||||
}
|
||||
|
||||
const char *Leader::DomainPrefixEventToString(DomainPrefixEvent aEvent)
|
||||
{
|
||||
#define DomainPrefixEventMapList(_) \
|
||||
_(kDomainPrefixAdded, "Added") \
|
||||
_(kDomainPrefixRemoved, "Removed") \
|
||||
_(kDomainPrefixRefreshed, "Refreshed")
|
||||
|
||||
DefineEnumStringArray(DomainPrefixEventMapList);
|
||||
|
||||
return kStrings[aEvent];
|
||||
}
|
||||
|
||||
#endif // OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
|
||||
|
||||
void Leader::HandleNotifierEvents(Events aEvents)
|
||||
@@ -155,7 +137,6 @@ void Leader::HandleNotifierEvents(Events aEvents)
|
||||
if (aEvents.ContainsAny(kEventThreadNetdataChanged | kEventThreadRoleChanged))
|
||||
{
|
||||
UpdateBackboneRouterPrimary();
|
||||
UpdateDomainPrefixConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,64 +189,10 @@ void Leader::UpdateBackboneRouterPrimary(void)
|
||||
Get<Mlr::Manager>().HandleBackboneRouterPrimaryUpdate(event);
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE)
|
||||
Get<DuaManager>().HandleBackboneRouterPrimaryUpdate(event);
|
||||
#endif
|
||||
|
||||
exit:
|
||||
OT_UNUSED_VARIABLE(event);
|
||||
}
|
||||
|
||||
void Leader::UpdateDomainPrefixConfig(void)
|
||||
{
|
||||
NetworkData::Iterator iterator = NetworkData::kIteratorInit;
|
||||
NetworkData::OnMeshPrefixConfig prefixConfig;
|
||||
DomainPrefixEvent event;
|
||||
bool found = false;
|
||||
|
||||
while (Get<NetworkData::Leader>().GetNext(iterator, prefixConfig) == kErrorNone)
|
||||
{
|
||||
if (prefixConfig.mDp)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
VerifyOrExit(HasDomainPrefix());
|
||||
|
||||
mDomainPrefix.Clear();
|
||||
event = kDomainPrefixRemoved;
|
||||
}
|
||||
else
|
||||
{
|
||||
VerifyOrExit(prefixConfig.GetPrefix() != mDomainPrefix);
|
||||
|
||||
event = HasDomainPrefix() ? kDomainPrefixRefreshed : kDomainPrefixAdded;
|
||||
mDomainPrefix = prefixConfig.GetPrefix();
|
||||
}
|
||||
|
||||
LogInfo("%s domain Prefix: %s", DomainPrefixEventToString(event), mDomainPrefix.ToString().AsCString());
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
||||
Get<Local>().HandleDomainPrefixUpdate(event);
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE)
|
||||
Get<DuaManager>().HandleDomainPrefixUpdate(event);
|
||||
#endif
|
||||
|
||||
exit:
|
||||
OT_UNUSED_VARIABLE(event);
|
||||
}
|
||||
|
||||
bool Leader::IsDomainUnicast(const Ip6::Address &aAddress) const
|
||||
{
|
||||
return HasDomainPrefix() && aAddress.MatchesPrefix(mDomainPrefix);
|
||||
}
|
||||
|
||||
} // namespace BackboneRouter
|
||||
} // namespace ot
|
||||
|
||||
|
||||
@@ -67,16 +67,6 @@ static_assert(kDefaultMlrTimeout >= kMinMlrTimeout && kDefaultMlrTimeout <= kMax
|
||||
static_assert(kMaxMlrTimeout * 1000 > kMaxMlrTimeout, "SecToMsec(kMaxMlrTimeout) will overflow");
|
||||
static_assert(kParentAggregateDelay > 1, "kParentAggregateDelay should be larger than 1 second");
|
||||
|
||||
/**
|
||||
* Represents Domain Prefix changes.
|
||||
*/
|
||||
enum DomainPrefixEvent : uint8_t
|
||||
{
|
||||
kDomainPrefixAdded = OT_BACKBONE_ROUTER_DOMAIN_PREFIX_ADDED, ///< Domain Prefix Added.
|
||||
kDomainPrefixRemoved = OT_BACKBONE_ROUTER_DOMAIN_PREFIX_REMOVED, ///< Domain Prefix Removed.
|
||||
kDomainPrefixRefreshed = OT_BACKBONE_ROUTER_DOMAIN_PREFIX_CHANGED, ///< Domain Prefix Changed.
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents Primary Backbone Router events.
|
||||
*/
|
||||
@@ -220,47 +210,18 @@ public:
|
||||
*/
|
||||
bool HasPrimary(void) const { return mConfig.IsPresent(); }
|
||||
|
||||
/**
|
||||
* Gets the Domain Prefix in the Thread Network.
|
||||
*
|
||||
* @retval A pointer to the Domain Prefix or nullptr if there is no Domain Prefix.
|
||||
*/
|
||||
const Ip6::Prefix *GetDomainPrefix(void) const { return HasDomainPrefix() ? &mDomainPrefix : nullptr; }
|
||||
|
||||
/**
|
||||
* Indicates whether or not the Domain Prefix is available in the Thread Network.
|
||||
*
|
||||
* @retval TRUE If there is Domain Prefix.
|
||||
* @retval FALSE If there is no Domain Prefix.
|
||||
*/
|
||||
bool HasDomainPrefix(void) const { return (mDomainPrefix.GetLength() > 0); }
|
||||
|
||||
/**
|
||||
* Indicates whether or not the address is a Domain Unicast Address.
|
||||
*
|
||||
* @param[in] aAddress A reference to the address.
|
||||
*
|
||||
* @retval true @p aAddress is a Domain Unicast Address.
|
||||
* @retval false @p aAddress is not a Domain Unicast Address.
|
||||
*/
|
||||
bool IsDomainUnicast(const Ip6::Address &aAddress) const;
|
||||
|
||||
private:
|
||||
void HandleNotifierEvents(Events aEvents);
|
||||
void UpdateBackboneRouterPrimary(void);
|
||||
void UpdateDomainPrefixConfig(void);
|
||||
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
|
||||
static const char *PrimaryEventToString(PrimaryEvent aEvent);
|
||||
static const char *DomainPrefixEventToString(DomainPrefixEvent aEvent);
|
||||
#endif
|
||||
|
||||
Config mConfig;
|
||||
Ip6::Prefix mDomainPrefix;
|
||||
Config mConfig;
|
||||
};
|
||||
|
||||
} // namespace BackboneRouter
|
||||
|
||||
DefineMapEnum(otBackboneRouterDomainPrefixEvent, BackboneRouter::DomainPrefixEvent);
|
||||
DefineCoreType(otBackboneRouterConfig, BackboneRouter::Config);
|
||||
|
||||
} // namespace ot
|
||||
|
||||
@@ -53,11 +53,8 @@ Local::Local(Instance &aInstance)
|
||||
, mRegistrationTimeout(0)
|
||||
, mMlrTimeout(kDefaultMlrTimeout)
|
||||
{
|
||||
mDomainPrefixConfig.GetPrefix().SetLength(0);
|
||||
|
||||
// Primary Backbone Router Aloc
|
||||
mBbrPrimaryAloc.InitAsThreadOriginMeshLocal();
|
||||
mBbrPrimaryAloc.GetAddress().GetIid().InitAsLocator(Mle::Aloc16::ForPrimaryBackboneRouter());
|
||||
|
||||
// All Network Backbone Routers Multicast Address.
|
||||
mAllNetworkBackboneRouters.Clear();
|
||||
@@ -65,13 +62,6 @@ Local::Local(Instance &aInstance)
|
||||
mAllNetworkBackboneRouters.mFields.m8[0] = 0xff; // Multicast
|
||||
mAllNetworkBackboneRouters.mFields.m8[1] = 0x32; // Flags = 3, Scope = 2
|
||||
mAllNetworkBackboneRouters.mFields.m8[15] = 3; // Group ID = 3
|
||||
|
||||
// All Domain Backbone Routers Multicast Address.
|
||||
mAllDomainBackboneRouters.Clear();
|
||||
|
||||
mAllDomainBackboneRouters.mFields.m8[0] = 0xff; // Multicast
|
||||
mAllDomainBackboneRouters.mFields.m8[1] = 0x32; // Flags = 3, Scope = 2
|
||||
mAllDomainBackboneRouters.mFields.m8[15] = 3; // Group ID = 3
|
||||
}
|
||||
|
||||
void Local::SetEnabled(bool aEnable)
|
||||
@@ -81,12 +71,10 @@ void Local::SetEnabled(bool aEnable)
|
||||
if (aEnable)
|
||||
{
|
||||
SetState(kStateSecondary);
|
||||
AddDomainPrefixToNetworkData();
|
||||
IgnoreError(AddService(kDecideBasedOnState));
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveDomainPrefixFromNetworkData();
|
||||
RemoveService();
|
||||
SetState(kStateDisabled);
|
||||
}
|
||||
@@ -225,7 +213,7 @@ void Local::SetState(State aState)
|
||||
if (aState == kStatePrimary)
|
||||
{
|
||||
// Add Primary Backbone Router ALOC for Primary Backbone Router.
|
||||
mBbrPrimaryAloc.GetAddress().SetPrefix(Get<Mle::Mle>().GetMeshLocalPrefix());
|
||||
Get<Mle::Mle>().ComposeAloc(Mle::Aloc16::ForPrimaryBackboneRouter(), mBbrPrimaryAloc.GetAddress());
|
||||
Get<ThreadNetif>().AddUnicastAddress(mBbrPrimaryAloc);
|
||||
}
|
||||
|
||||
@@ -318,59 +306,6 @@ exit:
|
||||
}
|
||||
}
|
||||
|
||||
Error Local::GetDomainPrefix(NetworkData::OnMeshPrefixConfig &aConfig)
|
||||
{
|
||||
Error error = kErrorNone;
|
||||
|
||||
VerifyOrExit(mDomainPrefixConfig.GetPrefix().GetLength() > 0, error = kErrorNotFound);
|
||||
|
||||
aConfig = mDomainPrefixConfig;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
Error Local::RemoveDomainPrefix(const Ip6::Prefix &aPrefix)
|
||||
{
|
||||
Error error = kErrorNone;
|
||||
|
||||
VerifyOrExit(aPrefix.GetLength() > 0, error = kErrorInvalidArgs);
|
||||
VerifyOrExit(mDomainPrefixConfig.GetPrefix() == aPrefix, error = kErrorNotFound);
|
||||
|
||||
if (IsEnabled())
|
||||
{
|
||||
RemoveDomainPrefixFromNetworkData();
|
||||
}
|
||||
|
||||
mDomainPrefixConfig.GetPrefix().SetLength(0);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
Error Local::SetDomainPrefix(const NetworkData::OnMeshPrefixConfig &aConfig)
|
||||
{
|
||||
Error error = kErrorNone;
|
||||
|
||||
VerifyOrExit(aConfig.IsValid(GetInstance()), error = kErrorInvalidArgs);
|
||||
|
||||
if (IsEnabled())
|
||||
{
|
||||
RemoveDomainPrefixFromNetworkData();
|
||||
}
|
||||
|
||||
mDomainPrefixConfig = aConfig;
|
||||
LogDomainPrefix(kActionSet, kErrorNone);
|
||||
|
||||
if (IsEnabled())
|
||||
{
|
||||
AddDomainPrefixToNetworkData();
|
||||
}
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void Local::ApplyNewMeshLocalPrefix(void)
|
||||
{
|
||||
VerifyOrExit(IsEnabled());
|
||||
@@ -383,40 +318,6 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
void Local::HandleDomainPrefixUpdate(DomainPrefixEvent aEvent)
|
||||
{
|
||||
VerifyOrExit(IsEnabled());
|
||||
|
||||
if (aEvent == kDomainPrefixRemoved || aEvent == kDomainPrefixRefreshed)
|
||||
{
|
||||
Get<BackboneTmfAgent>().UnsubscribeMulticast(mAllDomainBackboneRouters);
|
||||
}
|
||||
|
||||
if (aEvent == kDomainPrefixAdded || aEvent == kDomainPrefixRefreshed)
|
||||
{
|
||||
mAllDomainBackboneRouters.SetMulticastNetworkPrefix(*Get<Leader>().GetDomainPrefix());
|
||||
Get<BackboneTmfAgent>().SubscribeMulticast(mAllDomainBackboneRouters);
|
||||
}
|
||||
|
||||
mDomainPrefixCallback.InvokeIfSet(static_cast<otBackboneRouterDomainPrefixEvent>(aEvent),
|
||||
Get<Leader>().GetDomainPrefix());
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
void Local::RemoveDomainPrefixFromNetworkData(void)
|
||||
{
|
||||
Error error = kErrorNotFound; // only used for logging.
|
||||
|
||||
if (mDomainPrefixConfig.mPrefix.mLength > 0)
|
||||
{
|
||||
error = Get<NetworkData::Local>().RemoveOnMeshPrefix(mDomainPrefixConfig.GetPrefix());
|
||||
}
|
||||
|
||||
LogDomainPrefix(kActionRemove, error);
|
||||
}
|
||||
|
||||
void Local::IncrementSequenceNumber(void)
|
||||
{
|
||||
switch (mSequenceNumber)
|
||||
@@ -435,18 +336,6 @@ void Local::IncrementSequenceNumber(void)
|
||||
}
|
||||
}
|
||||
|
||||
void Local::AddDomainPrefixToNetworkData(void)
|
||||
{
|
||||
Error error = kErrorNotFound; // only used for logging.
|
||||
|
||||
if (mDomainPrefixConfig.GetPrefix().GetLength() > 0)
|
||||
{
|
||||
error = Get<NetworkData::Local>().AddOnMeshPrefix(mDomainPrefixConfig);
|
||||
}
|
||||
|
||||
LogDomainPrefix(kActionAdd, error);
|
||||
}
|
||||
|
||||
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
|
||||
|
||||
const char *Local::ActionToString(Action aAction)
|
||||
@@ -461,12 +350,6 @@ const char *Local::ActionToString(Action aAction)
|
||||
return kStrings[aAction];
|
||||
}
|
||||
|
||||
void Local::LogDomainPrefix(Action aAction, Error aError)
|
||||
{
|
||||
LogInfo("%s Domain Prefix: %s, %s", ActionToString(aAction), mDomainPrefixConfig.GetPrefix().ToString().AsCString(),
|
||||
ErrorToString(aError));
|
||||
}
|
||||
|
||||
void Local::LogService(Action aAction, Error aError)
|
||||
{
|
||||
LogInfo("%s BBR Service: seqno (%u), delay (%us), timeout (%lus), %s", ActionToString(aAction), mSequenceNumber,
|
||||
|
||||
@@ -77,8 +77,6 @@ class Local : public InstanceLocator, private NonCopyable
|
||||
friend class ot::Notifier;
|
||||
|
||||
public:
|
||||
typedef otBackboneRouterDomainPrefixCallback DomainPrefixCallback; ///< Domain Prefix callback.
|
||||
|
||||
/**
|
||||
* Represents Backbone Router state.
|
||||
*/
|
||||
@@ -190,37 +188,6 @@ public:
|
||||
*/
|
||||
void HandleBackboneRouterPrimaryUpdate(PrimaryEvent aEvent);
|
||||
|
||||
/**
|
||||
* Gets the Domain Prefix configuration.
|
||||
*
|
||||
* @param[out] aConfig A reference to the Domain Prefix configuration.
|
||||
*
|
||||
* @retval kErrorNone Successfully got the Domain Prefix configuration.
|
||||
* @retval kErrorNotFound No Domain Prefix was configured.
|
||||
*/
|
||||
Error GetDomainPrefix(NetworkData::OnMeshPrefixConfig &aConfig);
|
||||
|
||||
/**
|
||||
* Removes the local Domain Prefix configuration.
|
||||
*
|
||||
* @param[in] aPrefix A reference to the IPv6 Domain Prefix.
|
||||
*
|
||||
* @retval kErrorNone Successfully removed the Domain Prefix.
|
||||
* @retval kErrorInvalidArgs @p aPrefix is invalid.
|
||||
* @retval kErrorNotFound No Domain Prefix was configured or @p aPrefix doesn't match.
|
||||
*/
|
||||
Error RemoveDomainPrefix(const Ip6::Prefix &aPrefix);
|
||||
|
||||
/**
|
||||
* Sets the local Domain Prefix configuration.
|
||||
*
|
||||
* @param[in] aConfig A reference to the Domain Prefix configuration.
|
||||
*
|
||||
* @returns kErrorNone Successfully set the local Domain Prefix.
|
||||
* @returns kErrorInvalidArgs @p aConfig is invalid.
|
||||
*/
|
||||
Error SetDomainPrefix(const NetworkData::OnMeshPrefixConfig &aConfig);
|
||||
|
||||
/**
|
||||
* Returns a reference to the All Network Backbone Routers Multicast Address.
|
||||
*
|
||||
@@ -228,36 +195,11 @@ public:
|
||||
*/
|
||||
const Ip6::Address &GetAllNetworkBackboneRoutersAddress(void) const { return mAllNetworkBackboneRouters; }
|
||||
|
||||
/**
|
||||
* Returns a reference to the All Domain Backbone Routers Multicast Address.
|
||||
*
|
||||
* @returns A reference to the All Domain Backbone Routers Multicast Address.
|
||||
*/
|
||||
const Ip6::Address &GetAllDomainBackboneRoutersAddress(void) const { return mAllDomainBackboneRouters; }
|
||||
|
||||
/**
|
||||
* Applies the Mesh Local Prefix.
|
||||
*/
|
||||
void ApplyNewMeshLocalPrefix(void);
|
||||
|
||||
/**
|
||||
* Updates the subscription of All Domain Backbone Routers Multicast Address.
|
||||
*
|
||||
* @param[in] aEvent The Domain Prefix event.
|
||||
*/
|
||||
void HandleDomainPrefixUpdate(DomainPrefixEvent aEvent);
|
||||
|
||||
/**
|
||||
* Sets the Domain Prefix callback.
|
||||
*
|
||||
* @param[in] aCallback The callback function.
|
||||
* @param[in] aContext A user context pointer.
|
||||
*/
|
||||
void SetDomainPrefixCallback(DomainPrefixCallback aCallback, void *aContext)
|
||||
{
|
||||
mDomainPrefixCallback.Set(aCallback, aContext);
|
||||
}
|
||||
|
||||
private:
|
||||
enum Action : uint8_t
|
||||
{
|
||||
@@ -271,33 +213,26 @@ private:
|
||||
void UpdateState(void);
|
||||
void RemoveService(void);
|
||||
void HandleTimeTick(void);
|
||||
void AddDomainPrefixToNetworkData(void);
|
||||
void RemoveDomainPrefixFromNetworkData(void);
|
||||
void IncrementSequenceNumber(void);
|
||||
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
|
||||
static const char *ActionToString(Action aAction);
|
||||
void LogService(Action aAction, Error aError);
|
||||
void LogDomainPrefix(Action aAction, Error aError);
|
||||
#else
|
||||
void LogService(Action, Error) {}
|
||||
void LogDomainPrefix(Action, Error) {}
|
||||
#endif
|
||||
|
||||
// Indicates whether or not already add Backbone Router Service to local server data.
|
||||
// Used to check whether or not in restore stage after reset or whether to remove
|
||||
// Backbone Router service for Secondary Backbone Router if it was added by force.
|
||||
bool mIsServiceAdded;
|
||||
State mState;
|
||||
uint8_t mSequenceNumber;
|
||||
uint8_t mRegistrationJitter;
|
||||
uint16_t mReregistrationDelay;
|
||||
uint16_t mRegistrationTimeout;
|
||||
uint32_t mMlrTimeout;
|
||||
NetworkData::OnMeshPrefixConfig mDomainPrefixConfig;
|
||||
Ip6::Netif::UnicastAddress mBbrPrimaryAloc;
|
||||
Ip6::Address mAllNetworkBackboneRouters;
|
||||
Ip6::Address mAllDomainBackboneRouters;
|
||||
Callback<DomainPrefixCallback> mDomainPrefixCallback;
|
||||
bool mIsServiceAdded;
|
||||
State mState;
|
||||
uint8_t mSequenceNumber;
|
||||
uint8_t mRegistrationJitter;
|
||||
uint16_t mReregistrationDelay;
|
||||
uint16_t mRegistrationTimeout;
|
||||
uint32_t mMlrTimeout;
|
||||
Ip6::Netif::UnicastAddress mBbrPrimaryAloc;
|
||||
Ip6::Address mAllNetworkBackboneRouters;
|
||||
};
|
||||
|
||||
} // namespace BackboneRouter
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
#include "common/locator.hpp"
|
||||
#include "common/non_copyable.hpp"
|
||||
#include "net/netif.hpp"
|
||||
#include "thread/dua_manager.hpp"
|
||||
#include "thread/mlr_types.hpp"
|
||||
#include "thread/network_data.hpp"
|
||||
#include "thread/tmf.hpp"
|
||||
|
||||
@@ -284,16 +284,14 @@ bool FavoredOmrPrefix::IsInfrastructureDerived(void) const
|
||||
|
||||
void FavoredOmrPrefix::SetFrom(const NetworkData::OnMeshPrefixConfig &aOnMeshPrefixConfig)
|
||||
{
|
||||
mPrefix = aOnMeshPrefixConfig.GetPrefix();
|
||||
mPreference = aOnMeshPrefixConfig.GetPreference();
|
||||
mIsDomainPrefix = aOnMeshPrefixConfig.mDp;
|
||||
mPrefix = aOnMeshPrefixConfig.GetPrefix();
|
||||
mPreference = aOnMeshPrefixConfig.GetPreference();
|
||||
}
|
||||
|
||||
void FavoredOmrPrefix::SetFrom(const OmrPrefix &aOmrPrefix)
|
||||
{
|
||||
mPrefix = aOmrPrefix.GetPrefix();
|
||||
mPreference = aOmrPrefix.GetPreference();
|
||||
mIsDomainPrefix = aOmrPrefix.IsDomainPrefix();
|
||||
mPrefix = aOmrPrefix.GetPrefix();
|
||||
mPreference = aOmrPrefix.GetPreference();
|
||||
}
|
||||
|
||||
bool FavoredOmrPrefix::IsFavoredOver(const NetworkData::OnMeshPrefixConfig &aOmrPrefixConfig) const
|
||||
|
||||
@@ -569,20 +569,6 @@ public:
|
||||
*/
|
||||
RoutePreference GetPreference(void) const { return mPreference; }
|
||||
|
||||
/**
|
||||
* Indicates whether the OMR prefix is a domain prefix.
|
||||
*
|
||||
* @retval TRUE If the OMR prefix is a domain prefix.
|
||||
* @retval FALSE If the OMR prefix is not a domain prefix.
|
||||
*/
|
||||
bool IsDomainPrefix(void) const { return mIsDomainPrefix; }
|
||||
|
||||
/**
|
||||
* Sets the OMR prefix and its preference.
|
||||
*
|
||||
* @param[in] aPrefix The IPv6 prefix to set.
|
||||
* @param[in] aPreference The preference to set.
|
||||
*/
|
||||
void SetPrefix(const Ip6::Prefix &aPrefix, RoutePreference aPreference);
|
||||
|
||||
/**
|
||||
@@ -599,7 +585,6 @@ public:
|
||||
protected:
|
||||
Ip6::Prefix mPrefix;
|
||||
RoutePreference mPreference;
|
||||
bool mIsDomainPrefix;
|
||||
};
|
||||
|
||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -107,25 +107,25 @@ Error InfraIf::Send(const Icmp6Packet &aPacket, const Ip6::Address &aDestination
|
||||
|
||||
void InfraIf::HandledReceived(uint32_t aIfIndex, const Ip6::Address &aSource, const Icmp6Packet &aPacket)
|
||||
{
|
||||
Error error = kErrorNone;
|
||||
const Ip6::Icmp::Header *icmp6Header;
|
||||
Error error = kErrorNone;
|
||||
const Ip6::Icmp6Header *icmp6Header;
|
||||
|
||||
VerifyOrExit(mInitialized && mIsRunning, error = kErrorInvalidState);
|
||||
VerifyOrExit(aIfIndex == mIfIndex, error = kErrorDrop);
|
||||
VerifyOrExit(aPacket.GetBytes() != nullptr, error = kErrorInvalidArgs);
|
||||
VerifyOrExit(aPacket.GetLength() >= sizeof(Ip6::Icmp::Header), error = kErrorParse);
|
||||
VerifyOrExit(aPacket.GetLength() >= sizeof(Ip6::Icmp6Header), error = kErrorParse);
|
||||
|
||||
icmp6Header = reinterpret_cast<const Ip6::Icmp::Header *>(aPacket.GetBytes());
|
||||
icmp6Header = reinterpret_cast<const Ip6::Icmp6Header *>(aPacket.GetBytes());
|
||||
|
||||
switch (icmp6Header->GetType())
|
||||
{
|
||||
case Ip6::Icmp::Header::kTypeRouterAdvert:
|
||||
case Ip6::Icmp6Header::kTypeRouterAdvert:
|
||||
Get<RxRaTracker>().HandleRouterAdvertisement(aPacket, aSource);
|
||||
break;
|
||||
case Ip6::Icmp::Header::kTypeNeighborAdvert:
|
||||
case Ip6::Icmp6Header::kTypeNeighborAdvert:
|
||||
Get<RxRaTracker>().HandleNeighborAdvertisement(aPacket);
|
||||
break;
|
||||
case Ip6::Icmp::Header::kTypeRouterSolicit:
|
||||
case Ip6::Icmp6Header::kTypeRouterSolicit:
|
||||
Get<RoutingManager>().HandleRouterSolicit(aPacket, aSource);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -706,8 +706,8 @@ void RoutingManager::CheckReachabilityToSendIcmpError(const Message &aMessage, c
|
||||
messageInfo.Clear();
|
||||
messageInfo.SetPeerAddr(aIp6Header.GetSource());
|
||||
|
||||
IgnoreError(Get<Ip6::Icmp>().SendError(Ip6::Icmp::Header::kTypeDstUnreach,
|
||||
Ip6::Icmp::Header::kCodeDstUnreachProhibited, messageInfo, aMessage));
|
||||
IgnoreError(Get<Ip6::Icmp>().SendError(Ip6::Icmp6Header::kTypeDstUnreach,
|
||||
Ip6::Icmp6Header::kCodeDstUnreachProhibited, messageInfo, aMessage));
|
||||
|
||||
exit:
|
||||
return;
|
||||
@@ -1169,11 +1169,6 @@ RoutingManager::OmrPrefixManager::InfoString RoutingManager::OmrPrefixManager::F
|
||||
string.Append("%s (prf:%s", aFavoredPrefix.GetPrefix().ToString().AsCString(),
|
||||
RoutePreferenceToString(aFavoredPrefix.GetPreference()));
|
||||
|
||||
if (aFavoredPrefix.IsDomainPrefix())
|
||||
{
|
||||
string.Append(", domain");
|
||||
}
|
||||
|
||||
if (aFavoredPrefix.GetPrefix() == mLocalPrefix.GetPrefix())
|
||||
{
|
||||
string.Append(", local");
|
||||
@@ -1909,7 +1904,7 @@ Error RoutingManager::RioAdvertiser::AppendRios(RouterAdvert::TxMessage &aRaMess
|
||||
|
||||
// (2) Favored OMR prefix.
|
||||
|
||||
if (!omrPrefixManager.GetFavoredPrefix().IsEmpty() && !omrPrefixManager.GetFavoredPrefix().IsDomainPrefix())
|
||||
if (!omrPrefixManager.GetFavoredPrefix().IsEmpty())
|
||||
{
|
||||
mPrefixes.Add(omrPrefixManager.GetFavoredPrefix().GetPrefix());
|
||||
}
|
||||
@@ -1928,11 +1923,6 @@ Error RoutingManager::RioAdvertiser::AppendRios(RouterAdvert::TxMessage &aRaMess
|
||||
// it, while it might still be present in the Network Data due to
|
||||
// delays in registering changes with the leader.
|
||||
|
||||
if (prefixConfig.mDp)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IsValidOmrPrefix(prefixConfig) &&
|
||||
(prefixConfig.GetPrefix() != omrPrefixManager.GetLocalPrefix().GetPrefix()))
|
||||
{
|
||||
@@ -1940,13 +1930,13 @@ Error RoutingManager::RioAdvertiser::AppendRios(RouterAdvert::TxMessage &aRaMess
|
||||
}
|
||||
}
|
||||
|
||||
// (4) All other on-mesh prefixes (excluding Domain Prefix).
|
||||
// (4) All other on-mesh prefixes.
|
||||
|
||||
iterator = NetworkData::kIteratorInit;
|
||||
|
||||
while (Get<NetworkData::Leader>().GetNext(iterator, prefixConfig) == kErrorNone)
|
||||
{
|
||||
if (prefixConfig.mOnMesh && !prefixConfig.mDp && !IsValidOmrPrefix(prefixConfig))
|
||||
if (prefixConfig.mOnMesh && !IsValidOmrPrefix(prefixConfig))
|
||||
{
|
||||
mPrefixes.Add(prefixConfig.GetPrefix());
|
||||
}
|
||||
|
||||
@@ -491,6 +491,34 @@ public:
|
||||
return FindMatching(aIndicator) != nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Counts the number of elements in the array matching a given indicator.
|
||||
*
|
||||
* The template type `Indicator` specifies the type of @p aIndicator object which is used to match against elements
|
||||
* in the array. To check that an element matches the given indicator, the `Matches()` method is invoked on each
|
||||
* `Type` element in the array. The `Matches()` method should be provided by `Type` class accordingly:
|
||||
*
|
||||
* bool Type::Matches(const Indicator &aIndicator) const
|
||||
*
|
||||
* @param[in] aIndicator An indicator to match with elements in the array.
|
||||
*
|
||||
* @returns The number of elements in the array matching @p aIndicator.
|
||||
*/
|
||||
template <typename Indicator> SizeType CountMatching(const Indicator &aIndicator) const
|
||||
{
|
||||
SizeType count = 0;
|
||||
|
||||
for (const Type &element : *this)
|
||||
{
|
||||
if (element.Matches(aIndicator))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the first element in the array matching a given indicator.
|
||||
*
|
||||
@@ -572,17 +600,17 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether a given entry pointer is from the array buffer.
|
||||
* Indicates whether a given pointer is from the array buffer.
|
||||
*
|
||||
* Does not check the current length of array and only checks that @p aEntry is pointing to an address
|
||||
* contained within underlying C array buffer.
|
||||
*
|
||||
* @param[in] aEntry A pointer to an entry to check.
|
||||
* @param[in] aEntry A pointer to check.
|
||||
*
|
||||
* @retval TRUE The @p aEntry is from the array.
|
||||
* @retval FALSE The @p aEntry is not from the array.
|
||||
*/
|
||||
bool IsInArrayBuffer(const Type *aEntry) const
|
||||
bool IsInArrayBuffer(const void *aEntry) const
|
||||
{
|
||||
return (&mElements[0] <= aEntry) && (aEntry < GetArrayEnd(mElements));
|
||||
}
|
||||
|
||||
@@ -427,6 +427,38 @@ template <> inline void Write(uint64_t aValue, uint8_t *aBuffer) { WriteUint64(a
|
||||
|
||||
} // namespace LittleEndian
|
||||
|
||||
/**
|
||||
* Represents the byte ordering (endianness) encoding.
|
||||
*/
|
||||
enum Encoding : uint8_t
|
||||
{
|
||||
kBigEndian, ///< Big-endian.
|
||||
kLittleEndian, ///< Little-endian.
|
||||
};
|
||||
|
||||
/**
|
||||
* Swaps the byte order of a given integer value from the host representation to the specified encoding,
|
||||
* or vice-versa.
|
||||
*
|
||||
* @tparam kEncoding The target encoding (big or little endian).
|
||||
* @tparam UintType The unsigned integer type.
|
||||
*
|
||||
* @param[in] aValue The value to swap.
|
||||
*
|
||||
* @returns The swapped value.
|
||||
*/
|
||||
template <Encoding kEncoding, typename UintType> UintType HostSwap(UintType aValue);
|
||||
|
||||
template <> inline uint8_t HostSwap<kBigEndian>(uint8_t aValue) { return aValue; }
|
||||
template <> inline uint16_t HostSwap<kBigEndian>(uint16_t aValue) { return BigEndian::HostSwap16(aValue); }
|
||||
template <> inline uint32_t HostSwap<kBigEndian>(uint32_t aValue) { return BigEndian::HostSwap32(aValue); }
|
||||
template <> inline uint64_t HostSwap<kBigEndian>(uint64_t aValue) { return BigEndian::HostSwap64(aValue); }
|
||||
|
||||
template <> inline uint8_t HostSwap<kLittleEndian>(uint8_t aValue) { return aValue; }
|
||||
template <> inline uint16_t HostSwap<kLittleEndian>(uint16_t aValue) { return LittleEndian::HostSwap16(aValue); }
|
||||
template <> inline uint32_t HostSwap<kLittleEndian>(uint32_t aValue) { return LittleEndian::HostSwap32(aValue); }
|
||||
template <> inline uint64_t HostSwap<kLittleEndian>(uint64_t aValue) { return LittleEndian::HostSwap64(aValue); }
|
||||
|
||||
} // namespace ot
|
||||
|
||||
#endif // OT_CORE_COMMON_ENCODING_HPP_
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "common/code_utils.hpp"
|
||||
#include "common/debug.hpp"
|
||||
#include "common/encoding.hpp"
|
||||
#include "common/type_traits.hpp"
|
||||
|
||||
#if OPENTHREAD_FTD || OPENTHREAD_MTD
|
||||
#include "common/message.hpp"
|
||||
@@ -54,19 +55,19 @@ void FrameBuilder::Init(void *aBuffer, uint16_t aMaxLength)
|
||||
|
||||
Error FrameBuilder::AppendUint8(uint8_t aUint8) { return Append<uint8_t>(aUint8); }
|
||||
|
||||
Error FrameBuilder::AppendBigEndianUint16(uint16_t aUint16) { return Append<uint16_t>(BigEndian::HostSwap16(aUint16)); }
|
||||
|
||||
Error FrameBuilder::AppendBigEndianUint32(uint32_t aUint32) { return Append<uint32_t>(BigEndian::HostSwap32(aUint32)); }
|
||||
|
||||
Error FrameBuilder::AppendLittleEndianUint16(uint16_t aUint16)
|
||||
template <Encoding kEncoding, typename UintType> Error FrameBuilder::AppendUint(UintType aUint)
|
||||
{
|
||||
return Append<uint16_t>(LittleEndian::HostSwap16(aUint16));
|
||||
static_assert(TypeTraits::IsUint<UintType>::kValue, "UintType is not valid, it must be an unsigned int");
|
||||
|
||||
return Append<UintType>(HostSwap<kEncoding>(aUint));
|
||||
}
|
||||
|
||||
Error FrameBuilder::AppendLittleEndianUint32(uint32_t aUint32)
|
||||
{
|
||||
return Append<uint32_t>(LittleEndian::HostSwap32(aUint32));
|
||||
}
|
||||
template Error FrameBuilder::AppendUint<kBigEndian, uint16_t>(uint16_t aUint);
|
||||
template Error FrameBuilder::AppendUint<kBigEndian, uint32_t>(uint32_t aUint);
|
||||
template Error FrameBuilder::AppendUint<kBigEndian, uint64_t>(uint64_t aUint);
|
||||
template Error FrameBuilder::AppendUint<kLittleEndian, uint16_t>(uint16_t aUint);
|
||||
template Error FrameBuilder::AppendUint<kLittleEndian, uint32_t>(uint32_t aUint);
|
||||
template Error FrameBuilder::AppendUint<kLittleEndian, uint64_t>(uint64_t aUint);
|
||||
|
||||
Error FrameBuilder::AppendBytes(const void *aBuffer, uint16_t aLength)
|
||||
{
|
||||
@@ -90,7 +91,7 @@ Error FrameBuilder::AppendMacAddress(const Mac::Address &aMacAddress)
|
||||
break;
|
||||
|
||||
case Mac::Address::kTypeShort:
|
||||
error = AppendLittleEndianUint16(aMacAddress.GetShort());
|
||||
error = AppendUint<kLittleEndian>(aMacAddress.GetShort());
|
||||
break;
|
||||
|
||||
case Mac::Address::kTypeExtended:
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "openthread-core-config.h"
|
||||
|
||||
#include "common/encoding.hpp"
|
||||
#include "common/error.hpp"
|
||||
#include "common/type_traits.hpp"
|
||||
#include "mac/mac_types.hpp"
|
||||
@@ -119,44 +120,19 @@ public:
|
||||
Error AppendUint8(uint8_t aUint8);
|
||||
|
||||
/**
|
||||
* Appends an `uint16_t` value assuming big endian encoding to the `FrameBuilder`.
|
||||
* Appends an integer value with a specified encoding to the `FrameBuilder`.
|
||||
*
|
||||
* @param[in] aUint16 The `uint16_t` value to append.
|
||||
* The value is converted to the specified @p kEncoding byte order before being appended.
|
||||
*
|
||||
* @tparam kEncoding The encoding to use (big or little endian).
|
||||
* @tparam UintType The unsigned integer type.
|
||||
*
|
||||
* @param[in] aUint The integer value to append.
|
||||
*
|
||||
* @retval kErrorNone Successfully appended the value.
|
||||
* @retval kErrorNoBufs Insufficient available buffers.
|
||||
*/
|
||||
Error AppendBigEndianUint16(uint16_t aUint16);
|
||||
|
||||
/**
|
||||
* Appends an `uint32_t` value assuming big endian encoding to the `FrameBuilder`.
|
||||
*
|
||||
* @param[in] aUint32 The `uint32_t` value to append.
|
||||
*
|
||||
* @retval kErrorNone Successfully appended the value.
|
||||
* @retval kErrorNoBufs Insufficient available buffers.
|
||||
*/
|
||||
Error AppendBigEndianUint32(uint32_t aUint32);
|
||||
|
||||
/**
|
||||
* Appends an `uint16_t` value assuming little endian encoding to the `FrameBuilder`.
|
||||
*
|
||||
* @param[in] aUint16 The `uint16_t` value to append.
|
||||
*
|
||||
* @retval kErrorNone Successfully appended the value.
|
||||
* @retval kErrorNoBufs Insufficient available buffers.
|
||||
*/
|
||||
Error AppendLittleEndianUint16(uint16_t aUint16);
|
||||
|
||||
/**
|
||||
* Appends an `uint32_t` value assuming little endian encoding to the `FrameBuilder`.
|
||||
*
|
||||
* @param[in] aUint32 The `uint32_t` value to append.
|
||||
*
|
||||
* @retval kErrorNone Successfully appended the value.
|
||||
* @retval kErrorNoBufs Insufficient available buffers.
|
||||
*/
|
||||
Error AppendLittleEndianUint32(uint32_t aUint32);
|
||||
template <Encoding kEncoding, typename UintType> Error AppendUint(UintType aUint);
|
||||
|
||||
/**
|
||||
* Appends bytes from a given buffer to the `FrameBuilder`.
|
||||
|
||||
@@ -40,49 +40,25 @@ namespace ot {
|
||||
|
||||
Error FrameData::ReadUint8(uint8_t &aUint8) { return ReadBytes(&aUint8, sizeof(uint8_t)); }
|
||||
|
||||
Error FrameData::ReadBigEndianUint16(uint16_t &aUint16)
|
||||
template <Encoding kEncoding, typename UintType> Error FrameData::ReadUint(UintType &aUint)
|
||||
{
|
||||
Error error;
|
||||
|
||||
SuccessOrExit(error = ReadBytes(&aUint16, sizeof(uint16_t)));
|
||||
aUint16 = BigEndian::HostSwap16(aUint16);
|
||||
static_assert(TypeTraits::IsUint<UintType>::kValue, "UintType is not valid, it must be an unsigned int");
|
||||
|
||||
SuccessOrExit(error = ReadBytes(&aUint, sizeof(UintType)));
|
||||
aUint = HostSwap<kEncoding>(aUint);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
Error FrameData::ReadBigEndianUint32(uint32_t &aUint32)
|
||||
{
|
||||
Error error;
|
||||
|
||||
SuccessOrExit(error = ReadBytes(&aUint32, sizeof(uint32_t)));
|
||||
aUint32 = BigEndian::HostSwap32(aUint32);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
Error FrameData::ReadLittleEndianUint16(uint16_t &aUint16)
|
||||
{
|
||||
Error error;
|
||||
|
||||
SuccessOrExit(error = ReadBytes(&aUint16, sizeof(uint16_t)));
|
||||
aUint16 = LittleEndian::HostSwap16(aUint16);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
Error FrameData::ReadLittleEndianUint32(uint32_t &aUint32)
|
||||
{
|
||||
Error error;
|
||||
|
||||
SuccessOrExit(error = ReadBytes(&aUint32, sizeof(uint32_t)));
|
||||
aUint32 = LittleEndian::HostSwap32(aUint32);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
template Error FrameData::ReadUint<kBigEndian, uint16_t>(uint16_t &aUint);
|
||||
template Error FrameData::ReadUint<kBigEndian, uint32_t>(uint32_t &aUint);
|
||||
template Error FrameData::ReadUint<kBigEndian, uint64_t>(uint64_t &aUint);
|
||||
template Error FrameData::ReadUint<kLittleEndian, uint16_t>(uint16_t &aUint);
|
||||
template Error FrameData::ReadUint<kLittleEndian, uint32_t>(uint32_t &aUint);
|
||||
template Error FrameData::ReadUint<kLittleEndian, uint64_t>(uint64_t &aUint);
|
||||
|
||||
Error FrameData::ReadBytes(void *aBuffer, uint16_t aLength)
|
||||
{
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "openthread-core-config.h"
|
||||
|
||||
#include "common/data.hpp"
|
||||
#include "common/encoding.hpp"
|
||||
#include "common/type_traits.hpp"
|
||||
|
||||
namespace ot {
|
||||
@@ -74,52 +75,22 @@ public:
|
||||
Error ReadUint8(uint8_t &aUint8);
|
||||
|
||||
/**
|
||||
* Reads an `uint16_t` value assuming big endian encoding from the `FrameData`.
|
||||
* Reads an integer value with a specified encoding from the `FrameData`.
|
||||
*
|
||||
* The value is read from the frame data, converted from the specified @p kEncoding byte order to
|
||||
* host byte order, and returned in @p aUint.
|
||||
*
|
||||
* If read successfully, the `FrameData` is updated to skip over the read content.
|
||||
*
|
||||
* @param[out] aUint16 A reference to an `uint16_t` to return the read value.
|
||||
* @tparam kEncoding The encoding of the integer in the frame data (big or little endian).
|
||||
* @tparam UintType The unsigned integer type.
|
||||
*
|
||||
* @retval kErrorNone Successfully read `uint16_t` value and skipped over it.
|
||||
* @retval kErrorParse Not enough bytes remaining to read.
|
||||
* @param[out] aUint A reference to the integer to return the read value.
|
||||
*
|
||||
* @retval kErrorNone Successfully read the value and skipped over it.
|
||||
* @retval kErrorParse Not enough bytes remaining to read.
|
||||
*/
|
||||
Error ReadBigEndianUint16(uint16_t &aUint16);
|
||||
|
||||
/**
|
||||
* Reads an `uint32_t` value assuming big endian encoding from the `FrameData`.
|
||||
*
|
||||
* If read successfully, the `FrameData` is updated to skip over the read content.
|
||||
*
|
||||
* @param[out] aUint32 A reference to an `uint32_t` to return the read value.
|
||||
*
|
||||
* @retval kErrorNone Successfully read `uint32_t` value and skipped over it.
|
||||
* @retval kErrorParse Not enough bytes remaining to read.
|
||||
*/
|
||||
Error ReadBigEndianUint32(uint32_t &aUint32);
|
||||
|
||||
/**
|
||||
* Reads an `uint16_t` value assuming little endian encoding from the `FrameData`.
|
||||
*
|
||||
* If read successfully, the `FrameData` is updated to skip over the read content.
|
||||
*
|
||||
* @param[out] aUint16 A reference to an `uint16_t` to return the read value.
|
||||
*
|
||||
* @retval kErrorNone Successfully read `uint16_t` value and skipped over it.
|
||||
* @retval kErrorParse Not enough bytes remaining to read.
|
||||
*/
|
||||
Error ReadLittleEndianUint16(uint16_t &aUint16);
|
||||
|
||||
/**
|
||||
* Reads an `uint32_t` value assuming little endian encoding from the `FrameData`.
|
||||
*
|
||||
* If read successfully, the `FrameData` is updated to skip over the read content.
|
||||
*
|
||||
* @param[out] aUint32 A reference to an `uint32_t` to return the read value.
|
||||
*
|
||||
* @retval kErrorNone Successfully read `uint32_t` value and skipped over it.
|
||||
* @retval kErrorParse Not enough bytes remaining to read.
|
||||
*/
|
||||
Error ReadLittleEndianUint32(uint32_t &aUint32);
|
||||
template <Encoding kEncoding, typename UintType> Error ReadUint(UintType &aUint);
|
||||
|
||||
/**
|
||||
* Reads a given number of bytes from the `FrameData`.
|
||||
|
||||
@@ -81,6 +81,10 @@ class HmacSha256;
|
||||
|
||||
} // namespace Crypto
|
||||
|
||||
namespace Ip6 {
|
||||
class PlatTcp;
|
||||
} // namespace Ip6
|
||||
|
||||
/**
|
||||
* @addtogroup core-message
|
||||
*
|
||||
@@ -293,6 +297,7 @@ class Message : public otMessage, public Buffer, public GetProvider<Message>
|
||||
friend class Crypto::HmacSha256;
|
||||
friend class Crypto::Sha256;
|
||||
friend class Crypto::AesCcm;
|
||||
friend class Ip6::PlatTcp;
|
||||
friend class MessagePool;
|
||||
friend class MessageQueue;
|
||||
friend class PriorityQueue;
|
||||
@@ -1714,6 +1719,14 @@ public:
|
||||
~MessageQueue(void) { DequeueAndFreeAll(); }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Indicates whether the message queue is empty.
|
||||
*
|
||||
* @retval TRUE The message queue is empty.
|
||||
* @retval FALSE The message queue is not empty.
|
||||
*/
|
||||
bool IsEmpty(void) const { return GetHead() == nullptr; }
|
||||
|
||||
/**
|
||||
* Returns a pointer to the first message.
|
||||
*
|
||||
|
||||
@@ -140,12 +140,13 @@ void Notifier::EmitEvents(void)
|
||||
#if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE && OPENTHREAD_CONFIG_BORDER_AGENT_ADMITTER_ENABLE
|
||||
Get<MeshCoP::BorderAgent::Admitter>().HandleNotifierEvents(events);
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
|
||||
Get<Ble::BleSecure>().HandleNotifierEvents(events);
|
||||
Get<MeshCoP::TcatAgent>().HandleNotifierEvents(events);
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_MLR_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE)
|
||||
Get<Mlr::Manager>().HandleNotifierEvents(events);
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE)
|
||||
Get<DuaManager>().HandleNotifierEvents(events);
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
|
||||
Get<Trel::Link>().HandleNotifierEvents(events);
|
||||
#endif
|
||||
@@ -193,9 +194,6 @@ void Notifier::EmitEvents(void)
|
||||
#if OPENTHREAD_CONFIG_LINK_METRICS_MANAGER_ENABLE
|
||||
Get<Utils::LinkMetricsManager>().HandleNotifierEvents(events);
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
|
||||
Get<MeshCoP::TcatAgent>().HandleNotifierEvents(events);
|
||||
#endif
|
||||
|
||||
for (ExternalCallback &callback : mExternalCallbacks)
|
||||
{
|
||||
|
||||
@@ -71,13 +71,6 @@ void SettingsBase::ChildInfo::Log(Action aAction) const
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
void SettingsBase::DadInfo::Log(Action aAction) const
|
||||
{
|
||||
LogInfo("%s DadInfo {DadCounter:%2d}", ActionToString(aAction), GetDadCounter());
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
void SettingsBase::LogPrefix(Action aAction, Key aKey, const Ip6::Prefix &aPrefix)
|
||||
{
|
||||
@@ -151,7 +144,7 @@ const char *SettingsBase::KeyToString(Key aKey)
|
||||
_(kKeyChildInfo, "ChildInfo") \
|
||||
_(6, "") \
|
||||
_(kKeySlaacIidSecretKey, "SlaacIidSecretKey") \
|
||||
_(kKeyDadInfo, "DadInfo") \
|
||||
_(8, "") \
|
||||
_(9, "") \
|
||||
_(10, "") \
|
||||
_(kKeySrpEcdsaKey, "SrpEcdsaKey") \
|
||||
@@ -487,12 +480,6 @@ void Settings::Log(Action aAction, Error aError, Key aKey, const void *aValue)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
case kKeyDadInfo:
|
||||
reinterpret_cast<const DadInfo *>(aValue)->Log(aAction);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
case kKeyBrUlaPrefix:
|
||||
LogPrefix(aAction, aKey, *reinterpret_cast<const Ip6::Prefix *>(aValue));
|
||||
|
||||
@@ -112,7 +112,6 @@ public:
|
||||
kKeyParentInfo = OT_SETTINGS_KEY_PARENT_INFO,
|
||||
kKeyChildInfo = OT_SETTINGS_KEY_CHILD_INFO,
|
||||
kKeySlaacIidSecretKey = OT_SETTINGS_KEY_SLAAC_IID_SECRET_KEY,
|
||||
kKeyDadInfo = OT_SETTINGS_KEY_DAD_INFO,
|
||||
kKeySrpEcdsaKey = OT_SETTINGS_KEY_SRP_ECDSA_KEY,
|
||||
kKeySrpClientInfo = OT_SETTINGS_KEY_SRP_CLIENT_INFO,
|
||||
kKeySrpServerInfo = OT_SETTINGS_KEY_SRP_SERVER_INFO,
|
||||
@@ -486,45 +485,6 @@ public:
|
||||
};
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
/**
|
||||
* Represents the duplicate address detection information for settings storage.
|
||||
*/
|
||||
OT_TOOL_PACKED_BEGIN
|
||||
class DadInfo : private Clearable<DadInfo>
|
||||
{
|
||||
friend class Settings;
|
||||
friend class Clearable<DadInfo>;
|
||||
|
||||
public:
|
||||
static constexpr Key kKey = kKeyDadInfo; ///< The associated key.
|
||||
|
||||
/**
|
||||
* Initializes the `DadInfo` object.
|
||||
*/
|
||||
void Init(void) { Clear(); }
|
||||
|
||||
/**
|
||||
* Returns the Dad Counter.
|
||||
*
|
||||
* @returns The Dad Counter value.
|
||||
*/
|
||||
uint8_t GetDadCounter(void) const { return mDadCounter; }
|
||||
|
||||
/**
|
||||
* Sets the Dad Counter.
|
||||
*
|
||||
* @param[in] aDadCounter The Dad Counter value.
|
||||
*/
|
||||
void SetDadCounter(uint8_t aDadCounter) { mDadCounter = aDadCounter; }
|
||||
|
||||
private:
|
||||
void Log(Action aAction) const;
|
||||
|
||||
uint8_t mDadCounter; ///< Dad Counter used to resolve address conflict in Thread 1.2 DUA feature.
|
||||
} OT_TOOL_PACKED_END;
|
||||
#endif // OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
/**
|
||||
* Defines constants and types for BR ULA prefix settings.
|
||||
|
||||
@@ -104,13 +104,6 @@ void TimeTicker::HandleTimer(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE)
|
||||
if (mReceivers & Mask(kDuaManager))
|
||||
{
|
||||
Get<DuaManager>().HandleTimeTick();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mReceivers & Mask(kIp6Mpl))
|
||||
{
|
||||
Get<Ip6::Mpl>().HandleTimeTick();
|
||||
|
||||
@@ -66,7 +66,6 @@ public:
|
||||
kAddressResolver, ///< `AddressResolver`
|
||||
kChildSupervisor, ///< `ChildSupervisor`
|
||||
kIp6FragmentReassembler, ///< `Ip6::Ip6` (handling of fragmented messages)
|
||||
kDuaManager, ///< `DuaManager`
|
||||
kNetworkDataNotifier, ///< `NetworkData::Notifier`
|
||||
kIp6Mpl, ///< `Ip6::Mpl`
|
||||
kBbrLocal, ///< `BackboneRouter::Local`
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
*
|
||||
* - It has added at least one external route entry.
|
||||
* - It has added at least one prefix entry with default-route and on-mesh flags set.
|
||||
* - It has added at least one domain prefix (domain and on-mesh flags set).
|
||||
*
|
||||
* A Border Router which provides IP connectivity and is acting as a REED is eligible to request a router role upgrade
|
||||
* by sending an "Address Solicit" request to leader with status reason `BorderRouterRequest`. This reason is used when
|
||||
|
||||
@@ -198,6 +198,15 @@
|
||||
#define OPENTHREAD_CONFIG_MPL_DYNAMIC_INTERVAL_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE
|
||||
*
|
||||
* Define as 1 to enable TCP support via platform `otPlatTcp*` APIs and `Ip6::PlatTcp`.
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_TCP_ENABLE
|
||||
*
|
||||
|
||||
@@ -524,15 +524,6 @@
|
||||
#define OPENTHREAD_CONFIG_OTNS_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
*
|
||||
* Define as 1 to support Thread 1.2 Domain Unicast Address feature.
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
#define OPENTHREAD_CONFIG_DUA_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MLR_ENABLE
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user