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

Reformat Pcap++ documentation to use triple-slash doxygen format. #1660

Merged
merged 13 commits into from
Jan 8, 2025
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
Loading