mirror of
https://github.com/mfontanini/libtins
synced 2026-01-30 13:34:27 +01:00
Fixed recv mechanism. Added timeout.
This commit is contained in:
@@ -149,6 +149,14 @@ namespace Tins {
|
||||
/** \brief Returns the ICMP code flag.
|
||||
*/
|
||||
uint8_t code() const { return _icmp.code; }
|
||||
|
||||
/** \brief Returns the echo id.
|
||||
*/
|
||||
uint16_t id() const { return _icmp.un.echo.id; }
|
||||
|
||||
/** \brief Returns the echo sequence number.
|
||||
*/
|
||||
uint16_t sequence() const { return _icmp.un.echo.sequence; }
|
||||
|
||||
/** \brief Returns the header size.
|
||||
*
|
||||
|
||||
@@ -44,6 +44,8 @@ namespace Tins {
|
||||
*/
|
||||
class PacketSender {
|
||||
public:
|
||||
static const uint32_t DEFAULT_TIMEOUT;
|
||||
|
||||
enum SocketType {
|
||||
ETHER_SOCKET,
|
||||
IP_SOCKET,
|
||||
@@ -55,7 +57,7 @@ namespace Tins {
|
||||
/**
|
||||
* \brief Constructor for PacketSender objects.
|
||||
*/
|
||||
PacketSender();
|
||||
PacketSender(uint32_t recv_timeout = DEFAULT_TIMEOUT);
|
||||
|
||||
/**
|
||||
* \brief
|
||||
@@ -84,9 +86,12 @@ namespace Tins {
|
||||
typedef std::map<SocketType, int> SocketTypeMap;
|
||||
|
||||
int find_type(SocketType type);
|
||||
|
||||
PDU *recv_match_loop(int sock, PDU *pdu, struct sockaddr* link_addr, socklen_t addrlen);
|
||||
|
||||
std::vector<int> _sockets;
|
||||
SocketTypeMap _types;
|
||||
uint32_t _timeout;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user