Skip to content

Commit e364ccd

Browse files
author
netanelc305
committed
libvmi: libvmi_cdef: Add JSON and FILE_PATH config options
1 parent c4105af commit e364ccd

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

libvmi/libvmi.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ class VMIConfig(Enum):
150150
GLOBAL_FILE_ENTRY = lib.VMI_CONFIG_GLOBAL_FILE_ENTRY
151151
STRING = lib.VMI_CONFIG_STRING
152152
DICT = lib.VMI_CONFIG_GHASHTABLE
153+
JSON_PATH = lib.VMI_CONFIG_JSON_PATH
154+
FILE_PATH = lib.VMI_CONFIG_FILE_PATH
153155

154156

155157
class VMIStatus(Enum):
@@ -318,8 +320,8 @@ def __init__(self, domain, init_flags=INIT_DOMAINNAME, init_data=None,
318320
# from str to bytes
319321
if init_flags & INIT_DOMAINNAME or init_flags & INIT_DOMAINID:
320322
domain = domain.encode()
321-
# same for VMI_CONFIG_STRING
322-
if config_mode == VMIConfig.STRING:
323+
# same for VMI_CONFIG_STRING | VMI_CONFIG_FILE_PATH | VMI_CONFIG_JSON_PATH
324+
if config_mode in [VMIConfig.STRING, VMIConfig.FILE_PATH, VMIConfig.JSON_PATH]:
323325
config = config.encode()
324326
elif config_mode == VMIConfig.DICT:
325327
# need to convert config to a GHashTable

libvmi/libvmi_cdef.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ typedef enum vmi_config {
122122
VMI_CONFIG_STRING, /**< config string provided */
123123

124124
VMI_CONFIG_GHASHTABLE, /**< config GHashTable provided */
125+
126+
VMI_CONFIG_JSON_PATH, /**< config in json file at the location provided */
127+
128+
VMI_CONFIG_FILE_PATH, /**< config file path provided */
125129
} vmi_config_t;
126130

127131
// vmi_mode

0 commit comments

Comments
 (0)