Skip to content

Commit

Permalink
Add ability to return data in a PortControlResponse message
Browse files Browse the repository at this point in the history
This commit adds a string field to the PortControlResponse message that
can be used to return data from virtio-forwarder when requested by the
port control script. The string field is meant to be generic and future
"query" operations can make use of this field to return requested data
to the user.

Signed-off-by: Heinrich Kuhn <[email protected]>
Signed-off-by: Simon Horman <[email protected]>
  • Loading branch information
Heinrich Kuhn committed Nov 26, 2021
1 parent b5cca74 commit f014e68
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/python2/virtioforwarder_port_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ def main():
if reply.status != reply.OK:
print(reply)
return 1
# If the reply contains a generic string response then output it here
if reply.query_string != '':
print(reply.query_string)
return 0


Expand Down
3 changes: 3 additions & 0 deletions scripts/python3/virtioforwarder_port_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ def main():
if reply.status != reply.OK:
print(reply)
return 1
# If the reply contains a generic string response then output it here
if reply.query_string != '':
print(reply.query_string)
return 0


Expand Down
3 changes: 3 additions & 0 deletions virtioforwarder.proto
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ message PortControlResponse {

// Source of @a error_code.
optional string error_code_source = 6;

// Generic query string to be used when data should be returned
optional string query_string = 7;
}

// State of an individual relay, including statistics.
Expand Down

0 comments on commit f014e68

Please sign in to comment.