I'm currently trying to learn ZeroMQ and wanted to implement a handler for ZAP so that I can authenticate clients. I looked at the test file test_security_curve.cpp in the libzmq repository and noticed that it uses many helper functions. I don't know if I need those or not.
How would I go about implementing ZAP authentication with modern C++? Should I even use libzmq or switch to cppzmq or zmqpp? I'm really confused about this..
Any help is much appreciated
Maybe you should consider using czmq, which is the so-called high-level API, instead of libzmq. It also has a C++ binding, czmqpp.
czmq contains a ZAP handler implementation, which is described at http://czmq.zeromq.org/manual:zauth.
Related
I got a very strange request from one of my customers (at least according to my current knowledge). I have to build an iOS framework, which main purpose is to wrap a C/C++ library with Obj-C code, to hide some of its general API and expose only what my customer want me to expose via Obj-C. Now, here comes the tricky part. This framework is going to be a dependency for an application (objects/methods/functions/whatever should be accessible from , i.e. view controllers) and for another framework. Is it possible to build this framework in a way that expose only part of an API to an application and part of API to another framework which is going to use it internally?
According to my knowledge it is impossible and framework can expose only one API, which is common to every possible consumer/user. However my knowledge might not be complete in this topic.
Additional question: can I expose both Obj-C and C API from a single framework. I assume I can, but just want to make sure.
Please don't ask about rationale behind this idea. This is a requirement I got and have to investigate so I can't provide any sensible justification at the moment.
Thanks!
I have to develop a simple XMPP server that will be included in a commercial project. I guess there is no server available that can be purchased with a royalty-free-license and that enables me to do the configuration and user management and the authentication from my own code.
The languages I can use are Delphi and C++.
I've already looked at the libraries listed at xmpp.org, but most of them seem to be client-only libraries or (as e.g. QXmpp) require QT which I have no experience of and consideres it to be a pure GUI framework.
Can anybody suggest a library I should take a closer look at? Does it make sense to familiarize myself with QT for this purpose (writing xmpp server;no GUI)?
Or is it better to just catch a stream parser (suggestions?) and code it myself?
Thanks!
Edit: The only library I could find for Delphi, IP*Works is a pure client library. I'm evaluation QXmpp now.
For the Delphi part of my question: I didn't find a library I think that is suitable for building a server.
For the C++ part, I think this post Non GPL C/C++ XMPP client library for embedded Linux (though it is for embedded and client) is answering my questions:
Because Qt provides XML parser and signal/slot framework. XMPP requires XML parser, and signal/slot framework makes your life easier. If you try implementing entire XMPP with all extensions in OOP fashion, you'll need something similar to Qt.
and
Advice: when it comes to C++, there aren't many good xmpp libraries available.
So I think, QXmpp seems to be a good solution.
For other people searchig for this topic:
IMHO the documentation (especially for the server part) is a bit poor. The server example distributed with the qxmpp library is (of course) very basic: It is transporting chat messages. Distributing presence information, roster, subscription handling has to be implemented by you via extensions (inheriting QXmppServerExtension overwriting at least virtual function handleStanza). Don't parse the presence or iq stanzas in your own code. For the more common stanzas the libarary has classes implemented QXmppPresence, QXmppRosterIq etc.) that also can be used in your extension.
From here:
Storm was designed from the very beginning to be compatible with multiple languages. Nimbus is a Thrift service and topologies are defined as Thrift structures. The usage of Thrift allows Storm to be used from any language.
I see that a topology created in java get deployed by serializing the topology (spouts, bolts , ComponentCommon) as a Thrift datatypes and then gets deployed on Nimbus. In Java it is easy to serialize the object with its methods and data. So on the other side Nimbus just needs to create objects and invoke them. (i might be missing detail here but I hope I got the point correctly)
But I wonder how to write the topology in C++ and deploy it the same way. Does thrift help to serialize the c++ based topology and Nimbus deploys/executes the topology in the same way as for Java?
I have seen the links link1 link2 in this regard and the only solution seems to be using a Shelbolt. which invokes the process and communicates with it over standard i/o.
In order to use the Thrift way, do we need to rewrite the storm core also in C++? Also why use Thrift when it supports only JVM languages? Thrift doesn't seem to be used at all for languages like python/c++.
I'm not sure if I'm understand your question correctly -- in my understanding you're asking Is it possible [without the Shebolt hack] to use Storm [with Thrift as comm protocol] with C++-written bolts and with C++ as the language that creates the topology.
Because of the lack of other answers to this question and based on my own research I assume there is no finished, usable implementation for your problem.
Therefore if you really have to use Storm (its common usecase is the JVM, so even if it could theoretically work with any language, it doesn't mean there is an ecosystem for other languages) and C++, you have no option but to use the Shebolt hack or modify Thrift yourself.
As you know, thrift itself has also been ported to C++. Therefore it is possible to re-build the API calls in C++. Basically, you'd need to port the Java TopologyBuilder. On the C++ side, you could start with the Thrift C++ tutorial.
This is also some kind of a hack, as you basically just rebuild half of the stack (in this case ontop of Thrift), but in general you have very few other options with a system design like Storm.
For example, the MySQL binary protocol has been rebuilt from-scr
Unless anyone has done the work for you (which I would have completely missed in my research) I see no option than to do it yourself (maybe even storm is not the best tool for your usecase!?)
If another hack (which might be even more complex and maybe even slower) besides ShellBolt is good enough for you, you could try starting a JVM from inside C++, e.g. see this SO post. I would not recommend this.
If you need an alternative distributed task queue, I have had good experience with Celery in Python environments, however I have no experience in using it in C++ directly (I usually control Python with ZeroMQ, or write my own ZeroMQ-based queues where necessary, but this is no universal solution).
I'm trying to write a gstreamer plugin in C++, using the GStreamermm bindings. Now, there's a good plugins writers guide (http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/), and on the web there's various examples and templates, but for gstreamermm, there's very little amount of documentation whatsoever.
I know I could just resort to using a mixture of C and C++, but using the C++ bindings seems so much more elegant.
Simply 'translating' the examples found in the gstreamer pwg to gstreamermm is kind of a dead end; gstreamer requires the use of quite a few macros for defining types, which I cannot see an immediate gstreamermm translation to. Additionally, I have only little experience with gstreamer, and absolutely no experience with gobj (so far).
Is anyone able to put me on the right track? Even the tiniest example or explanation would do.
Thanks
I've asked this on the gtkmm mailing list a couple of days ago, and got the following answer (from José Alburquerque):
Presently, the only plug-ins that have a (probably non-existent) possibility of being developed using gstreamermm are ones that are
private to applications. If that's possible, These plug-ins would be
registered using the Gst::Plugin::register_static()[1] method and not
the process that you've described above.
[1] http://developer.gnome.org/gstreamermm/unstable/classGst_1_1Plugin.html#ac0728bb285ae1bed9298c0f9ea522ad9
In theory, one would extend one of the gstreamermm base classes[2] and
call the Gst::ElementFactory::register_element()[3] method in the
Gst::Plugin::SlotInit slot (callback) so that an element factory that
generates these elements can be created. That factory can then be
added to the registry using Gst::Registry::add_feature()[4] in the
same Gst::Plugin::SlotInit slot.
[2] http://developer.gnome.org/gstreamermm/unstable/group__GstBaseClasses.html
[3] The Gst::ElementFactory::register_element() method is a method
that is not implemented yet but would wrap the gst_element_register()
function. That would be part of an upcoming release.
[4] http://developer.gnome.org/gstreamermm/unstable/classGst_1_1Registry.html#ae1f9a1ddd60ef5a7e1f8cddf14ec404f
I've not tested this and don't really know exactly how it would work
(or if it actually would) but it's how I'd try if I had to. However,
I think it's easier to write the plug-in in C presently, but that's
just a matter of making things easier.
Node.js has a very good and well thought Net API.
I wonder is there a good C++ only implementation of that API as for example LuaNode do for Lua?
Take a look at node.native - attempt to implement api similar to node.js core lib, but with c++11 (and evented IO is also based on libuv)
There is nothing very similar that I know of.
However there are several reactor frameworks out there which give the same event queue driven environment. For example boost::asio provides an event queue that makes callbacks to handle network events, timers, and arbiatary events that you push onto the event queue.
It's largely the same idea, used in the same way. Howver it's nowhere near as simple as node.js to get started with, and does provide any non-blocking functions other than the basics I said above.
It does provide you with the environment to build your own system though. It's an excellent library, but probably rather lower level than you are looking for. There are other simiar libraries such as ACE and parts of the POCO c++ libraries too, but again, they are lower level than node.js with much less library support.
edit:
I've not looked at it too much but how about this https://github.com/joyent/libuv . This is a library that is used to implement some of the node.js features in a cross platform way. Maybe it's possible to use some of it for what you need?
Boost.Asio is conceptually very similar to Node.js. The primary difference being Asio is implemented as a library and Node.js is a language construct. Asio therefore exposes the event queue, requiring some initial setup to post callback handlers, and eventually a blocking call to start the event loop (io_service.run()).
If you're looking for a pure C++ API similar to Node.js, Boost.Asio is definitely the way to go. It is the de-facto networking library for many C++ applications. It's also discussed heavily on SO in the boost-asio tag.
I'm quite sure you could embed a Javascript engine into your program
v8 (building guide)
SpiderMonkey (building guide)
Actually tying that to your C code needs tinkering with the eval functions of both, but I think I remember seeing sample programs doing that for both engines