1 #pragma once
2 
3 #include <vector>
4 
5 #include "message_handler.hpp"
6 #include "comm_module.hpp"
7 
8 namespace command
9 {
10 
11 /**
12  * @struct RAKP1request
13  *
14  * IPMI Payload for RAKP Message 1
15  */
16 struct RAKP1request
17 {
18     uint8_t messageTag;
19     uint8_t reserved1;
20     uint16_t reserved2;
21     uint32_t managedSystemSessionID;
22     uint8_t remote_console_random_number[16];
23     uint8_t req_max_privilege_level;
24     uint16_t reserved3;
25     uint8_t user_name_len;
26     char user_name[16];
27 } __attribute__((packed));
28 
29 /**
30  * @struct RAKP2response
31  *
32  * IPMI Payload for RAKP Message 2
33  */
34 struct RAKP2response
35 {
36     uint8_t messageTag;
37     uint8_t rmcpStatusCode;
38     uint16_t reserved;
39     uint32_t remoteConsoleSessionID;
40     uint8_t managed_system_random_number[16];
41     uint8_t managed_system_guid[16];
42 } __attribute__((packed));
43 
44 /**
45  * @brief RAKP Message 1, RAKP Message 2
46  *
47  * These messages are used to exchange random number and identification
48  * information between the BMC and the remote console that are, in effect,
49  * mutual challenges for a challenge/response. (Unlike IPMI v1.5, the v2.0/RMCP+
50  * challenge/response is symmetric. I.e. the remote console and BMC both issues
51  * challenges,and both need to provide valid responses for the session to be
52  * activated.)
53  *
54  * The remote console request (RAKP Message 1) passes a random number and
55  * username/privilege information that the BMC will later use to ‘sign’ a
56  * response message based on key information associated with the user and the
57  * Authentication Algorithm negotiated in the Open Session Request/Response
58  * exchange. The BMC responds with RAKP Message 2 and passes a random number and
59  * GUID (globally unique ID) for the managed system that the remote console
60  * uses according the Authentication Algorithm to sign a response back to the
61  * BMC.
62  *
63  * @param[in] inPayload - Request Data for the command
64  * @param[in] handler - Reference to the Message Handler
65  *
66  * @return Response data for the command
67  */
68 std::vector<uint8_t> RAKP12(const std::vector<uint8_t>& inPayload,
69                             const message::Handler& handler);
70 
71 } // namespace command
72