libipp: Add missing unit tests for the parser

Add unit tests that validate parsing attributes of types dateTime,
resolution and rangeOfIntegers. Also, move the struct BinaryContent to
separate file. It is now used in both parser_test.cc and ipp_test.cc.

BUG=b:248022488
TEST=FEATURES=test emerge-amd64-generic libipp

Change-Id: I51567966ef0ab244009f105ed19cef804990c4b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/4382222
Tested-by: Piotr Pawliczek <pawliczek@chromium.org>
Reviewed-by: Benjamin Gordon <bmgordon@chromium.org>
Commit-Queue: Piotr Pawliczek <pawliczek@chromium.org>
NOKEYCHECK=True
GitOrigin-RevId: a5ab5d4de4c1a1c37ab10dada46cfc969b09db08
5 files changed
tree: de0a7b82ac523e35fe43e5f2f712033409393078
  1. docs/
  2. attribute.h
  3. attribute_test.cc
  4. binary_content.cc
  5. binary_content.h
  6. BUILD.gn
  7. builder.cc
  8. builder.h
  9. colls_view.cc
  10. colls_view.h
  11. colls_view_test.cc
  12. CPPLINT.cfg
  13. errors.cc
  14. errors.h
  15. errors_test.cc
  16. frame.cc
  17. frame.h
  18. frame_test.cc
  19. ipp_attribute.cc
  20. ipp_attribute.h
  21. ipp_attribute_test.cc
  22. ipp_encoding.h
  23. ipp_encoding_test.cc
  24. ipp_enums.cc
  25. ipp_enums.h
  26. ipp_enums_test.cc
  27. ipp_export.h
  28. ipp_frame.h
  29. ipp_fuzzer.cc
  30. ipp_parser.cc
  31. ipp_parser.h
  32. ipp_test.cc
  33. libipp.pc
  34. OWNERS
  35. parser.cc
  36. parser.h
  37. parser_test.cc
  38. README.md
  39. validator.cc
  40. validator.h
  41. validator_test.cc
README.md

libipp

What is this?

General C++ library for building and parsing IPP frames. IPP stands for Internet Printing Protocol and is defined in several documents. This implementation is based mainly on the following sources:

How to use it?

All required C++ classes, types and functions are declared in ipp namespace.

IPP frames are sent/received as a payload of HTTP POST requests/responses. This library helps to build and parse raw IPP frames, but does not support the HTTP protocol. You have to use some other library to process HTTP packages, like libbrillo or libcurl. You can also dump a raw IPP frame to a file and send it from the command line with curl, e.g.:

curl -X POST "http://my.server:631/mypath" --header "Content-Type: application/ipp" --data-binary @ipp.frame

Then obtained response can be read from the file and parsed by libipp.

Documentation conventions

In this documentation, the following typographical conventions are used:

  • boldface denotes entities defined in the IPP specifications (see the links mentioned above);
  • italics indicates a name of a library or a (shell) command;
  • monospace is used to mark entities from the source code.

Link to documentation