{"id":1571496,"url":"http://patchwork.ozlabs.org/api/patches/1571496/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20211221065855.142578-33-marcandre.lureau@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20211221065855.142578-33-marcandre.lureau@redhat.com>","list_archive_url":null,"date":"2021-12-21T06:58:51","name":"[PULL,v2,32/36] chardev: make socket derivable","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"6ccc604f6a1b3b46a74822e92926776b4d2a80bf","submitter":{"id":66774,"url":"http://patchwork.ozlabs.org/api/people/66774/?format=json","name":"Marc-André Lureau","email":"marcandre.lureau@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20211221065855.142578-33-marcandre.lureau@redhat.com/mbox/","series":[{"id":277865,"url":"http://patchwork.ozlabs.org/api/series/277865/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=277865","date":"2021-12-21T06:58:19","name":"[PULL,v2,01/36] ui/vdagent: add CHECK_SPICE_PROTOCOL_VERSION","version":2,"mbox":"http://patchwork.ozlabs.org/series/277865/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/1571496/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/1571496/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["bilbo.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=P75Yv98r;\n\tdkim-atps=neutral","ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=<UNKNOWN>)","relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby bilbo.ozlabs.org (Postfix) with ESMTPS id 4JJ7p35K6Cz9s3q\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Dec 2021 18:47:06 +1100 (AEDT)","from localhost ([::1]:35750 helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1mzZrS-00075A-Ff\n\tfor incoming@patchwork.ozlabs.org; Tue, 21 Dec 2021 02:47:02 -0500","from eggs.gnu.org ([209.51.188.92]:59256)\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1mzZG0-0002yy-Fu\n for qemu-devel@nongnu.org; Tue, 21 Dec 2021 02:08:20 -0500","from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45175)\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1mzZFy-0002Y0-Q8\n for qemu-devel@nongnu.org; Tue, 21 Dec 2021 02:08:20 -0500","from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-480-9wESNo6ENsCWMovwqpLCtg-1; Tue, 21 Dec 2021 02:08:15 -0500","from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com\n [10.5.11.14])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 19FFD1023F54;\n Tue, 21 Dec 2021 07:08:14 +0000 (UTC)","from localhost (unknown [10.39.208.37])\n by smtp.corp.redhat.com (Postfix) with ESMTP id C96A97A3FB;\n Tue, 21 Dec 2021 07:07:58 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1640070498;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=HfIbodvuKLf+0Hux9L/KexjKL4WEUJTO8nSSAZV7rLg=;\n b=P75Yv98rmi2knjhmdZSI7odG8Iajaf55HcAa6E9DDDzzwvJMEWWG0sPBI3SvxP18TuIGGI\n 3zSNVQFkrUTlnLpEKK4Bt67M1givLOawYNttR+BJmcwGB2Cnb3/x70JVetzZA1KLNJAG4/\n g2gG/dzdGaNoFAK7fhLaoVkD/UXtKTo=","X-MC-Unique":"9wESNo6ENsCWMovwqpLCtg-1","From":"marcandre.lureau@redhat.com","To":"qemu-devel@nongnu.org","Subject":"[PULL v2 32/36] chardev: make socket derivable","Date":"Tue, 21 Dec 2021 10:58:51 +0400","Message-Id":"<20211221065855.142578-33-marcandre.lureau@redhat.com>","In-Reply-To":"<20211221065855.142578-1-marcandre.lureau@redhat.com>","References":"<20211221065855.142578-1-marcandre.lureau@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.14","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=170.10.133.124;\n envelope-from=marcandre.lureau@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com","X-Spam_score_int":"-29","X-Spam_score":"-3.0","X-Spam_bar":"---","X-Spam_report":"(-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.203,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,\n SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"peter.maydell@linaro.org, richard.henderson@linaro.org, =?utf-8?q?Marc-A?=\n\t=?utf-8?q?ndr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"From: Marc-André Lureau <marcandre.lureau@redhat.com>\n\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\nAcked-by: Gerd Hoffmann <kraxel@redhat.com>\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\n---\n include/chardev/char-socket.h | 84 +++++++++++++++++++++++++++++++++++\n chardev/char-socket.c         | 58 +-----------------------\n 2 files changed, 85 insertions(+), 57 deletions(-)\n create mode 100644 include/chardev/char-socket.h","diff":"diff --git a/include/chardev/char-socket.h b/include/chardev/char-socket.h\nnew file mode 100644\nindex 000000000000..1a9274f2e3ac\n--- /dev/null\n+++ b/include/chardev/char-socket.h\n@@ -0,0 +1,84 @@\n+/*\n+ * QEMU System Emulator\n+ *\n+ * Copyright (c) 2003-2008 Fabrice Bellard\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\n+ * of this software and associated documentation files (the \"Software\"), to deal\n+ * in the Software without restriction, including without limitation the rights\n+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ * copies of the Software, and to permit persons to whom the Software is\n+ * furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included in\n+ * all copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+ * THE SOFTWARE.\n+ */\n+#ifndef CHAR_SOCKET_H_\n+#define CHAR_SOCKET_H_\n+\n+#include \"io/channel-socket.h\"\n+#include \"io/channel-tls.h\"\n+#include \"io/net-listener.h\"\n+#include \"chardev/char.h\"\n+#include \"qom/object.h\"\n+\n+#define TCP_MAX_FDS 16\n+\n+typedef struct {\n+    char buf[21];\n+    size_t buflen;\n+} TCPChardevTelnetInit;\n+\n+typedef enum {\n+    TCP_CHARDEV_STATE_DISCONNECTED,\n+    TCP_CHARDEV_STATE_CONNECTING,\n+    TCP_CHARDEV_STATE_CONNECTED,\n+} TCPChardevState;\n+\n+struct SocketChardev {\n+    Chardev parent;\n+    QIOChannel *ioc; /* Client I/O channel */\n+    QIOChannelSocket *sioc; /* Client master channel */\n+    QIONetListener *listener;\n+    GSource *hup_source;\n+    QCryptoTLSCreds *tls_creds;\n+    char *tls_authz;\n+    TCPChardevState state;\n+    int max_size;\n+    int do_telnetopt;\n+    int do_nodelay;\n+    int *read_msgfds;\n+    size_t read_msgfds_num;\n+    int *write_msgfds;\n+    size_t write_msgfds_num;\n+    bool registered_yank;\n+\n+    SocketAddress *addr;\n+    bool is_listen;\n+    bool is_telnet;\n+    bool is_tn3270;\n+    GSource *telnet_source;\n+    TCPChardevTelnetInit *telnet_init;\n+\n+    bool is_websock;\n+\n+    GSource *reconnect_timer;\n+    int64_t reconnect_time;\n+    bool connect_err_reported;\n+\n+    QIOTask *connect_task;\n+};\n+typedef struct SocketChardev SocketChardev;\n+\n+DECLARE_INSTANCE_CHECKER(SocketChardev, SOCKET_CHARDEV,\n+                         TYPE_CHARDEV_SOCKET)\n+\n+#endif /* CHAR_SOCKET_H_ */\ndiff --git a/chardev/char-socket.c b/chardev/char-socket.c\nindex a2b02e021d6b..d619088232d3 100644\n--- a/chardev/char-socket.c\n+++ b/chardev/char-socket.c\n@@ -25,9 +25,7 @@\n #include \"qemu/osdep.h\"\n #include \"chardev/char.h\"\n #include \"io/channel-socket.h\"\n-#include \"io/channel-tls.h\"\n #include \"io/channel-websock.h\"\n-#include \"io/net-listener.h\"\n #include \"qemu/error-report.h\"\n #include \"qemu/module.h\"\n #include \"qemu/option.h\"\n@@ -37,61 +35,7 @@\n #include \"qemu/yank.h\"\n \n #include \"chardev/char-io.h\"\n-#include \"qom/object.h\"\n-\n-/***********************************************************/\n-/* TCP Net console */\n-\n-#define TCP_MAX_FDS 16\n-\n-typedef struct {\n-    char buf[21];\n-    size_t buflen;\n-} TCPChardevTelnetInit;\n-\n-typedef enum {\n-    TCP_CHARDEV_STATE_DISCONNECTED,\n-    TCP_CHARDEV_STATE_CONNECTING,\n-    TCP_CHARDEV_STATE_CONNECTED,\n-} TCPChardevState;\n-\n-struct SocketChardev {\n-    Chardev parent;\n-    QIOChannel *ioc; /* Client I/O channel */\n-    QIOChannelSocket *sioc; /* Client master channel */\n-    QIONetListener *listener;\n-    GSource *hup_source;\n-    QCryptoTLSCreds *tls_creds;\n-    char *tls_authz;\n-    TCPChardevState state;\n-    int max_size;\n-    int do_telnetopt;\n-    int do_nodelay;\n-    int *read_msgfds;\n-    size_t read_msgfds_num;\n-    int *write_msgfds;\n-    size_t write_msgfds_num;\n-    bool registered_yank;\n-\n-    SocketAddress *addr;\n-    bool is_listen;\n-    bool is_telnet;\n-    bool is_tn3270;\n-    GSource *telnet_source;\n-    TCPChardevTelnetInit *telnet_init;\n-\n-    bool is_websock;\n-\n-    GSource *reconnect_timer;\n-    int64_t reconnect_time;\n-    bool connect_err_reported;\n-\n-    QIOTask *connect_task;\n-};\n-typedef struct SocketChardev SocketChardev;\n-\n-DECLARE_INSTANCE_CHECKER(SocketChardev, SOCKET_CHARDEV,\n-                         TYPE_CHARDEV_SOCKET)\n+#include \"chardev/char-socket.h\"\n \n static gboolean socket_reconnect_timeout(gpointer opaque);\n static void tcp_chr_telnet_init(Chardev *chr);\n","prefixes":["PULL","v2","32/36"]}