From e3a73a504f6a63bf1a716131cf9dea75dc7b0b41 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Fri, 6 Sep 2024 12:25:01 +0200 Subject: rest: add GET /efi Add GET /efi request to obtain information about the client's boot entries. Field inside the /refresh payload 'efi': { 'entries': [ { "order": 0, "name": "Boot0000", "active": false, "description": "grub" }, { "order": 1, "name": "Boot0001", "active": true, "description": "UEFI: PXE IP4 Realtek PCIe GBE Family Controller" } ] } If the client is not a EFI system it won't add the 'efi' field. If an entry is not in the boot order it won't have the 'order' field. GET /efi resquest payload structure: { 'clients': ['10.141.10.21', '10.141.10.22'] } GET /efi response's structure: { 'clients': [ { 'ip': '10.141.10.21', 'entries': [ { "order": 0, "name": "Boot0000", "active": false, "description": "grub" }, { "order": 1, "name": "Boot0001", "active": true, "description": "UEFI: PXE IP4 Realtek PCIe GBE Family Controller" } ] }, { 'ip': '10.141.10.22', 'entries': [] } ] } The client with ip 10.141.10.22 is a BIOS system. If an entry does not appear in the boot order it won't have the 'order' field. --- src/json.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/json.h') diff --git a/src/json.h b/src/json.h index d3838cf..421f88d 100644 --- a/src/json.h +++ b/src/json.h @@ -2,6 +2,7 @@ #define _OG_JSON_H #include +#include #include "schedule.h" int og_json_parse_string(const json_t *element, const char **str); @@ -146,4 +147,22 @@ struct og_cache_image { void og_cache_image_free(struct list_head *cache_list); int og_json_parse_cache(json_t *element, struct list_head *cache_list); + +#define OG_PARAM_EFI_ENTRIES (1UL << 0) +#define OG_PARAM_EFI_ORDER (1UL << 1) +#define OG_PARAM_EFI_NAME (1UL << 2) +#define OG_PARAM_EFI_DESCRIPTION (1UL << 3) +#define OG_PARAM_EFI_ACTIVE (1UL << 4) + +struct og_boot_entry { + const char *description; + const char *name; + bool active; + uint64_t order; + struct list_head list; +}; + +void og_boot_entry_free(struct list_head *boot_entry_list); +int og_json_parse_efi(json_t *element, struct list_head *boot_entry_list); + #endif -- cgit v1.2.3-18-g5258