Code Monkey home page Code Monkey logo

servus's People

Contributors

eile avatar gyohng avatar karjonas avatar ptoharia avatar tmarrinan avatar tribal-tec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

servus's Issues

find_package(Servus REQUIRED) does not work correctly on windows.

I am trying to use the Servus lib in a test app.
On windows i face the following issue
when i use find_package(Servus REQUIRED) in cmake file i get Servus_FOUND but the
Servus_INCLUDE_DIRS do no get populated.
on building i get
fatal error C1083: Cannot open include file: 'servus/servus.h': No such file or directory

However if i manually add the include DIRS to the cmake file am able to build and use servus in the app.

any idea how can i get it to work using just find_package()?

Win/OSX : ninja : "no work to do", vs2017 project nothing happens

Hello,
I'm trying to compile a static lib of Servus (or any type of lib for that matter..), but when I build it with cmake and then ninja (or vs 2017 x64), I don't find any generated lib file.

Do I miss a step ? Is there something missing in the readme to actually create a .lib (and header files as well) ?

What's strange is I remember having already done that last year, but I can't remember how and I'm stuck without knowing where to look...

Infos :

  • I have DNSSD installed and detected (i had to add an extra cmake_module with FindDNSSD but it works)
  • I'm not using Qt5 or Boost

Thanks

Strange .so library version

libServus.so.1.6.0
libServus.so.6

It's due to:

project(Servus VERSION 1.6.0)
set(Servus_VERSION_ABI 6)

I think it's strange:

  • it's servus-1.5.2, not servus-1.6.0
  • if the SONAME is libServus.so.6, I think the library version should be libServus.so.6.0.0

Kernel protection failure when calling select() on a file descriptor larger than FD_SETSIZE

I ran into this issue on macOS, in an application running a large number of sockets.

dnssd/servus.h sources use select() API calls inside of _handleEvents(). This only works well until the file descriptor reaches FD_SETSIZE. There is an error checking code for a valid file descriptor, but this code does not consider the fact that fd can be larger than zero and still invalid:

        assert(fd >= 0);
        if (fd < 0)
            return servus::Servus::Result(kDNSServiceErr_BadParam);

To continue using select() API call, one would need to check for it to be lower than FD_SETSIZE, but a better fix would be to switch to using poll() and WSAPoll() API calls.

cannot build if cloned as submodule

I just tried using Servus as a git submodule, but CMake happily refuses to configure with:

CMake Error: Could not open file for write in copy operation .../Servus/.git/hooks/pre-commit.tmp
CMake Error: : System Error: Not a directory
CMake Error at CMake/common/GitHooks.cmake:18 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMake/common/Common.cmake:152 (include)
  CMakeLists.txt:35 (include)

and indeed: Servus/.git is not a directory, but is a file, referencing the parent repository.

I figure this is actually a problem in https://github.com/Eyescale/CMake

installs to /usr by default

on un*x-systems, cmake --install will install to /usr by default.

i think this is really harmful, as the expected place is /usr/local, and on typical Linux distributions /usr is reserved for package-manager-installed software.

this again seems to be a problem with the CMake/common snippets.

how to get the port of a service?

now that i've started digging into Servus, it turns out that you cannot discover the port of a service.

e.g. in avahi.h, the uint16_t field which denotes the service port is simply unused:

static void _resolveCBS(AvahiServiceResolver* resolver, AvahiIfIndex,
AvahiProtocol, AvahiResolverEvent event,
const char* name, const char*, const char*,
const char* host, const AvahiAddress*, uint16_t,
AvahiStringList* txt, AvahiLookupResultFlags flags,
void* servus)

now i'm not an expert when it comes to ZeroConf, but in my understanding the port information is crucial for service discovery (at least this is what i gather than you always must provide a port when announcing a service; also, i don't know how one would actually reach a service without knowing both the host-address and the port).

have i been misusing Zeroconf, or is this just a weird omittance?

I'd suggest using the servus_port key for this information (though i admit i wonder why Servus would reserve any key (e.g. servus_host) for private use for obligatory information (like host-address, host-port, service-name and service-type))

Please provide .desktop file

It has GUI application (servusBrowser), so it should have .desktop file.

Attached is the .desktop file we used in Fedora downstream (just drop the .txt suffix, due to stupid github).
servus.desktop.txt

Unable to build project on MacOS

I simply followed the build steps:

git clone https://github.com/HBPVIS/Servus.git
mkdir Servus/build
cd Servus/build
cmake -GNinja ..
ninja

➜ build git:(master) cmake -GNinja ..
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 3.5)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
➜ build git:(master) cmake -GNinja .. -Wno-dev
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
➜ build git:(master)

Compile servus with avahi-client on ubuntu 16.04

I try to compile servus on a ubuntu 16.04 VM using following commands .
cmake ..
make

during cmake step following message gets logged
-- Servus [1.5.1-7-g059f391-dirty] without avahi-client

it seems that cmake is unable to find the avahi package.
Can you please let me know the step i need to take so that servus compiles with avahi-client

Missing stdexpect in Servus buld...

Fixed by adding <stdexcept.h> into Servus/servus/serializable.h

[sbanks@ys]~/git/ZeroBuf/build% make
Scanning dependencies of target Servus
[  5%] Building CXX object Servus/servus/CMakeFiles/Servus.dir/version.cpp.o
[ 10%] Building CXX object Servus/servus/CMakeFiles/Servus.dir/md5/md5.cc.o
[ 15%] Building CXX object Servus/servus/CMakeFiles/Servus.dir/serializable.cpp.o
In file included from /home/sbanks/git/ZeroBuf/Servus/servus/serializable.cpp:20:
/home/sbanks/git/ZeroBuf/Servus/servus/serializable.h: In member function ‘virtual bool servus::Serializable::_fromBinary(const void*, size_t)’:
/home/sbanks/git/ZeroBuf/Servus/servus/serializable.h:135:20: error: ‘runtime_error’ is not a member of ‘std’
  135 |         throw std::runtime_error("Binary deserialization not implemented");
      |                    ^~~~~~~~~~~~~
/home/sbanks/git/ZeroBuf/Servus/servus/serializable.h:136:5: error: no return statement in function returning non-void [-Werror=return-type]
  136 |     }

using DNSServiceGetAddrInfo to resolve IP address from hostname (with interface specification)

Hello,
I've been using getaddrinfo() to resolve IP from hostname, but the problem is that getaddrinfo() doesn't allow for specifying a network interface, and multiple devices with same hostname on different interfaces will not work with this method.
I couldn't find a generic method to work around this problem, except implementing the Bonjour / Avahi API.
DNSServiceGetAddrInfo allows to do that and it would make the library very powerful and complete to have that inside, especially since Bonjour and Avahi already have those methods ready to use.

I have tried myself but the callback of DNSServiceGetAddrInfo was never triggered, I'm not sure why but if someone has more insight on this this would be great !a

Support error reporting from serialization (binary & JSON)

Requires changes on the SerializeCallback and DeserializeCallback to have either return values or in-out parameters with enum for error code and an optional error message. This way, applications can add error reporting that is eventually transported to an HTTP client for instance.

namespace servus
{

...

// in the spirit of HTTP status codes
enum class Status
{
    OK,
    BAD_REQUEST,
    ...
}

struct Response
{
    Status status = OK;
    std::string message;
}

typedef std::function< void( Response& ) > DeserializedCallback;
typedef std::function< void( Response& ) > SerializeCallback;

}

find_package(Servus) does not set Servus_FOUND

Here's what I do:

  1. build Servus as a static library with -DCOMMON_LIBRARY_TYPE=STATIC
    • on macOS this uses the default DNS-SD installation
    • on Linux, this uses the installed libavahi-client-dev package
    • on Windows, this uses the Bonjour 4 Windows 3.0 SDK, which gets manually installed as C:\Program Files/Bonjour SDK and which is declared when building Servus via `-DDNSSD_DIR="C:\Program Files/Bonjour SDK"}
  2. after a successful built, install Servus with cmake --install
  • on macOS this installs to /usr/local (in order to workaround #111, the install path is manually set to this directory)
  • on Linux this installs to /usr
  • on Windows this installs to C:/Program Files (x86)/Servus
  1. in another project, use find_package(Servus REQUIRED)
  2. observe that this other project fails to configure on all platforms, because Servus cannot find the the zeroconf-backend

Windows (Msys/MinGW64 with VisualStudio):

CMake Warning at C:/msys64/mingw32/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  By not providing "FindDNSSD.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "DNSSD", but
  CMake did not find one.
  Could not find a package configuration file provided by "DNSSD" with any of
  the following names:
    DNSSDConfig.cmake
    dnssd-config.cmake
  Add the installation prefix of "DNSSD" to CMAKE_PREFIX_PATH or set
  "DNSSD_DIR" to a directory containing one of the above files.  If "DNSSD"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  C:/Program Files (x86)/Servus/Servus/CMake/ServusConfig.cmake:11 (find_dependency)
  CMakeLists.txt:17 (find_package)
CMake Warning at CMakeLists.txt:17 (find_package):
  Found package configuration file:
    C:/Program Files (x86)/Servus/Servus/CMake/ServusConfig.cmake
  but it set Servus_FOUND to FALSE so package "Servus" is considered to be
  NOT FOUND.  Reason given by package:
  Servus could not be found because dependency DNSSD could not be found.
CMake Debug Log at CMakeLists.txt:17 (find_package):
    C:/Program Files (x86)/Servus/Servus/CMake/ServusConfig.cmake

of course i set the DNSSD_DIR (to the same value as when building Servus itself) but this doesn't help.

macOS(11.4/BigSur)

CMake Warning at /usr/local/Cellar/cmake/3.22.2/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  By not providing "FindDNSSD.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "DNSSD", but
  CMake did not find one.
  Could not find a package configuration file provided by "DNSSD" with any of
  the following names:
    DNSSDConfig.cmake
    dnssd-config.cmake
  Add the installation prefix of "DNSSD" to CMAKE_PREFIX_PATH or set
  "DNSSD_DIR" to a directory containing one of the above files.  If "DNSSD"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  /usr/local/share/Servus/CMake/ServusConfig.cmake:11 (find_dependency)
  CMakeLists.txt:17 (find_package)
CMake Warning at CMakeLists.txt:17 (find_package):
  Found package configuration file:
    /usr/local/share/Servus/CMake/ServusConfig.cmake
  but it set Servus_FOUND to FALSE so package "Servus" is considered to be
  NOT FOUND.  Reason given by package:
  Servus could not be found because dependency DNSSD could not be found.

Linux (Debian/bookworm):

CMake Warning at /usr/share/cmake-3.25/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  By not providing "Findavahi-client.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "avahi-client", but CMake did not find one.
  Could not find a package configuration file provided by "avahi-client" with
  any of the following names:
    avahi-clientConfig.cmake
    avahi-client-config.cmake
  Add the installation prefix of "avahi-client" to CMAKE_PREFIX_PATH or set
  "avahi-client_DIR" to a directory containing one of the above files.  If
  "avahi-client" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  /usr/share/Servus/CMake/ServusConfig.cmake:11 (find_dependency)
  CMakeLists.txt:17 (find_package)
CMake Warning at CMakeLists.txt:17 (find_package):
  Found package configuration file:
    /usr/share/Servus/CMake/ServusConfig.cmake
  but it set Servus_FOUND to FALSE so package "Servus" is considered to be
  NOT FOUND.  Reason given by package:
  Servus could not be found because dependency avahi-client could not be
  found.

neither bonjour nor avahi-client ship a Cmake-snippet.
I guess this is the reason why CMake fails to mark these dependencies as FOUND and thus (wrongly) concludes that Servus_FOUND ought to be 0 as well.

Sidenote: I also tried with find_package(Servus CONFIG), but that didn't help either...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.