Skip to content

Commit

Permalink
[libdnf, actions plugin] Implement "json" communication mode
Browse files Browse the repository at this point in the history
Processes send requests and the actions plugin responds.

- Request format:
{"op":"<operation>", "domain":"<domain>", "args":{<op_domain_spec_args>}}

"domain" is ignored in the case of the "log" operation.

- Response format:
{"op": "reply", "requested_op":"<op_from_request>", "domain":
"<domain_from_request>", "status": "OK", "return":{<data>}}

{"op": "reply", "requested_op":"<op_from_request>", "domain":
"<domain_from_request>", "status": "ERROR", "message":"<error message>"}

"return" is not included in the response to a request for a "log"
operation.

If the JSON request is unparsable - a syntax error or incomplete message,
or the response cannot be written, the action plugin closes both communication
pipes. The process must terminate if the communication pipes are closed.
  • Loading branch information
jrohel authored and kontura committed Sep 20, 2024
1 parent 15d5cc4 commit 2d58ea5
Show file tree
Hide file tree
Showing 2 changed files with 789 additions and 4 deletions.
4 changes: 4 additions & 0 deletions libdnf5-plugins/actions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ add_library(actions MODULE actions.cpp)
# disable the 'lib' prefix in order to create actions.so
set_target_properties(actions PROPERTIES PREFIX "")

pkg_check_modules(JSONC REQUIRED json-c)
include_directories(${JSONC_INCLUDE_DIRS})
target_link_libraries(actions PRIVATE ${JSONC_LIBRARIES})

target_link_libraries(actions PRIVATE libdnf5)

install(TARGETS actions LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/libdnf5/plugins/")
Expand Down
Loading

0 comments on commit 2d58ea5

Please sign in to comment.