diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-12-21 12:26:38 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-05-04 15:34:41 +0400 |
commit | 123676e9894fa221943eafda97e6954c2819b215 (patch) | |
tree | 74493cf16ad5b034bedf1ffab9e3dff663deeeb9 /chardev | |
parent | bc763d71440552b677bc372e8261b9d127330657 (diff) |
char-socket: add 'addr' property
Add a property to lookup the connection details.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'chardev')
-rw-r--r-- | chardev/char-socket.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/chardev/char-socket.c b/chardev/char-socket.c index f24961ad16..5a5840edb1 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -1009,6 +1009,15 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, sock->addr = addr; } +static void +char_socket_get_addr(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + SocketChardev *s = SOCKET_CHARDEV(obj); + + visit_type_SocketAddress(v, name, &s->addr, errp); +} + static void char_socket_class_init(ObjectClass *oc, void *data) { ChardevClass *cc = CHARDEV_CLASS(oc); @@ -1024,6 +1033,10 @@ static void char_socket_class_init(ObjectClass *oc, void *data) cc->chr_add_client = tcp_chr_add_client; cc->chr_add_watch = tcp_chr_add_watch; cc->chr_update_read_handler = tcp_chr_update_read_handler; + + object_class_property_add(oc, "addr", "SocketAddress", + char_socket_get_addr, NULL, + NULL, NULL, &error_abort); } static const TypeInfo char_socket_type_info = { |