1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Add hardware addresses to Stream

This commit is contained in:
Matias Fontanini
2016-02-08 20:59:00 -08:00
parent 549c0e97d0
commit 8db6032303
3 changed files with 46 additions and 0 deletions

View File

@@ -41,6 +41,7 @@
#include <functional>
#include <stdint.h>
#include "macros.h"
#include "hw_address.h"
namespace Tins {
@@ -276,6 +277,11 @@ public:
*/
typedef std::function<void(Stream&)> stream_callback;
/**
* The type used to store hardware addresses
*/
typedef HWAddress<6> hwaddress_type;
/**
* The type used to store payloads
*/
@@ -341,6 +347,26 @@ public:
*/
IPv6Address client_addr_v6() const;
/**
* \brief Retrieves the client's hardware address.
*
* Note that this is not the actual hardware address of the client, but
* just the address seen from packets coming from it. If the client
* is on another network, then this will be the address of the last
* device (switch, route, etc) the packet went through.
*/
const hwaddress_type& client_hw_addr() const;
/**
* \brief Retrieves the server's hardware address.
*
* Note that this is not the actual hardware address of the server, but
* just the address seen from packets coming from it. If the server
* is on another network, then this will be the address of the last
* device (switch, route, etc) the packet went through.
*/
const hwaddress_type& server_hw_addr() const;
/**
* \brief Retrieves the server's IPv4 address
*
@@ -486,6 +512,8 @@ private:
stream_callback on_server_data_callback_;
stream_callback on_client_buffering_callback_;
stream_callback on_server_buffering_callback_;
hwaddress_type client_hw_addr_;
hwaddress_type server_hw_addr_;
bool auto_cleanup_;
};