Commit Graph

36 Commits

Author SHA1 Message Date
Frediano Ziglio
a0c184e89b stream-device: Add device to handle streaming
Add a stub device in guest.
The aim of this device is to make it possible for the guest to send a
stream through a DisplayChannel (in the sense of protocol channel).
This stub allows the guest to send some data and you can see some debug
lines of data arrived on host logs.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-16 19:59:14 +01:00
Frediano Ziglio
930a1196e3 char-device: Allows to handle port events from any char device
From spice_server_port_event API you can send port events to
any char device. Although currently this is used only for "port"
devices implemented in spicevmc.c this will allow to support
such events using different objects.

This will be used for instance for a streaming device which
will be a specific SpicePort implementation.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-08-23 16:11:49 +01:00
Christophe Fergeau
113b7c8f5e Make RedCharDeviceWriteBuffer::refs private
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
76a06bdef8 Make RedCharDeviceWriteBuffer::token_price private
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
8dc7505ae9 Make RedCharDeviceWriteBuffer::client private
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
3fe4c661ef Make RedCharDeviceWriteBuffer::origin private
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
968f3ab3e8 Add RedCharDeviceWriteBufferPrivate
This is intended to hold the fields that only char-device.c has a use
for, but for now this only adds the boilerplate for it, the next commit
will move the relevant field there.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-28 16:59:25 +02:00
Christophe Fergeau
bc5326b1ce Unify header guards
This changes the header guards in all .h files to follow this format:

/*
 * Licensing block
 */

/* ... */

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-03-30 18:17:20 +01:00
Christophe Fergeau
6377b72d44 Use bool rather than int return values when appropriate
This commit changes all functions returning TRUE/FALSE from having an
'int' return value to 'bool'.
This way it's obvious that such a function is not going to return
anything else than TRUE or FALSE.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-03-09 18:39:29 +01:00
Jonathon Jongsma
e86f9521db char-device: add 'self' param to vfuncs
Add a 'self' parameter to all of the char device virtual functions so
that we don't have to play games with the 'opaque' pointer.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-14 14:30:47 +00:00
Jonathon Jongsma
8340688c9d Change RedCharDevice::write_queue to GQueue
Change a couple more Rings to GQueue
2016-09-19 07:47:05 -05:00
Frediano Ziglio
6fbefcc3c3 Remove obsolete comment
AGENT_CONNECT with token count is implemented by agent_connected_tokens
message.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-06-01 16:21:07 +01:00
Frediano Ziglio
8a314520cc Fix some typos in comments
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-06-01 16:09:44 +01:00
Frediano Ziglio
3349610652 char-device: Update function names in documentation
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-05-18 00:24:37 +01:00
Frediano Ziglio
6433d94636 reset pointer to RedCharDeviceWriteBuffer calling red_char_device_write_buffer_release
This code make easier to be sure we don't have dangling pointers
resetting in the function which free the structure.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-05-10 16:53:33 +01:00
Frediano Ziglio
7c79c0f6a8 char-device: improved comment
- fix typo;
- simplify sentence.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-05-09 14:21:58 +01:00
Jonathon Jongsma
b9720d80e0 Rename PipeItem to RedPipeItem
Following internal type naming conventions

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-27 10:22:01 -05:00
Christophe Fergeau
48e85a11c7 char-device: Remove RedCharDeviceClass::{un, }ref_msg_to_client
Now that client messages are always RedPipeItem, we don't need virtual
functions to know how to ref/unref them.
2016-04-15 11:14:36 -05:00
Christophe Fergeau
021d960471 char-device: Replace RedCharDeviceMsgToClient with PipeItem
Now that all derived classes use a type deriving from PipeItem for their
RedCharDeviceMsgToClient, we can make this explicit in the
RedCharDeviceClass vfuncs, and remove the RedCharDeviceMsgToClient
typedef.
2016-04-15 11:14:36 -05:00
Christophe Fergeau
0c6e51011b Move RedCharDeviceCallbacks into RedCharDeviceClass
This structure holding virtual function pointers was kept until now as a
RedCharDevice member in order to make the GObject conversion easier.
Now that all RedCharDevice children are converted to GObject, it can be
moved into RedCharDeviceClass.
2016-04-07 11:42:37 -05:00
Christophe Fergeau
87b6b9273d reds: Remove red_char_device_new()
Nothing is using it anymore now that CharDevice classes are
gobjectified.
2016-04-07 11:42:24 -05:00
Christophe Fergeau
e37f97a9f8 reds: Move RedsState typedef to red-common.h
This allows to stop using struct RedsState * rather than RedsState * in
headers which cannot include reds.h. This also allows to remove the
duplicate RedsState typedef in reds.h and reds-stream.h which is causing
issues with older gcc versions.
2016-04-06 10:30:00 +02:00
Christophe Fergeau
4d3c8bdb98 char-device: Remove duplicate typedef 2016-04-05 16:49:40 +02:00
Christophe Fergeau
96bde4bf95 char-device: Make RedCharDevice a GObject
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-02 18:06:51 +01:00
Frediano Ziglio
77946c395b Rename some missing names related to RedCharDevice
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-04-01 14:40:44 +01:00
Frediano Ziglio
742612f34d Rename SpiceCharDeviceCallbacks to RedCharDeviceCallbacks
The structure is an internal one so should not have the Spice prefix
but use the Red one.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-04-01 14:33:54 +01:00
Jonathon Jongsma
a24ebcae89 Rename RedCharDevice functions
make the function names match the type names. So
spice_char_device_state_* becomes red_char_device_* and
spice_char_device_* also becomes red_char_device_*.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-01 11:59:46 +01:00
Jonathon Jongsma
b693eae580 Rename SpiceCharDeviceState to RedCharDevice
This is more consistent with internal type naming convention, and it
paves the way for a new char device GObject heirarchy

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-01 11:59:43 +01:00
Jonathon Jongsma
f3028e9ada Rename SpiceCharDeviceWriteBuffer to RedCharDeviceWriteBuffer
Internal types should use 'Red' namespace for consistency

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-01 11:59:40 +01:00
Jonathon Jongsma
f02b66a225 Rename SpiceCharDeviceMsgToClient to RedCharDeviceMsgToClient
Internal types should use Red namespace for consistency

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-01 11:59:33 +01:00
Christophe Fergeau
e5c89b0b60 Introduce spice_char_device_get_interface()
Hides awkward casting/dereferencing to go from a
SpiceCharDeviceInstance to a SpiceCharDeviceInterface

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-09 17:33:43 +00:00
Jonathon Jongsma
abcbf20d8b Add RedsState arg to smartcard_device_connect()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-12 15:10:53 +00:00
Jonathon Jongsma
a8dc9b0936 Add RedsState arg to spicevmc_device_connect|disconnect()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11 13:57:41 +00:00
Jonathon Jongsma
b830f193a1 char-device: use local 'reds' variable
Store a reference to the server in the SpiceCharDeviceState struct and
use that rather than the global 'reds' variable

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11 13:57:30 +00:00
Jonathon Jongsma
b85c8295d6 Remove use of global 'reds' var from spice_server_remove_interface()
Since this is public API, we can't easily change the signature of the
function to take a RedsState argument, so instead we apply a hack and
store the reds argument inside the device state struct when the
interface is added, and retrieve it for use later when it is removed.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-03 08:41:37 +00:00
Frediano Ziglio
525cd67be7 server: rename files
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-03 23:54:32 +00:00