qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, richard.henderson@linaro.org,
	kraxel@redhat.com,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PULL 32/36] chardev: make socket derivable
Date: Fri, 17 Dec 2021 18:37:52 +0400	[thread overview]
Message-ID: <20211217143756.1831099-33-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20211217143756.1831099-1-marcandre.lureau@redhat.com>

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 include/chardev/char-socket.h | 84 +++++++++++++++++++++++++++++++++++
 chardev/char-socket.c         | 58 +-----------------------
 2 files changed, 85 insertions(+), 57 deletions(-)
 create mode 100644 include/chardev/char-socket.h

diff --git a/include/chardev/char-socket.h b/include/chardev/char-socket.h
new file mode 100644
index 000000000000..1a9274f2e3ac
--- /dev/null
+++ b/include/chardev/char-socket.h
@@ -0,0 +1,84 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef CHAR_SOCKET_H_
+#define CHAR_SOCKET_H_
+
+#include "io/channel-socket.h"
+#include "io/channel-tls.h"
+#include "io/net-listener.h"
+#include "chardev/char.h"
+#include "qom/object.h"
+
+#define TCP_MAX_FDS 16
+
+typedef struct {
+    char buf[21];
+    size_t buflen;
+} TCPChardevTelnetInit;
+
+typedef enum {
+    TCP_CHARDEV_STATE_DISCONNECTED,
+    TCP_CHARDEV_STATE_CONNECTING,
+    TCP_CHARDEV_STATE_CONNECTED,
+} TCPChardevState;
+
+struct SocketChardev {
+    Chardev parent;
+    QIOChannel *ioc; /* Client I/O channel */
+    QIOChannelSocket *sioc; /* Client master channel */
+    QIONetListener *listener;
+    GSource *hup_source;
+    QCryptoTLSCreds *tls_creds;
+    char *tls_authz;
+    TCPChardevState state;
+    int max_size;
+    int do_telnetopt;
+    int do_nodelay;
+    int *read_msgfds;
+    size_t read_msgfds_num;
+    int *write_msgfds;
+    size_t write_msgfds_num;
+    bool registered_yank;
+
+    SocketAddress *addr;
+    bool is_listen;
+    bool is_telnet;
+    bool is_tn3270;
+    GSource *telnet_source;
+    TCPChardevTelnetInit *telnet_init;
+
+    bool is_websock;
+
+    GSource *reconnect_timer;
+    int64_t reconnect_time;
+    bool connect_err_reported;
+
+    QIOTask *connect_task;
+};
+typedef struct SocketChardev SocketChardev;
+
+DECLARE_INSTANCE_CHECKER(SocketChardev, SOCKET_CHARDEV,
+                         TYPE_CHARDEV_SOCKET)
+
+#endif /* CHAR_SOCKET_H_ */
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index a2b02e021d6b..d619088232d3 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -25,9 +25,7 @@
 #include "qemu/osdep.h"
 #include "chardev/char.h"
 #include "io/channel-socket.h"
-#include "io/channel-tls.h"
 #include "io/channel-websock.h"
-#include "io/net-listener.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
 #include "qemu/option.h"
@@ -37,61 +35,7 @@
 #include "qemu/yank.h"
 
 #include "chardev/char-io.h"
-#include "qom/object.h"
-
-/***********************************************************/
-/* TCP Net console */
-
-#define TCP_MAX_FDS 16
-
-typedef struct {
-    char buf[21];
-    size_t buflen;
-} TCPChardevTelnetInit;
-
-typedef enum {
-    TCP_CHARDEV_STATE_DISCONNECTED,
-    TCP_CHARDEV_STATE_CONNECTING,
-    TCP_CHARDEV_STATE_CONNECTED,
-} TCPChardevState;
-
-struct SocketChardev {
-    Chardev parent;
-    QIOChannel *ioc; /* Client I/O channel */
-    QIOChannelSocket *sioc; /* Client master channel */
-    QIONetListener *listener;
-    GSource *hup_source;
-    QCryptoTLSCreds *tls_creds;
-    char *tls_authz;
-    TCPChardevState state;
-    int max_size;
-    int do_telnetopt;
-    int do_nodelay;
-    int *read_msgfds;
-    size_t read_msgfds_num;
-    int *write_msgfds;
-    size_t write_msgfds_num;
-    bool registered_yank;
-
-    SocketAddress *addr;
-    bool is_listen;
-    bool is_telnet;
-    bool is_tn3270;
-    GSource *telnet_source;
-    TCPChardevTelnetInit *telnet_init;
-
-    bool is_websock;
-
-    GSource *reconnect_timer;
-    int64_t reconnect_time;
-    bool connect_err_reported;
-
-    QIOTask *connect_task;
-};
-typedef struct SocketChardev SocketChardev;
-
-DECLARE_INSTANCE_CHECKER(SocketChardev, SOCKET_CHARDEV,
-                         TYPE_CHARDEV_SOCKET)
+#include "chardev/char-socket.h"
 
 static gboolean socket_reconnect_timeout(gpointer opaque);
 static void tcp_chr_telnet_init(Chardev *chr);
-- 
2.34.1.8.g35151cf07204



  parent reply	other threads:[~2021-12-17 15:14 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17 14:37 [PULL 00/36] ui: D-Bus display backend marcandre.lureau
2021-12-17 14:37 ` [PULL 01/36] ui/vdagent: add CHECK_SPICE_PROTOCOL_VERSION marcandre.lureau
2021-12-17 14:37 ` [PULL 02/36] ui/vdagent: replace #if 0 with protocol version check marcandre.lureau
2021-12-17 14:37 ` [PULL 03/36] ui: generalize clipboard notifier marcandre.lureau
2021-12-17 14:37 ` [PULL 04/36] ui/vdagent: add serial capability support marcandre.lureau
2021-12-17 14:37 ` [PULL 05/36] ui/clipboard: add qemu_clipboard_check_serial() marcandre.lureau
2021-12-17 14:37 ` [PULL 06/36] ui/clipboard: add a clipboard reset serial event marcandre.lureau
2021-12-17 14:37 ` [PULL 07/36] hw/display: report an error if virgl initialization failed marcandre.lureau
2021-12-17 14:37 ` [PULL 08/36] virtio-gpu: use VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP marcandre.lureau
2021-12-17 14:37 ` [PULL 09/36] ui: do not delay further remote resize marcandre.lureau
2021-12-17 21:14   ` Richard Henderson
2021-12-17 14:37 ` [PULL 10/36] ui: factor out qemu_console_set_display_gl_ctx() marcandre.lureau
2021-12-17 14:37 ` [PULL 11/36] ui: associate GL context outside of display listener registration marcandre.lureau
2021-12-17 14:37 ` [PULL 12/36] ui: make gl_block use a counter marcandre.lureau
2021-12-17 14:37 ` [PULL 13/36] ui: add a gl-unblock warning timer marcandre.lureau
2021-12-17 14:37 ` [PULL 14/36] ui: simplify gl unblock & flush marcandre.lureau
2021-12-17 14:37 ` [PULL 15/36] ui: dispatch GL events to all listeners marcandre.lureau
2021-12-17 14:37 ` [PULL 16/36] ui: split the GL context in a different object marcandre.lureau
2021-12-17 14:37 ` [PULL 17/36] ui: move qemu_spice_fill_device_address to ui/util.c marcandre.lureau
2021-12-17 14:37 ` [PULL 18/36] console: save current scanout details marcandre.lureau
2021-12-17 14:37 ` [PULL 19/36] scripts: teach modinfo to skip non-C sources marcandre.lureau
2021-12-17 14:37 ` [PULL 20/36] docs/sphinx: add sphinx modules to include D-Bus documentation marcandre.lureau
2021-12-17 14:37 ` [PULL 21/36] backends: move dbus-vmstate1.xml to backends/ marcandre.lureau
2021-12-17 14:37 ` [PULL 22/36] docs: move D-Bus VMState documentation to source XML marcandre.lureau
2021-12-17 14:37 ` [PULL 23/36] docs: add dbus-display documentation marcandre.lureau
2021-12-17 14:37 ` [PULL 24/36] build-sys: set glib dependency version marcandre.lureau
2021-12-17 14:37 ` [PULL 25/36] ui: add a D-Bus display backend marcandre.lureau
2021-12-17 14:37 ` [PULL 26/36] ui/dbus: add p2p=on/off option marcandre.lureau
2021-12-17 14:37 ` [PULL 27/36] tests/qtests: add qtest_qmp_add_client() marcandre.lureau
2021-12-17 14:37 ` [PULL 28/36] tests: start dbus-display-test marcandre.lureau
2021-12-17 14:37 ` [PULL 29/36] audio: add "dbus" audio backend marcandre.lureau
2021-12-17 14:37 ` [PULL 30/36] ui/dbus: add clipboard interface marcandre.lureau
2021-12-17 14:37 ` [PULL 31/36] chardev: teach socket to accept no addresses marcandre.lureau
2021-12-17 14:37 ` marcandre.lureau [this message]
2021-12-17 14:37 ` [PULL 33/36] option: add g_auto for QemuOpts marcandre.lureau
2021-12-17 14:37 ` [PULL 34/36] ui/dbus: add chardev backend & interface marcandre.lureau
2021-12-17 14:37 ` [PULL 35/36] ui/dbus: register D-Bus VC handler marcandre.lureau
2021-12-17 14:37 ` [PULL 36/36] MAINTAINERS: update D-Bus section marcandre.lureau

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=20211217143756.1831099-33-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).