1# libpldm 2 3This is a library which deals with the encoding and decoding of PLDM messages. 4It should be possible to use this library by projects other than OpenBMC, and 5hence certain constraints apply to it: 6 7- keeping it light weight 8- implementation in C 9- minimal dynamic memory allocations 10- endian-safe 11- no OpenBMC specific dependencies 12 13Source files are named according to the PLDM Type, for eg base.[h/c], fru.[h/c], 14etc. 15 16Given a PLDM command "foo", the library will provide the following API: For the 17Requester function: 18 19```c 20encode_foo_req() - encode a foo request 21decode_foo_resp() - decode a response to foo 22``` 23 24For the Responder function: 25 26```c 27decode_foo_req() - decode a foo request 28encode_foo_resp() - encode a response to foo 29``` 30 31The library also provides API to pack and unpack PLDM headers. 32 33## To Build 34 35`libpldm` is configured and built using `meson`. Python's `pip` or 36[`pipx`][pipx] can be used to install a recent version on your machine: 37 38[pipx]: https://pipx.pypa.io/latest/ 39 40```sh 41pipx install meson 42``` 43 44Once `meson` is installed: 45 46```sh 47meson setup build && meson compile -C build 48``` 49 50## To run unit tests 51 52```sh 53meson test -C build 54``` 55 56## Working with `libpldm` 57 58Components of the library ABI[^1] (loosely, functions) are separated into three 59categories: 60 61[^1]: ["library API + compiler ABI = library ABI"][libstdc++-library-abi] 62 63[libstdc++-library-abi]: 64 https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html 65 661. Stable 672. Testing 683. Deprecated 69 70Applications depending on `libpldm` should aim to only use functions from the 71stable category. However, this may not always be possible. What to do when 72required functions fall into the deprecated or testing categories is discussed 73in [CONTRIBUTING](CONTRIBUTING.md#Library-background). 74