summaryrefslogtreecommitdiffstats
path: root/command/open_session.hpp
blob: 677fe558ed499e6f90d278dee6153be9374e8345 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#pragma once

#include <vector>

#include "message_handler.hpp"

namespace command
{

/**
 * @struct OpenSessionRequest
 *
 * IPMI Payload for RMCP+ Open Session Request
 */
struct OpenSessionRequest
{
    uint8_t messageTag;  // Message tag from request buffer

#if BYTE_ORDER == LITTLE_ENDIAN
    uint8_t maxPrivLevel : 4 ;// Requested maximum privilege level
    uint8_t reserved1 : 4;  // Reserved for future definition
#endif

#if BYTE_ORDER == BIG_ENDIAN
    uint8_t reserved1 : 4;  // Reserved for future definition
    uint8_t maxPrivLevel : 4 ;// Requested maximum privilege level

#endif

    uint16_t reserved2;
    uint32_t remoteConsoleSessionID ;

    uint8_t authPayload ;
    uint16_t  reserved3;
    uint8_t  authPayloadLen;

#if BYTE_ORDER == LITTLE_ENDIAN
    uint8_t authAlgo : 6;
    uint8_t reserved4 : 2;
#endif

#if BYTE_ORDER == BIG_ENDIAN
    uint8_t reserved4 : 2;
    uint8_t authAlgo : 6;
#endif

    uint8_t reserved5;
    uint16_t reserved6;

    uint8_t intPayload;
    uint16_t reserved7;
    uint8_t  intPayloadLen;

#if BYTE_ORDER == LITTLE_ENDIAN
    uint8_t intAlgo : 6;
    uint8_t reserved8 : 2;
#endif

#if BYTE_ORDER == BIG_ENDIAN
    uint8_t reserved8 : 2;
    uint8_t intAlgo : 6;
#endif

    uint8_t reserved9;
    uint16_t reserved10;

    uint8_t confPayload;
    uint16_t reserved11;
    uint8_t  confPayloadLen;

#if BYTE_ORDER == LITTLE_ENDIAN
    uint8_t confAlgo : 6;
    uint8_t reserved12 : 2;
#endif

#if BYTE_ORDER == BIG_ENDIAN
    uint8_t reserved12 : 2;
    uint8_t confAlgo : 6;
#endif

    uint8_t reserved13;
    uint16_t reserved14;
} __attribute__((packed));

/**
 * @struct OpenSessionResponse
 *
 * IPMI Payload for RMCP+ Open Session Response
 */
struct OpenSessionResponse
{
    uint8_t messageTag;
    uint8_t status_code;

#if BYTE_ORDER == LITTLE_ENDIAN
    uint8_t maxPrivLevel : 4;
    uint8_t reserved1 : 4;
#endif

#if BYTE_ORDER == BIG_ENDIAN
    uint8_t reserved1 : 4;
    uint8_t maxPrivLevel : 4;
#endif

    uint8_t reserved2;
    uint32_t remoteConsoleSessionID;
    uint32_t managedSystemSessionID;

    uint8_t authPayload;
    uint16_t reserved3;
    uint8_t authPayloadLen;

#if BYTE_ORDER == LITTLE_ENDIAN
    uint8_t authAlgo : 6;
    uint8_t reserved4 : 2;
#endif

#if BYTE_ORDER == BIG_ENDIAN
    uint8_t reserved4 : 2;
    uint8_t authAlgo : 6;
#endif

    uint8_t reserved5;
    uint16_t reserved6;

    uint8_t intPayload;
    uint16_t reserved7;
    uint8_t  intPayloadLen;

#if BYTE_ORDER == LITTLE_ENDIAN
    uint8_t intAlgo : 6;
    uint8_t reserved8 : 2;
#endif

#if BYTE_ORDER == BIG_ENDIAN
    uint8_t reserved8 : 2;
    uint8_t intAlgo : 6;

#endif

    uint8_t reserved9;
    uint16_t reserved10;

    uint8_t confPayload;
    uint16_t reserved11;
    uint8_t  confPayloadLen;

#if BYTE_ORDER == LITTLE_ENDIAN
    uint8_t confAlgo : 6;
    uint8_t reserved12 : 2;
#endif

#if BYTE_ORDER == BIG_ENDIAN
    uint8_t reserved12 : 2;
    uint8_t confAlgo : 6;
#endif

    uint8_t reserved13;
    uint16_t reserved14;
} __attribute__((packed));

/**
 * @brief RMCP+ Open Session Request, RMCP+ Open Session Response
 *
 * The RMCP+ Open Session request and response messages are used to enable a
 * remote console to discover what Cipher Suite(s) can be used for establishing
 * a session at a requested maximum privilege level. These messages are also
 * used for transferring the sessions IDs that the remote console and BMC wish
 *  to for the session once it’s been activated, and to track each party during
 *  the exchange of messages used for establishing the session.
 *
 * @param[in] inPayload - Request Data for the command
 * @param[in] handler - Reference to the Message Handler
 *
 * @return Response data for the command
 */
std::vector<uint8_t> openSession(const std::vector<uint8_t>& inPayload,
                                 const message::Handler& handler);

} // namespace command
OpenPOWER on IntegriCloud