Skip to content

Commit

Permalink
libvmi: libvmi_cdef: Add JSON and FILE_PATH config options
Browse files Browse the repository at this point in the history
  • Loading branch information
netanelc305 committed Dec 21, 2023
1 parent c4105af commit e364ccd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libvmi/libvmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ class VMIConfig(Enum):
GLOBAL_FILE_ENTRY = lib.VMI_CONFIG_GLOBAL_FILE_ENTRY
STRING = lib.VMI_CONFIG_STRING
DICT = lib.VMI_CONFIG_GHASHTABLE
JSON_PATH = lib.VMI_CONFIG_JSON_PATH
FILE_PATH = lib.VMI_CONFIG_FILE_PATH


class VMIStatus(Enum):
Expand Down Expand Up @@ -318,8 +320,8 @@ def __init__(self, domain, init_flags=INIT_DOMAINNAME, init_data=None,
# from str to bytes
if init_flags & INIT_DOMAINNAME or init_flags & INIT_DOMAINID:
domain = domain.encode()
# same for VMI_CONFIG_STRING
if config_mode == VMIConfig.STRING:
# same for VMI_CONFIG_STRING | VMI_CONFIG_FILE_PATH | VMI_CONFIG_JSON_PATH
if config_mode in [VMIConfig.STRING, VMIConfig.FILE_PATH, VMIConfig.JSON_PATH]:
config = config.encode()
elif config_mode == VMIConfig.DICT:
# need to convert config to a GHashTable
Expand Down
4 changes: 4 additions & 0 deletions libvmi/libvmi_cdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ typedef enum vmi_config {
VMI_CONFIG_STRING, /**< config string provided */

VMI_CONFIG_GHASHTABLE, /**< config GHashTable provided */

VMI_CONFIG_JSON_PATH, /**< config in json file at the location provided */

VMI_CONFIG_FILE_PATH, /**< config file path provided */
} vmi_config_t;

// vmi_mode
Expand Down

0 comments on commit e364ccd

Please sign in to comment.