TianoCore EDK2 master
Loading...
Searching...
No Matches
RestJsonStructureDxe.c
Go to the documentation of this file.
1
13#include <Uefi.h>
14#include <Library/DebugLib.h>
17
18LIST_ENTRY mRestJsonStructureList;
19EFI_HANDLE mProtocolHandle;
20
37EFIAPI
40 IN EFI_REST_JSON_STRUCTURE_SUPPORTED *JsonStructureSupported,
44 )
45{
46 UINTN NumberOfNS;
47 UINTN Index;
48 LIST_ENTRY *ThisList;
50 EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *CloneSupportedInterpId;
51 EFI_REST_JSON_STRUCTURE_SUPPORTED *ThisSupportedInterp;
52
53 if ((This == NULL) ||
54 (ToStructure == NULL) ||
55 (ToJson == NULL) ||
56 (DestroyStructure == NULL) ||
57 (JsonStructureSupported == NULL)
58 )
59 {
60 return EFI_INVALID_PARAMETER;
61 }
62
63 //
64 // Check how many name space interpreter can interpret.
65 //
66 ThisList = &JsonStructureSupported->NextSupportedRsrcInterp;
67 NumberOfNS = 1;
68 while (TRUE) {
69 if (ThisList->ForwardLink == &JsonStructureSupported->NextSupportedRsrcInterp) {
70 break;
71 } else {
72 ThisList = ThisList->ForwardLink;
73 NumberOfNS++;
74 }
75 }
76
77 DEBUG ((DEBUG_MANAGEABILITY, "%a: %d REST JSON-C interpreter(s) to register for the name spaces.\n", __func__, NumberOfNS));
78
79 Instance =
81 if (Instance == NULL) {
82 return EFI_OUT_OF_RESOURCES;
83 }
84
86 Instance->NumberOfNameSpaceToConvert = NumberOfNS;
88 //
89 // Copy supported resource identifer interpreter.
90 //
91 CloneSupportedInterpId = Instance->SupportedRsrcIndentifier;
92 ThisSupportedInterp = JsonStructureSupported;
93 for (Index = 0; Index < NumberOfNS; Index++) {
94 CopyMem ((VOID *)CloneSupportedInterpId, (VOID *)&ThisSupportedInterp->RestResourceInterp, sizeof (EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER));
95 DEBUG ((DEBUG_MANAGEABILITY, " Resource type : %a\n", ThisSupportedInterp->RestResourceInterp.NameSpace.ResourceTypeName));
96 DEBUG ((DEBUG_MANAGEABILITY, " Major version : %a\n", ThisSupportedInterp->RestResourceInterp.NameSpace.MajorVersion));
97 DEBUG ((DEBUG_MANAGEABILITY, " Minor version : %a\n", ThisSupportedInterp->RestResourceInterp.NameSpace.MinorVersion));
98 DEBUG ((DEBUG_MANAGEABILITY, " Errata version: %a\n\n", ThisSupportedInterp->RestResourceInterp.NameSpace.ErrataVersion));
99 ThisSupportedInterp = (EFI_REST_JSON_STRUCTURE_SUPPORTED *)ThisSupportedInterp->NextSupportedRsrcInterp.ForwardLink;
100 CloneSupportedInterpId++;
101 }
102
103 Instance->JsonToStructure = ToStructure;
104 Instance->StructureToJson = ToJson;
105 Instance->DestroyStructure = DestroyStructure;
106 InsertTailList (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
107 return EFI_SUCCESS;
108}
109
126 IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance,
127 IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier OPTIONAL,
128 IN CHAR8 *ResourceRaw,
129 OUT EFI_REST_JSON_STRUCTURE_HEADER **RestJSonHeader
130 )
131{
132 UINTN Index;
133 EFI_STATUS Status;
134 EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *ThisSupportedRsrcTypeId;
135
136 DEBUG ((DEBUG_MANAGEABILITY, "%a: Entry\n", __func__));
137
138 if ((This == NULL) ||
139 (InterpreterInstance == NULL) ||
140 (ResourceRaw == NULL) ||
141 (RestJSonHeader == NULL)
142 )
143 {
144 return EFI_INVALID_PARAMETER;
145 }
146
147 Status = EFI_UNSUPPORTED;
148 if (RsrcTypeIdentifier == NULL) {
149 //
150 // No resource type identifier, send to intepreter anyway.
151 // Interpreter may recognize this resource.
152 //
153 Status = InterpreterInstance->JsonToStructure (
154 This,
155 NULL,
156 ResourceRaw,
157 RestJSonHeader
158 );
159 if (EFI_ERROR (Status)) {
160 if (Status == EFI_UNSUPPORTED) {
161 DEBUG ((
162 DEBUG_MANAGEABILITY,
163 "%a %a.%a.%a REST JSON to C structure interpreter has no capability to interpret the resource.\n",
164 InterpreterInstance->SupportedRsrcIndentifier->NameSpace.ResourceTypeName,
165 InterpreterInstance->SupportedRsrcIndentifier->NameSpace.MajorVersion,
166 InterpreterInstance->SupportedRsrcIndentifier->NameSpace.MinorVersion,
167 InterpreterInstance->SupportedRsrcIndentifier->NameSpace.ErrataVersion
168 ));
169 } else {
170 DEBUG ((DEBUG_MANAGEABILITY, "REST JsonToStructure returns failure - %r\n", Status));
171 }
172 }
173 } else {
174 //
175 // Check if the namespace and version is supported by this interpreter.
176 //
177 ThisSupportedRsrcTypeId = InterpreterInstance->SupportedRsrcIndentifier;
178 for (Index = 0; Index < InterpreterInstance->NumberOfNameSpaceToConvert; Index++) {
179 if (AsciiStrCmp (
180 RsrcTypeIdentifier->NameSpace.ResourceTypeName,
181 ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName
182 ) == 0)
183 {
184 if ((RsrcTypeIdentifier->NameSpace.MajorVersion == NULL) &&
185 (RsrcTypeIdentifier->NameSpace.MinorVersion == NULL) &&
186 (RsrcTypeIdentifier->NameSpace.ErrataVersion == NULL)
187 )
188 {
189 //
190 // Don't check version of this resource type identifier.
191 //
192 Status = InterpreterInstance->JsonToStructure (
193 This,
194 RsrcTypeIdentifier,
195 ResourceRaw,
196 RestJSonHeader
197 );
198 if (EFI_ERROR (Status)) {
199 DEBUG ((DEBUG_MANAGEABILITY, "Don't check version of this resource type identifier JsonToStructure returns %r\n", Status));
200 DEBUG ((DEBUG_MANAGEABILITY, " Supported ResourceTypeName = %a\n", ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName));
201 }
202
203 break;
204 } else {
205 //
206 // Check version.
207 //
208 if ((AsciiStrCmp (
209 RsrcTypeIdentifier->NameSpace.MajorVersion,
210 ThisSupportedRsrcTypeId->NameSpace.MajorVersion
211 ) == 0) &&
212 (AsciiStrCmp (
213 RsrcTypeIdentifier->NameSpace.MinorVersion,
214 ThisSupportedRsrcTypeId->NameSpace.MinorVersion
215 ) == 0) &&
216 (AsciiStrCmp (
217 RsrcTypeIdentifier->NameSpace.ErrataVersion,
218 ThisSupportedRsrcTypeId->NameSpace.ErrataVersion
219 ) == 0))
220 {
221 Status = InterpreterInstance->JsonToStructure (
222 This,
223 RsrcTypeIdentifier,
224 ResourceRaw,
225 RestJSonHeader
226 );
227 if (EFI_ERROR (Status)) {
228 DEBUG ((DEBUG_MANAGEABILITY, "Check version of this resource type identifier JsonToStructure returns %r\n", Status));
229 DEBUG ((DEBUG_MANAGEABILITY, " Supported ResourceTypeName = %a\n", ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName));
230 DEBUG ((DEBUG_MANAGEABILITY, " Supported MajorVersion = %a\n", ThisSupportedRsrcTypeId->NameSpace.MajorVersion));
231 DEBUG ((DEBUG_MANAGEABILITY, " Supported MinorVersion = %a\n", ThisSupportedRsrcTypeId->NameSpace.MinorVersion));
232 DEBUG ((DEBUG_MANAGEABILITY, " Supported ErrataVersion = %a\n", ThisSupportedRsrcTypeId->NameSpace.ErrataVersion));
233 }
234
235 break;
236 }
237 }
238 }
239
240 ThisSupportedRsrcTypeId++;
241 }
242 }
243
244 return Status;
245}
246
262 IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance,
263 IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader,
264 OUT CHAR8 **ResourceRaw
265 )
266{
267 UINTN Index;
268 EFI_STATUS Status;
269 EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *ThisSupportedRsrcTypeId;
270 EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier;
271
272 DEBUG ((DEBUG_MANAGEABILITY, "%a: Entry\n", __func__));
273
274 if ((This == NULL) ||
275 (InterpreterInstance == NULL) ||
276 (RestJSonHeader == NULL) ||
277 (ResourceRaw == NULL)
278 )
279 {
280 return EFI_INVALID_PARAMETER;
281 }
282
283 RsrcTypeIdentifier = &RestJSonHeader->JsonRsrcIdentifier;
284 if ((RsrcTypeIdentifier == NULL) ||
285 (RsrcTypeIdentifier->NameSpace.ResourceTypeName == NULL) ||
286 (RsrcTypeIdentifier->NameSpace.MajorVersion == NULL) ||
287 (RsrcTypeIdentifier->NameSpace.MinorVersion == NULL) ||
288 (RsrcTypeIdentifier->NameSpace.ErrataVersion == NULL)
289 )
290 {
291 return EFI_INVALID_PARAMETER;
292 }
293
294 //
295 // Check if the namesapce and version is supported by this interpreter.
296 //
297 Status = EFI_UNSUPPORTED;
298 ThisSupportedRsrcTypeId = InterpreterInstance->SupportedRsrcIndentifier;
299 for (Index = 0; Index < InterpreterInstance->NumberOfNameSpaceToConvert; Index++) {
300 if (AsciiStrCmp (
301 RsrcTypeIdentifier->NameSpace.ResourceTypeName,
302 ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName
303 ) == 0)
304 {
305 //
306 // Check version.
307 //
308 if ((AsciiStrCmp (
309 RsrcTypeIdentifier->NameSpace.MajorVersion,
310 ThisSupportedRsrcTypeId->NameSpace.MajorVersion
311 ) == 0) &&
312 (AsciiStrCmp (
313 RsrcTypeIdentifier->NameSpace.MinorVersion,
314 ThisSupportedRsrcTypeId->NameSpace.MinorVersion
315 ) == 0) &&
316 (AsciiStrCmp (
317 RsrcTypeIdentifier->NameSpace.ErrataVersion,
318 ThisSupportedRsrcTypeId->NameSpace.ErrataVersion
319 ) == 0))
320 {
321 Status = InterpreterInstance->StructureToJson (
322 This,
323 RestJSonHeader,
324 ResourceRaw
325 );
326 if (EFI_ERROR (Status)) {
327 DEBUG ((DEBUG_MANAGEABILITY, "StructureToJson returns %r\n", Status));
328 DEBUG ((DEBUG_MANAGEABILITY, " Supported ResourceTypeName = %a\n", ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName));
329 DEBUG ((DEBUG_MANAGEABILITY, " Supported MajorVersion = %a\n", ThisSupportedRsrcTypeId->NameSpace.MajorVersion));
330 DEBUG ((DEBUG_MANAGEABILITY, " Supported MinorVersion = %a\n", ThisSupportedRsrcTypeId->NameSpace.MinorVersion));
331 DEBUG ((DEBUG_MANAGEABILITY, " Supported ErrataVersion = %a\n", ThisSupportedRsrcTypeId->NameSpace.ErrataVersion));
332 }
333
334 break;
335 }
336 }
337
338 ThisSupportedRsrcTypeId++;
339 }
340
341 return Status;
342}
343
358 IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance,
359 IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader
360 )
361{
362 UINTN Index;
363 EFI_STATUS Status;
364 EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *ThisSupportedRsrcTypeId;
365
366 if ((This == NULL) ||
367 (InterpreterInstance == NULL) ||
368 (RestJSonHeader == NULL)
369 )
370 {
371 return EFI_INVALID_PARAMETER;
372 }
373
374 Status = EFI_UNSUPPORTED;
375 //
376 // Check if the namespace and version is supported by this interpreter.
377 //
378 ThisSupportedRsrcTypeId = InterpreterInstance->SupportedRsrcIndentifier;
379 for (Index = 0; Index < InterpreterInstance->NumberOfNameSpaceToConvert; Index++) {
380 if (AsciiStrCmp (
381 RestJSonHeader->JsonRsrcIdentifier.NameSpace.ResourceTypeName,
382 ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName
383 ) == 0)
384 {
385 if ((RestJSonHeader->JsonRsrcIdentifier.NameSpace.MajorVersion == NULL) &&
386 (RestJSonHeader->JsonRsrcIdentifier.NameSpace.MinorVersion == NULL) &&
387 (RestJSonHeader->JsonRsrcIdentifier.NameSpace.ErrataVersion == NULL)
388 )
389 {
390 //
391 // Don't check version of this resource type identifier.
392 //
393 Status = InterpreterInstance->DestroyStructure (
394 This,
395 RestJSonHeader
396 );
397 break;
398 } else {
399 //
400 // Check version.
401 //
402 if ((AsciiStrCmp (
403 RestJSonHeader->JsonRsrcIdentifier.NameSpace.MajorVersion,
404 ThisSupportedRsrcTypeId->NameSpace.MajorVersion
405 ) == 0) &&
406 (AsciiStrCmp (
407 RestJSonHeader->JsonRsrcIdentifier.NameSpace.MinorVersion,
408 ThisSupportedRsrcTypeId->NameSpace.MinorVersion
409 ) == 0) &&
410 (AsciiStrCmp (
411 RestJSonHeader->JsonRsrcIdentifier.NameSpace.ErrataVersion,
412 ThisSupportedRsrcTypeId->NameSpace.ErrataVersion
413 ) == 0))
414 {
415 Status = InterpreterInstance->DestroyStructure (
416 This,
417 RestJSonHeader
418 );
419 break;
420 }
421 }
422 }
423
424 ThisSupportedRsrcTypeId++;
425 }
426
427 return Status;
428}
429
443EFIAPI
446 IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier OPTIONAL,
447 IN CHAR8 *ResourceJsonText,
448 OUT EFI_REST_JSON_STRUCTURE_HEADER **JsonStructure
449 )
450{
451 EFI_STATUS Status;
453
454 if ((This == NULL) ||
455 (ResourceJsonText == NULL) ||
456 (JsonStructure == NULL)
457 )
458 {
459 return EFI_INVALID_PARAMETER;
460 }
461
462 if (IsListEmpty (&mRestJsonStructureList)) {
463 return EFI_UNSUPPORTED;
464 }
465
466 if (RsrcTypeIdentifier != NULL) {
467 DEBUG ((DEBUG_MANAGEABILITY, "%a: Looking for the REST JSON to C Structure converter:\n", __func__));
468 if (RsrcTypeIdentifier->NameSpace.ResourceTypeName != NULL) {
469 DEBUG ((DEBUG_MANAGEABILITY, " ResourceType: %a\n", RsrcTypeIdentifier->NameSpace.ResourceTypeName));
470 } else {
471 DEBUG ((DEBUG_MANAGEABILITY, " ResourceType: NULL"));
472 }
473
474 if (RsrcTypeIdentifier->NameSpace.MajorVersion != NULL) {
475 DEBUG ((DEBUG_MANAGEABILITY, " MajorVersion: %a\n", RsrcTypeIdentifier->NameSpace.MajorVersion));
476 } else {
477 DEBUG ((DEBUG_MANAGEABILITY, " MajorVersion: NULL"));
478 }
479
480 if (RsrcTypeIdentifier->NameSpace.MinorVersion != NULL) {
481 DEBUG ((DEBUG_MANAGEABILITY, " MinorVersion: %a\n", RsrcTypeIdentifier->NameSpace.MinorVersion));
482 } else {
483 DEBUG ((DEBUG_MANAGEABILITY, " MinorVersion: NULL"));
484 }
485
486 if (RsrcTypeIdentifier->NameSpace.ErrataVersion != NULL) {
487 DEBUG ((DEBUG_MANAGEABILITY, " ErrataVersion: %a\n", RsrcTypeIdentifier->NameSpace.ErrataVersion));
488 } else {
489 DEBUG ((DEBUG_MANAGEABILITY, " ErrataVersion: NULL"));
490 }
491 } else {
492 DEBUG ((DEBUG_MANAGEABILITY, "%a: RsrcTypeIdentifier is given as NULL, go through all of the REST JSON to C structure interpreters.\n", __func__));
493 }
494
495 Status = EFI_SUCCESS;
496 Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList);
497 while (TRUE) {
499 This,
500 Instance,
501 RsrcTypeIdentifier,
502 ResourceJsonText,
503 JsonStructure
504 );
505 if (!EFI_ERROR (Status)) {
506 DEBUG ((DEBUG_MANAGEABILITY, "%a: REST JSON to C structure is interpreted successfully.\n", __func__));
507 break;
508 }
509
510 if (IsNodeAtEnd (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
511 DEBUG ((DEBUG_ERROR, "%a: No REST JSON to C structure interpreter found.\n", __func__));
512 Status = EFI_UNSUPPORTED;
513 break;
514 }
515
516 Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
517 }
518
519 return Status;
520}
521
534EFIAPI
537 IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader
538 )
539{
540 EFI_STATUS Status;
542
543 if ((This == NULL) || (RestJSonHeader == NULL)) {
544 return EFI_INVALID_PARAMETER;
545 }
546
547 if (IsListEmpty (&mRestJsonStructureList)) {
548 return EFI_UNSUPPORTED;
549 }
550
551 Status = EFI_SUCCESS;
552 Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList);
553 while (TRUE) {
555 This,
556 Instance,
557 RestJSonHeader
558 );
559 if (!EFI_ERROR (Status)) {
560 break;
561 }
562
563 if (IsNodeAtEnd (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
564 DEBUG ((DEBUG_ERROR, "%a: No REST JSON to C structure interpreter found.\n", __func__));
565 Status = EFI_UNSUPPORTED;
566 break;
567 }
568
569 Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
570 }
571
572 return Status;
573}
574
587EFIAPI
590 IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader,
591 OUT CHAR8 **ResourceRaw
592 )
593{
594 EFI_STATUS Status;
596 EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier;
597
598 if ((This == NULL) || (RestJSonHeader == NULL) || (ResourceRaw == NULL)) {
599 return EFI_INVALID_PARAMETER;
600 }
601
602 if (IsListEmpty (&mRestJsonStructureList)) {
603 return EFI_UNSUPPORTED;
604 }
605
606 RsrcTypeIdentifier = &RestJSonHeader->JsonRsrcIdentifier;
607 DEBUG ((DEBUG_MANAGEABILITY, "Looking for the REST C Structure to JSON resource converter:\n"));
608 DEBUG ((DEBUG_MANAGEABILITY, " ResourceType : %a\n", RsrcTypeIdentifier->NameSpace.ResourceTypeName));
609 DEBUG ((DEBUG_MANAGEABILITY, " MajorVersion : %a\n", RsrcTypeIdentifier->NameSpace.MajorVersion));
610 DEBUG ((DEBUG_MANAGEABILITY, " MinorVersion : %a\n", RsrcTypeIdentifier->NameSpace.MinorVersion));
611 DEBUG ((DEBUG_MANAGEABILITY, " ErrataVersion: %a\n", RsrcTypeIdentifier->NameSpace.ErrataVersion));
612
613 Status = EFI_SUCCESS;
614 Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList);
615 while (TRUE) {
617 This,
618 Instance,
619 RestJSonHeader,
620 ResourceRaw
621 );
622 if (!EFI_ERROR (Status)) {
623 break;
624 }
625
626 if (IsNodeAtEnd (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
627 DEBUG ((DEBUG_ERROR, "%a: No REST C structure to JSON interpreter found.\n", __func__));
628 Status = EFI_UNSUPPORTED;
629 break;
630 }
631
632 Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
633 }
634
635 return Status;
636}
637
638EFI_REST_JSON_STRUCTURE_PROTOCOL mRestJsonStructureProtocol = {
643};
644
655EFIAPI
657 IN EFI_HANDLE ImageHandle,
658 IN EFI_SYSTEM_TABLE *SystemTable
659 )
660{
661 EFI_STATUS Status;
662
663 InitializeListHead (&mRestJsonStructureList);
664 //
665 // Install the Restful Resource Interpreter Protocol.
666 //
667 mProtocolHandle = NULL;
668 Status = gBS->InstallProtocolInterface (
669 &mProtocolHandle,
670 &gEfiRestJsonStructureProtocolGuid,
672 (VOID *)&mRestJsonStructureProtocol
673 );
674 return Status;
675}
676
690EFIAPI
692 IN EFI_HANDLE ImageHandle
693 )
694{
695 EFI_STATUS Status;
697 REST_JSON_STRUCTURE_INSTANCE *NextInstance;
698
699 Status = gBS->UninstallProtocolInterface (
700 mProtocolHandle,
701 &gEfiRestJsonStructureProtocolGuid,
702 (VOID *)&mRestJsonStructureProtocol
703 );
704
705 if (IsListEmpty (&mRestJsonStructureList)) {
706 return Status;
707 }
708
709 //
710 // Free memory of REST_JSON_STRUCTURE_INSTANCE instance.
711 //
712 Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList);
713 do {
714 NextInstance = NULL;
715 if (!IsNodeAtEnd (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
716 NextInstance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
717 }
718
719 FreePool ((VOID *)Instance);
720 Instance = NextInstance;
721 } while (Instance != NULL);
722
723 return Status;
724}
UINT64 UINTN
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
Definition: LinkedList.c:403
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
Definition: LinkedList.c:333
BOOLEAN EFIAPI IsNodeAtEnd(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
Definition: LinkedList.c:481
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
Definition: LinkedList.c:298
INTN EFIAPI AsciiStrCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
Definition: String.c:716
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
Definition: LinkedList.c:182
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
Definition: LinkedList.c:259
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define NULL
Definition: Base.h:319
#define TRUE
Definition: Base.h:301
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:434
EFI_STATUS(EFIAPI * EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE)(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_STRUCTURE_HEADER *JsonStructureHeader)
struct _EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER
EFI_STATUS(EFIAPI * EFI_REST_JSON_STRUCTURE_TO_STRUCTURE)(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *JsonRsrcIdentifier OPTIONAL, IN CHAR8 *ResourceJsonText, OUT EFI_REST_JSON_STRUCTURE_HEADER **JsonStructure)
EFI_STATUS(EFIAPI * EFI_REST_JSON_STRUCTURE_TO_JSON)(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_STRUCTURE_HEADER *JsonStructureHeader, OUT CHAR8 **ResourceJsonText)
EFI_STATUS EFIAPI RestJsonStructureRegister(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_STRUCTURE_SUPPORTED *JsonStructureSupported, IN EFI_REST_JSON_STRUCTURE_TO_STRUCTURE ToStructure, IN EFI_REST_JSON_STRUCTURE_TO_JSON ToJson, IN EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE DestroyStructure)
EFI_STATUS EFIAPI RestJsonStructureEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI RestJsonStructureToStruct(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier OPTIONAL, IN CHAR8 *ResourceJsonText, OUT EFI_REST_JSON_STRUCTURE_HEADER **JsonStructure)
EFI_STATUS EFIAPI RestJsonStructureUnload(IN EFI_HANDLE ImageHandle)
EFI_STATUS InterpreterInstanceDestoryJsonStruct(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance, IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader)
EFI_STATUS InterpreterEfiStructToInstance(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance, IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader, OUT CHAR8 **ResourceRaw)
EFI_STATUS InterpreterInstanceToStruct(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance, IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier OPTIONAL, IN CHAR8 *ResourceRaw, OUT EFI_REST_JSON_STRUCTURE_HEADER **RestJSonHeader)
EFI_STATUS EFIAPI RestJsonStructureToJson(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader, OUT CHAR8 **ResourceRaw)
EFI_STATUS EFIAPI RestJsonStructureDestroyStruct(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
@ EFI_NATIVE_INTERFACE
Definition: UefiSpec.h:1193
EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE NameSpace
Namespace of this resource type.
CHAR8 * ResourceTypeName
Resource type name.
CHAR8 * MinorVersion
Resource minor version.
CHAR8 * ErrataVersion
Resource errata version.
CHAR8 * MajorVersion
Resource major version.
EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER RestResourceInterp
JSON resource type this convertor supports.
LIST_ENTRY NextSupportedRsrcInterp
Linklist to next supported conversion.
UINTN NumberOfNameSpaceToConvert
Number of resource type this convertor supports.
EFI_REST_JSON_STRUCTURE_TO_STRUCTURE JsonToStructure
JSON to C structure function.
EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER * SupportedRsrcIndentifier
The supported resource type array.
EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE DestroyStructure
Destory C struture function.
LIST_ENTRY NextRestJsonStructureInstance
Next convertor instance.
EFI_REST_JSON_STRUCTURE_TO_JSON StructureToJson
C structure to JSON function.