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

WIP: Ability to dump packets to shared memory on "dump" rule in pcap format #259

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

ol-imorozko
Copy link
Collaborator

No description provided.

@ol-imorozko ol-imorozko force-pushed the tcpdump branch 2 times, most recently from 0fd8555 to 98395a4 Compare December 13, 2024 16:54
…acro

This simplifies error message construction and is more type secure
Missed those in the original commit 01422b7
In the following commit we will add new option to the shared
memory config, and we will need an ability to use that config in
another file. Including whole dataplane.h there will be awkward.
….conf.

This option specifies the format for dumping packets in shared memory.
If the option is not specified or is set to an invalid value,
the format defaults to raw, maintaining the current behavior.

Valid options are "raw" and "pcap".

The logic for dumping packets in pcap format within shared memory will be
implemented in subsequent commits.
- Rename `cSharedMemory` to `SharedMemoryDumpRing` to reflect that it
  exclusively manages dump rings for packet handling.
- Rename `bufferring` to `PacketBufferRing` to better indicate that it is
  specifically designed for packet processing.
- Remove the unnecessary `init` function, as initialization is now handled
  by the constructor.
- Move the calculation of unit size and total capacity into the
  `PacketBufferRing` constructor. Now capacity calculations i.e adding headers
  are encapsulated within the class itself. Now we pass in configuration values
  for memory expectations, and handle internal header sizing within
  `SharedMemoryDumpRing` to not violate encapsulation.
Use unordered map instead of an ordered one, we don't need order there.
Encapsulate memory size calculation logic in a static helper function.
Avoid iterators that were there for some reason, simple increment
operator is enough.
Use `ShmInfo` struct with `key`, `addr`, and `offset` instead of
obscure std::tuple and another map for offset.

Applied placement `new` for `tsc_deltas` initialization instead
of value initizlizing with empty brackets and setting pointer.
Move efficient and literal this way.
This function is too useful and universal to be in that namespace
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

Successfully merging this pull request may close these issues.

1 participant