Support checksumming the attachment together with the body

Controller::set_request/response_checksum_type() previously only
covered the serialized protobuf body; the attachment (if any) was
never protected. Add set_request/response_checksum_attachment(bool)
so callers can opt the attachment into the same checksum.

- baidu_rpc_meta.proto: add RpcMeta.checksum_with_attachment so the
  receiver knows whether to fold the attachment into verification.
  Defaults to false, so old peers that don't understand the field
  keep verifying against the body only (backward compatible).
- Controller: add the two setters/getters, thread the flag through
  ClientSettings (Save/ApplyClientSettings) so ParallelChannel/
  SelectiveChannel sub-controllers inherit it correctly, and reset it
  in ResetPods().
- ChecksumIn: add an optional `attachment' field consumed by checksum
  handlers.
- crc32c_checksum.cpp: extend the crc32c over body then attachment (in
  that fixed order) when requested.
- baidu_rpc_protocol.cpp: wire checksum_attachment through
  SerializeRpcMessage/DeserializeRpcMessage and every client/server
  send/receive path; skip it when progressive attachment reading is
  enabled since there's no single complete IOBuf to checksum in that
  case.

Add brpc_checksum_unittest.cpp covering Crc32cCompute/Crc32cVerify
directly (including corruption/omission/order sensitivity) and an
end-to-end Server/Channel test for both request- and response-side
attachment checksums.
8 files changed
tree: 45e94aad1c6afd6fd09594eb4d9c125e2471a70d
  1. .github/
  2. bazel/
  3. cmake/
  4. community/
  5. docs/
  6. example/
  7. homebrew-formula/
  8. java/
  9. package/
  10. python/
  11. registry/
  12. src/
  13. test/
  14. tools/
  15. .asf.yaml
  16. .bazelignore
  17. .bazelrc
  18. .bazelversion
  19. .gitignore
  20. .licenserc.yaml
  21. AGENTS.md
  22. BUILD.bazel
  23. CHANGES.md
  24. CLAUDE.md
  25. CMakeLists.txt
  26. CODE_OF_CONDUCT.md
  27. config.h.in
  28. config_brpc.sh
  29. CONTRIBUTING.md
  30. Dockerfile
  31. LICENSE
  32. Makefile
  33. MODULE.bazel
  34. NOTICE
  35. README.md
  36. README_cn.md
  37. RELEASE_VERSION
  38. SECURITY.md
  39. THREAT_MODEL.md
  40. WORKSPACE
  41. WORKSPACE.bzlmod
README.md

中文版

Linux Build Status MacOs Build Status

brpc logo (light) brpc logo (dark)

bRPC is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc.

“bRPC” means “better RPC”.

You can use it to:

Try it!

Contribute code

Please refer to here.

Feedback and Getting involved

Code of Conduct

We follow the code of conduct from Apache Software Foundation, please refer it here Link