Skip to content

Commit

Permalink
Reformat Pcap++ documentation to use triple-slash doxygen format. (#1660
Browse files Browse the repository at this point in the history
)

* Converted some files.

* Converted more files.

* Converted source file comments.

* Lint

* Converted enum value docs

* Formatting fixes.

* Lint

* Removed section comments.

* Removed section comments.

* Formatting fixes

* Fix missed docstring.

* Changed missed /* */ comments.
  • Loading branch information
Dimi1010 authored Jan 8, 2025
1 parent e0ca321 commit 91d2058
Show file tree
Hide file tree
Showing 33 changed files with 2,809 additions and 3,935 deletions.
74 changes: 27 additions & 47 deletions Pcap++/header/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,16 @@
#include "RawPacket.h"
#include "PcapFilter.h"

/**
* \namespace pcpp
* \brief The main namespace for the PcapPlusPlus lib
*/
/// @namespace pcpp
/// @brief The main namespace for the PcapPlusPlus lib
namespace pcpp
{
/** A vector of pointers to RawPacket */
/// A vector of pointers to RawPacket
typedef PointerVector<RawPacket> RawPacketVector;

/**
* @class IDevice
* An abstract interface representing all packet processing devices. It stands as the root class for all devices.
* This is an abstract class that cannot be instantiated
*/
/// @class IDevice
/// An abstract interface representing all packet processing devices. It stands as the root class for all devices.
/// This is an abstract class that cannot be instantiated
class IDevice
{
protected:
Expand All @@ -33,69 +29,53 @@ namespace pcpp
virtual ~IDevice()
{}

/**
* Open the device
* @return True if device was opened successfully, false otherwise
*/
/// Open the device
/// @return True if device was opened successfully, false otherwise
virtual bool open() = 0;

/**
* Close the device
*/
/// Close the device
virtual void close() = 0;

/**
* @return True if the file is opened, false otherwise
*/
/// @return True if the file is opened, false otherwise
inline bool isOpened()
{
return m_DeviceOpened;
}
};

/**
* @class IFilterableDevice
* An abstract interface representing all devices that have BPF (Berkeley Packet Filter) filtering capabilities,
* meaning devices that can filter packets based on the BPF filtering syntax.
* This is an abstract class that cannot be instantiated
*/
/// @class IFilterableDevice
/// An abstract interface representing all devices that have BPF (Berkeley Packet Filter) filtering capabilities,
/// meaning devices that can filter packets based on the BPF filtering syntax.
/// This is an abstract class that cannot be instantiated
class IFilterableDevice
{
protected:
// c'tor should not be public
IFilterableDevice()
{}
IFilterableDevice() = default;

public:
virtual ~IFilterableDevice()
{}
virtual ~IFilterableDevice() = default;

/**
* Set a filter for the device. When implemented by the device, only packets that match the filter will be
* received
* @param[in] filter The filter to be set in PcapPlusPlus' GeneralFilter format
* @return True if filter set successfully, false otherwise
*/
/// Set a filter for the device. When implemented by the device, only packets that match the filter will be
/// received
/// @param[in] filter The filter to be set in PcapPlusPlus' GeneralFilter format
/// @return True if filter set successfully, false otherwise
virtual bool setFilter(GeneralFilter& filter)
{
std::string filterAsString;
filter.parseToString(filterAsString);
return setFilter(filterAsString);
}

/**
* Set a filter for the device. When implemented by the device, only packets that match the filter will be
* received
* @param[in] filterAsString The filter to be set in Berkeley Packet Filter (BPF) syntax
* (http://biot.com/capstats/bpf.html)
* @return True if filter set successfully, false otherwise
*/
/// Set a filter for the device. When implemented by the device, only packets that match the filter will be
/// received
/// @param[in] filterAsString The filter to be set in Berkeley Packet Filter (BPF) syntax
/// (http://biot.com/capstats/bpf.html)
/// @return True if filter set successfully, false otherwise
virtual bool setFilter(std::string filterAsString) = 0;

/**
* Clear the filter currently set on the device
* @return True if filter was removed successfully or if no filter was set, false otherwise
*/
/// Clear the filter currently set on the device
/// @return True if filter was removed successfully or if no filter was set, false otherwise
virtual bool clearFilter() = 0;
};
} // namespace pcpp
10 changes: 5 additions & 5 deletions Pcap++/header/DeviceUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
#include "IpAddress.h"
#include "PcapUtils.h"

/// @namespace pcpp
/// @brief The main namespace for the PcapPlusPlus lib
namespace pcpp
{
/// @cond PCPP_INTERNAL

namespace internal
{
/**
* Fetches a list of all network devices on the local machine that LibPcap/WinPcap/NPcap can find.
* @return A smart pointer to an interface list structure.
* @throws std::runtime_error The system encountered an error fetching the devices.
*/
/// Fetches a list of all network devices on the local machine that LibPcap/WinPcap/NPcap can find.
/// @return A smart pointer to an interface list structure.
/// @throws std::runtime_error The system encountered an error fetching the devices.
std::unique_ptr<pcap_if_t, PcapFreeAllDevsDeleter> getAllLocalPcapDevices();
} // namespace internal

Expand Down
Loading

0 comments on commit 91d2058

Please sign in to comment.