xref: /openbmc/pldm/docs/code_organisation.md (revision 571d7d44635580ee7bb29e84ee3114c472d3fc61)
1# Code Organization
2
3At a high-level, code in this repository belongs to one of the following three
4components.
5
6## libpldmresponder
7
8This library provides handlers for incoming PLDM request messages. It provides
9for a registration as well as a plug-in mechanism. The library is implemented in
10modern C++, and handles OpenBMC's platform specifics.
11
12The handlers are of the form
13
14```c
15Response handler(Request payload, size_t payloadLen)
16```
17
18Source files are named according to the PLDM Type, for eg base.[hpp/cpp],
19fru.[hpp/cpp], etc.
20
21## OEM/vendor-specific functions
22
23This will support OEM or vendor-specific functions and semantic information.
24Following directory structure has to be used:
25
26```txt
27    pldm repo
28     |---- oem
29            |----<oem_name>
30                      |----libpldmresponder
31                            |---<oem based handler files>
32
33```
34
35<oem_name> - This folder must be created with the name of the OEM/vendor in
36lower case. Folders named libpldm and libpldmresponder must be created under the
37folder <oem_name>
38
39Files having the oem functionality for the libpldmresponder library should be
40placed under the folder oem/<oem_name>/libpldmresponder. They must be adhering
41to the rules mentioned under the libpldmresponder section above.
42
43Once the above is done a meson option has to be created in
44`pldm/meson_options.txt` with its mapped compiler flag to enable conditional
45compilation.
46
47For consistency would recommend using "oem-<oem_name>".
48
49The `pldm/meson.build` and the corresponding source file(s) will need to
50incorporate the logic of adding its mapped compiler flag to allow conditional
51compilation of the code.
52
53## libpldm
54
55pldm daemon links against the libpldm library during compilation, For more
56information on libpldm please refer to
57[libpldm](https://github.com/openbmc/libpldm)
58
59## pldmtool
60
61For more information on pldmtool please refer to
62[pldmtool](../pldmtool/README.md).
63