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

Refactor of PcapRemoteDeviceList's factory functions. #1476

Merged
merged 10 commits into from
Jul 17, 2024

Commits on Jun 30, 2024

  1. Refactor PcapRemoteDeviceList with smart pointers

    - Introduced `createRemoteDeviceList` static methods in `PcapRemoteDeviceList` for creating and managing remote device lists using `std::unique_ptr`, enhancing memory management and safety.
    - Modified existing `getRemoteDeviceList` methods to utilize new `createRemoteDeviceList` methods, maintaining backward compatibility by returning raw pointers through `.release()`.
    - Adopted smart pointers (`std::unique_ptr`) in the implementation for automatic memory cleanup, reducing the risk of memory leaks and improving code maintainability.
    - Modernized the codebase by leveraging C++11 smart pointers, simplifying resource management and providing a clearer, more flexible API for handling remote device lists with and without authentication.
    Dimi1010 committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    af785be View commit details
    Browse the repository at this point in the history
  2. Refactor iterator type aliases in PcapRemoteDeviceList

    Modernized the syntax for defining iterator and const iterator type aliases in `PcapRemoteDeviceList.h` within the `pcpp` namespace. Replaced traditional `typedef` with the `using` syntax for `RemoteDeviceListIterator` and `ConstRemoteDeviceListIterator`. These changes enhance code readability and align with modern C++ best practices without altering functionality.
    Dimi1010 committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    d610fbe View commit details
    Browse the repository at this point in the history
  3. Enhance PcapRemoteDeviceList construction

    - Removed the default constructor of 'PcapRemoteDeviceList'.
    - Added a new constructor to `PcapRemoteDeviceList` for initializing with detailed remote machine info and authentication.
    - Corrected typographical errors in comments for better documentation clarity.
    - Improved const-correctness in `createRemoteDeviceList` by changing `remoteAuth` parameter type.
    - Refactored device creation logic in `createRemoteDeviceList` for clearer error handling and separation of concerns.
    - Enhanced error handling in device creation to prevent memory leaks on exceptions.
    - Transitioned to using `std::shared_ptr<PcapRemoteAuthentication>` for better memory management in device creation.
    - Simplified authentication object handling by converting to `std::shared_ptr` early in the device creation process.
    Dimi1010 committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    6f5cc0d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1a257b7 View commit details
    Browse the repository at this point in the history
  5. Refactor PcapRemoteDeviceList creation

    - Included DeprecationUtils.h in PcapRemoteDeviceList.h to mark certain functionalities as deprecated, indicating a move towards newer alternatives.
    - Updated the private constructor comment in PcapRemoteDeviceList to recommend using `createRemoteDeviceList` for instance creation, reflecting a shift to a new factory method.
    - Deprecated two static factory functions, `getRemoteDeviceList(const IPAddress& ipAddress, uint16_t port)` and `getRemoteDeviceList(const IPAddress& ipAddress, uint16_t port, PcapRemoteAuthentication* remoteAuth)`, in favor of `createRemoteDeviceList`, enhancing memory safety and functionality.
    Dimi1010 committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    6916da3 View commit details
    Browse the repository at this point in the history

Commits on Jul 3, 2024

  1. Clarified variable name.

    Dimi1010 committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    edfa5de View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4f66704 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2d637c4 View commit details
    Browse the repository at this point in the history

Commits on Jul 7, 2024

  1. Configuration menu
    Copy the full SHA
    0f8f3b0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    cf3d1c2 View commit details
    Browse the repository at this point in the history