does eBPF support events? - networking

Is is possible to have ebpf program generate event, for example packet counter reached a predefined threshold value and ebpf would generate some notification/event to user, something similar to what netlink provides.
I see that currently the only way to signal this event/state is via maps which can be polled by the user application.

No, there isn't a way currently to signal userspace or other programs without polling maps.
This has been briefly discussed on the iovisor-dev mailing list before. If you have a use case for this, you might try to bring it on the mailing list.

Related

How to implement sampling in ns3?

I wonder how to implement sampling in ns3. What exactly I want to implement is to create a simple network of switches and hosts using p2p links. Then, setting a probability (lets say 0.1) for an specific switch and expecting that every packet passing the switch will be captured with probability that I defined earlier. (Pretty much like the sampling in sflow or netflow).
I browsed nsnam.org, and the only tool I found regarding my question is Flow Monitor which I think is not helpful for my purpose.
There isn't a direct way to implement the behavior you want, but there is a solution.
Set up a normal hook to get all packets going through one of the switches. Refer to the tutorial to learn how to use the tracing system.
Then, use a RandomVariable at the beginning of your function to determine whether you want ignore that packet or not. The RandomVariable will need to be in global scope or passed in as parameter to the function.

Documenting Asynchronous Communication

Does UML define how asynchronous communication patterns (observable, message bus, etc) should be shown when showing the interaction of various components in a system? I do know that sequence diagrams have the ability to show asynchronous calls however these do not show any information about the method of communication (for example, details on the event bus or the subscription to/disposing of an observable may be important to document). Is there a standard way of capturing these types of details?
Actually what you are asking is to go in more detail with a message. If for example you send data over a socket to another process you just call a system library's send method. This in turn will do lots of things (down to switching lots of transistors in lots of hubs and switches) until the opposite process gets control. Usually nobody is interested in these details. That's what we call abstraction.
However, if for any reason you are interested in some partial details of the message transport wihout going into the gory details you can simply stick a note to the message. Another way is to use a stereotype like this:
Please note that the sketch above shows a synchronous call, despite the question title. Use the open arrow variant for async calls.

How to keep track of signals and slots in Qt?

This question is not directly about programming, but I hope that it still fits here: When programming with Qt I have the problem that after some times my subclasses are getting extremely large which leads to a lot of signals and slots in each class I have to connect later. Therefore I was wondering if there is a simple possibility to keep track of all the signals and slots, for example to tell me if I forgot to connect a signal, or to show me all connections of one signal if it is connected more than once. Is there a tool or a function in Qt for that, or should I rather stay with pen & paper for keeping track of them?
Conan is a C++ library that provides run-time introspection of object
hierarchies, object inheritance, signal/slot connections, and signal
emissions.
GammaRay is another advanced analyser which can show signals/slots.

Dynamic connecting/disconnecting signals and slots

My program has two states and it can switch between them for some reasons. In these states the program needs to receive different signals, which means it has to connect and disconnect certain signals during the run.
How bad is such approach?
It's a fine approach, I've used it before without issues. Depending on what you're actually doing a QSignalMapper might be of use for you.

qt thread options

I'm currently writing a programme which has a function to hash a number of files in the background. I've read the Qt4 documentation a number of times over and I still can't really figure out which threading option is best for this.
http://doc.qt.io/qt-5/thread-basics.html
There's really no need to update the GUI when it's done with each file, I just don't wish to block the GUI and I really only need a single signal/slot connection upon completion. I'm thinking of extending QThread for a hashing thread. Does this sound reasonable/right?
I have this article bookmarked as it nicely illustrates the use of QThread and highlights some common misconceptions about it. Sample code available, which runs without blocking the GUI. Sample is hosted on RapidShare, but they seem to have implemented some sort of timed waiting period since I last used it.
This sounds like a good place to use the QtConcurrent::map() function. The map function can apply the same operation to a container of objects, in your case, files. Once you start the map function, you can create a QFutureWatcher and connect to its finished signal to be notified when all of the work is done.

Resources