qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] vnc: Use inet_strfamily()
Date: Wed, 20 Jan 2010 11:42:40 -0200	[thread overview]
Message-ID: <1263994960-8411-4-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1263994960-8411-1-git-send-email-lcapitulino@redhat.com>

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 vnc.c |   22 +---------------------
 1 files changed, 1 insertions(+), 21 deletions(-)

diff --git a/vnc.c b/vnc.c
index c7d6652..cc2a26e 100644
--- a/vnc.c
+++ b/vnc.c
@@ -100,26 +100,6 @@ char *vnc_socket_remote_addr(const char *format, int fd) {
     return addr_to_string(format, &sa, salen);
 }
 
-static QString *get_sock_family(const struct sockaddr_storage *sa)
-{
-    const char *name;
-
-    switch (sa->ss_family)
-    {
-        case AF_INET:
-            name = "ipv4";
-            break;
-        case AF_INET6:
-            name = "ipv6";
-            break;
-        default:
-            name = "unknown";
-            break;
-    }
-
-    return qstring_from_str(name);
-}
-
 static int put_addr_qdict(QDict *qdict, struct sockaddr_storage *sa,
                           socklen_t salen)
 {
@@ -138,7 +118,7 @@ static int put_addr_qdict(QDict *qdict, struct sockaddr_storage *sa,
 
     qdict_put(qdict, "host", qstring_from_str(host));
     qdict_put(qdict, "service", qstring_from_str(serv));
-    qdict_put(qdict, "family", get_sock_family(sa));
+    qdict_put(qdict, "family",qstring_from_str(inet_strfamily(sa->ss_family)));
 
     return 0;
 }
-- 
1.6.6

      parent reply	other threads:[~2010-01-20 13:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-20 13:42 [Qemu-devel] [PATCH 0/3]: Small VNC related cleanup Luiz Capitulino
2010-01-20 13:42 ` [Qemu-devel] [PATCH 1/3] net: Make inet_strfamily() public Luiz Capitulino
2010-01-20 14:56   ` Anthony Liguori
2010-01-20 13:42 ` [Qemu-devel] [PATCH 2/3] net: inet_strfamily(): Better unknown family report Luiz Capitulino
2010-01-20 13:42 ` Luiz Capitulino [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263994960-8411-4-git-send-email-lcapitulino@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).