Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's difference between libhs.so and libhs_runtime.so #16

Closed
crazy-william opened this issue Apr 11, 2016 · 4 comments
Closed

What's difference between libhs.so and libhs_runtime.so #16

crazy-william opened this issue Apr 11, 2016 · 4 comments

Comments

@crazy-william
Copy link

What's difference between libhs.so and libhs_runtime.so, and when will we use the latter?

@mdb256
Copy link

mdb256 commented Apr 11, 2016

The short answer is that most users won't use libhs_runtime.

The runtime lib is the subset of the Hyperscan library required for scanning data, without the functionality for compiling patterns. That is, it doesn't contain hs_compile()/hs_compile_multi() or any of the support functions listed in hs_compile.h.

This means that to use the runtime lib, a pattern database would need to be compiled by a program linked to the full libhs, the pattern DB serialized, the DB moved/stored, and then deserialized by the program linked to libhs_runtime. For example, you might have a central service that compiles pattern databases which then sends the serialized DB out to a set of machines that use the HS runtime to scan network traffic.

As for the why: the runtime lib is obviously smaller than the complete library, but the main reason for its existence is that the runtime shared lib doesn't require libstdc++.so (or equivalent C++ runtime) - the HS runtime is entirely written in C, whereas the HS compiler is C++. So in the above example, Hyperscan doesn't require that the set of machines scanning network traffic have an installed C++ runtime.

@crazy-william
Copy link
Author

thank you for your so detail answer.
Then Would you please tell me how to export compiled pattern DB? I don't find API to do this work.

@mdb256
Copy link

mdb256 commented Apr 12, 2016

We have API calls for serializing and deserializing the compiled pattern DB.

Serializing flattens the database into a sequence of bytes (with a length) that can be written to a file, or sent over a network connection, and then deserializing takes those bytes and turns them back into a database. Handling files and network connections is outside of the scope of the Hyperscan library.

@crazy-william
Copy link
Author

Thank you so much. I have no other question. You can close it.

@mdb256 mdb256 closed this as completed Apr 12, 2016
GerHobbelt pushed a commit to GerHobbelt/hyperscan that referenced this issue May 10, 2024
vankoven pushed a commit to G-Core/linux-regex-module that referenced this issue Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants