In-Memory FlightRecorder support for pldmd

pldm daemon in BMC can act both as a requester and
responder, and it is capable of talking to any device
that talks pldm spec.

With the rapid increase in the number of commands supported
by pldmd, and also with the async request/response support
enabled, its becomes extremely tough to debug the failures
in the communication.

And most of times, the essential information that is needed
to debug are the last few commands that BMC pldm responded to.
So this commit is an attempt to bring in an in-memory flight
recorder that could save the last 10(can be configurable)
pldm transactions in a circular buffer, and dumps the contents
of it into a file when it receives a SIGUR1 signal.

Resolves openbmc/pldm#24

Tested By :

1. Power on host
2. In the middle of poweron, send the SIGUSR1 signal to pldmd

root@rain118bmc:/tmp# kill -10 836
Received SIGUR1(10) Signal interrupt
root@rain118bmc:/tmp# Dumping the flight recorder into /tmp/pldm_flight_recorder

3. Make sure pldmd is not killed and does the rest of the power on
  operation.

4. check the contents of /tmp/pldm_flight_recorder
root@p10bmc:~# cat /tmp/pldm_flight_recorder
UTC Nov 05 / 11:27:25.334606 : Tx :
0a 3f 0d 00
UTC Nov 05 / 11:27:26.292988 : Rx :
09 01 8b 3f 0d 00 00 7b 1e 00 50 00
UTC Nov 05 / 11:27:26.296915 : Tx :
0b 3f 0d 00
UTC Nov 05 / 11:27:27.250999 : Rx :
09 01 8c 3f 0d 00 00 7c 1e 00 50 00
UTC Nov 05 / 11:27:27.254762 : Tx :
0c 3f 0d 00
UTC Nov 05 / 11:27:28.212168 : Rx :
09 01 8d 3f 0d 00 00 7d 1e 00 50 00
UTC Nov 05 / 11:27:28.216086 : Tx :
0d 3f 0d 00
UTC Nov 05 / 11:27:29.171228 : Rx :
09 01 8e 3f 0d 00 00 7e 1e 00 50 00
UTC Nov 05 / 11:27:29.175143 : Tx :
0e 3f 0d 00
UTC Nov 05 / 11:27:25.330716 : Rx :
09 01 8a 3f 0d 00 00 7a 1e 00 50 00

5. Configure with -Dflightrecorder-max-entries=0
root@p10bmc:~# kill -10 21847
Received SIGUR1(10) Signal interrupt
Fight recorder policy is disabled

Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: I4e9c828f4ada9f1db6bf3a9b68c16e71b6e5d8f0
diff --git a/meson_options.txt b/meson_options.txt
index 0cb99df..7bb863f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -27,3 +27,5 @@
 
 # Firmware update configuration parameters
 option('maximum-transfer-size', type: 'integer', min: 16, max: 4294967295, description: 'Maximum size in bytes of the variable payload allowed to be requested by the FD, via RequestFirmwareData command', value: 4096)
+# Flight Recorder for PLDM Daemon
+option('flightrecorder-max-entries', type:'integer',min:0, max:30, description: 'The max number of pldm messages that can be stored in the recorder, this feature will be disabled if it is set to 0', value: 10)