TianoCore EDK2 master
Loading...
Searching...
No Matches
redfishService.h
Go to the documentation of this file.
1
19#ifndef LIBREDFISH_REDFISH_SERVICE_H_
20#define LIBREDFISH_REDFISH_SERVICE_H_
21
23
24#include <Library/BaseLib.h>
26#include <Library/DebugLib.h>
27#include <Library/HttpLib.h>
29#include <Library/NetLib.h>
33
35
37#include <Protocol/RestEx.h>
38
39#include <jansson.h>
40
41typedef struct {
42 char *host;
43 json_t *versions;
44 unsigned int flags;
45 char *sessionToken;
46 char *basicAuthStr;
47 //
48 // point to the <HOST> part in above "host" field, which will be put into
49 // the "Host" header of HTTP request message.
50 //
51 char *HostHeaderValue;
54
55typedef struct {
56 json_t *json;
57 redfishService *service;
59
60#define REDFISH_AUTH_BASIC 0
61#define REDFISH_AUTH_BEARER_TOKEN 1
62#define REDFISH_AUTH_SESSION 2
63
64#define REDFISH_HTTP_RESPONSE_TIMEOUT 5000
65
69#define HTTP_FLAG L"http://"
70#define HTTPS_FLAG L"https://"
71
76#define REDFISH_FIRST_URL L"/redfish/v1"
77
78typedef struct {
79 unsigned int authType;
80 union {
81 struct {
82 char *username;
83 char *password;
84 } userPass;
85 struct {
86 char *token;
87 } authToken;
88 } authCodes;
90
91// Values for flags
92#define REDFISH_FLAG_SERVICE_NO_VERSION_DOC 0x00000001// The Redfish Service lacks the version document (in violation of the Redfish spec)
94createServiceEnumerator (
95 REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo,
96 const char *rootUri,
98 unsigned int flags
99 );
100
101json_t *
102getUriFromService (
103 redfishService *service,
104 const char *uri,
105 EFI_HTTP_STATUS_CODE **StatusCode
106 );
107
108json_t *
109getUriFromServiceEx (
110 redfishService *service,
111 const char *uri,
112 EFI_HTTP_HEADER **Headers,
113 UINTN *HeaderCount,
114 EFI_HTTP_STATUS_CODE **StatusCode
115 );
116
117json_t *
118patchUriFromService (
119 redfishService *service,
120 const char *uri,
121 const char *content,
122 EFI_HTTP_STATUS_CODE **StatusCode
123 );
124
125json_t *
126patchUriFromServiceEx (
127 redfishService *service,
128 const char *uri,
129 const char *content,
130 EFI_HTTP_HEADER **Headers,
131 UINTN *HeaderCount,
132 EFI_HTTP_STATUS_CODE **StatusCode
133 );
134
135json_t *
136postUriFromService (
137 redfishService *service,
138 const char *uri,
139 const char *content,
140 size_t contentLength,
141 const char *contentType,
142 EFI_HTTP_STATUS_CODE **StatusCode
143 );
144
145json_t *
146postUriFromServiceEx (
147 redfishService *service,
148 const char *uri,
149 const char *content,
150 size_t contentLength,
151 const char *contentType,
152 EFI_HTTP_HEADER **Headers,
153 UINTN *HeaderCount,
154 EFI_HTTP_STATUS_CODE **StatusCode
155 );
156
157json_t *
158putUriFromServiceEx (
159 redfishService *service,
160 const char *uri,
161 const char *content,
162 size_t contentLength,
163 const char *contentType,
164 EFI_HTTP_HEADER **Headers,
165 UINTN *HeaderCount,
166 EFI_HTTP_STATUS_CODE **StatusCode
167 );
168
169json_t *
170deleteUriFromService (
171 redfishService *service,
172 const char *uri,
173 EFI_HTTP_STATUS_CODE **StatusCode
174 );
175
176json_t *
177deleteUriFromServiceEx (
178 redfishService *service,
179 const char *uri,
180 const char *content,
181 EFI_HTTP_STATUS_CODE **StatusCode
182 );
183
185getRedfishServiceRoot (
186 redfishService *service,
187 const char *version,
188 EFI_HTTP_STATUS_CODE **StatusCode
189 );
190
192getPayloadByPath (
193 redfishService *service,
194 const char *path,
195 EFI_HTTP_STATUS_CODE **StatusCode
196 );
197
198void
199cleanupServiceEnumerator (
200 redfishService *service
201 );
202
203#endif
UINT64 UINTN
EFI_HTTP_STATUS_CODE
Definition: Http.h:59