Commit Graph

24 Commits

Author SHA1 Message Date
Frediano Ziglio
dd9b78fd78 Use smart pointers for RedPipeItem
Reduces usage of manual reference counting.
Avoids usage of new and use instead red::make_shared to both
create and own pipe items.
Use move semantic to reduce useless copies.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-07-13 19:48:08 +01:00
Frediano Ziglio
6a230f3609 smartcard: Remove usage of tokens
RedCharDeviceSmartcard is not using token handling (which is designed
only for VDAgent) so push directly to client.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-07-03 10:47:34 +01:00
Frediano Ziglio
a10e496c46 char-device: Remove "sin" parameter from read_one_msg_from_device
Not much used, can be retrieved from the class if needed.

There are some apparent test removal on reds.cpp.
The test "if (!reds->vdagent)" apparently disappeared but it's included in
the while.
reds->agent_dev cannot be NULL as SPICE server allows only one agent and we
are into a member of an object so it must be reds->agent_dev.get() == this.
As there's only an agent and as the interface (sin) is extracted from that
agent it must be reds->agent_dev.get() == sin->st and either reds->vdagent
== sin or reds->vdagent == NULL.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@gmail.com>
2020-06-23 12:49:43 +01:00
Frediano Ziglio
1e9205a3b8 char-device: Remove GObject from RedCharDevice
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
43c6bf91b7 reds: Remove a weak pointer usage
RedCharDevice can all be removed just calling unref, beside
the agent that needs special threatment.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
ea0d056bb7 char-device: Define and use (un)ref
Prepare to remove GObject.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
77af39d6b5 Update header style
Avoid typedef useless in C++.
Remove useless forward declarations.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00
Frediano Ziglio
e0b395fb68 Declare exported functions as C
Allows to be used by both C and C++ code.
So to leave part of the code in C and part move to C++.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:08 +01:00
Frediano Ziglio
223bfed649 Reuse SPICE_DECLARE_TYPE macro
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-11-21 08:38:44 +00: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
Frediano Ziglio
32aa710d22 Split RedCharDeviceSmartcard and SmartCardChannelClient 2016-09-30 13:14:03 +01:00
Frediano Ziglio
f36c3887ba Make sure all headers are independent
Make sure is possible to include any headers alone.

I used this script to check independence (run under server directory):
----
#!/bin/bash

set -e

# check not already modified
if grep -q libheaders.la Makefile.am; then
    echo "Header library already prepared" >&2
    exit 1
fi

add_lib() {
    local hdr="$1"

    hdr=${hdr%.h}
    c="mao_${hdr}.c"
    echo "#include \"${hdr}.h\"" > $c
    echo -e "\t$c \\" >&3
}

# add library to compile all headers alones
exec 3>> Makefile.am
echo "
noinst_LTLIBRARIES += libheaders.la
libheaders_la_SOURCES =				\\" >&3
for hdr in *.h; do
    case $hdr in
    spice-bitmap-utils.h)
        add_lib $hdr
        ;;
    spice*.h)
        ;;
    *)
        add_lib $hdr
        ;;
    esac
done
echo -e "\t\$(NULL)" >&3
exec 3>&-
----

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-05-18 00:24:37 +01:00
Christophe Fergeau
d2e6696fb3 smartcard: Turn RedCharDeviceSmartcard into a GObject
This inherits from RedCharDevice. Once all char device states are
converted, we can turn the associated vfuncs into RedCharDeviceClass
vfuncs.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2016-04-06 11:37:07 -05: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
Christophe Fergeau
23d328f713 smartcard: Move private constant to C file
APDUBufSize is only used within smartcard.c, no need to expose it in
smartcard.h

Acked-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-10 11:52:52 +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
Marc-André Lureau
3c6b4e415f Remove spice-experimental
Remove unneded symbols that nobody should be using anyway.
ABI is modified with this patch, but the library version is not bumped.
2015-01-15 18:34:26 +01:00
Yonit Halperin
c514a1d903 smartcard: use SpiceCharDeviceState for managing reading from the device
This patch and the following one do not introduce tokening to the smartcard
channel. But this can be done easily later, by setting the appropriate
variables in SpiceCharDeviceState (after adding the appropriate protocol messages,
and implementing this in the client side).
2012-07-03 14:13:42 +03:00
Marc-André Lureau
359fc1cb5d Use the spice-common submodule
This patch will replace the common/ directory with the spice-common
project. It is for now a simple project subdirectory shared with
spice-gtk, but the goal is to make it a proper library later on.

With this change, the spice-server build is broken. The following
commits fix the build, and have been seperated to ease the review.

v2
- moves all the generated marshallers to spice-common library
- don't attempt to fix windows VS build, which should somehow be
  splitted with spice-common (or built from tarball only to avoid
  generation tools/libs deps)
v3
- uses libspice-common-client
- fix a mutex.h inclusion reported by Alon
2012-03-25 18:59:10 +02:00
Daniel P. Berrange
02d56750bd Remove trailing blank lines
Remove any blank lines at the end of all source files
2012-01-13 18:11:59 +02:00
Christophe Fergeau
f045886a06 remove unused function 2011-07-19 13:31:10 +02:00
Christophe Fergeau
da584a5e2d add missing "LGPLv2.1 or later" header to source files 2011-05-02 11:24:44 +02:00
Christophe Fergeau
8a1ceb65fa use foo(void) instead of foo() in prototypes
In C, the latter isn't a prototype for a function with no arg,
but declares a function with an undefined number of args.
2011-05-02 11:24:44 +02:00
Alon Levy
d99ec6c35b smartcard: server side (not enabled yet) 2010-12-07 13:31:42 +02:00