libtins
4.5
Toggle main menu visibility
Loading...
Searching...
No Matches
include
tins
loopback.h
1
/*
2
* Copyright (c) 2017, Matias Fontanini
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are
7
* met:
8
*
9
* * Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* * Redistributions in binary form must reproduce the above
12
* copyright notice, this list of conditions and the following disclaimer
13
* in the documentation and/or other materials provided with the
14
* distribution.
15
*
16
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*
28
*/
29
30
#ifndef TINS_LOOPBACK_H
31
#define TINS_LOOPBACK_H
32
33
#include <tins/pdu.h>
34
#include <tins/macros.h>
35
36
namespace
Tins
{
37
41
class
TINS_API
Loopback
:
public
PDU
{
42
public
:
46
static
const
PDU::PDUType
pdu_flag
= PDU::LOOPBACK;
47
53
Loopback
();
54
68
Loopback
(
const
uint8_t* buffer, uint32_t total_sz);
69
74
uint32_t
family
()
const
{
75
return
family_;
76
}
77
82
void
family(uint32_t family_id);
83
87
uint32_t header_size()
const
;
88
93
PDUType
pdu_type
()
const
{
94
return
pdu_flag
;
95
}
96
104
bool
matches_response(
const
uint8_t* ptr, uint32_t total_sz)
const
;
105
109
Loopback
*
clone
()
const
{
110
return
new
Loopback
(*
this
);
111
}
112
// Null/Loopback can only be sent in* BSD
113
#ifdef BSD
117
void
send(
PacketSender
& sender,
const
NetworkInterface
& iface);
118
#endif
// BSD
119
private
:
120
void
write_serialization(uint8_t* buffer, uint32_t total_sz);
121
122
uint32_t family_;
123
};
124
125
}
// Tins
126
127
#endif
// TINS_LOOPBACK_H
Tins::Loopback::Loopback
Loopback()
Default constructs a Loopback PDU.
Definition
loopback.cpp:60
Tins::Loopback::pdu_flag
static const PDU::PDUType pdu_flag
Definition
loopback.h:46
Tins::Loopback::pdu_type
PDUType pdu_type() const
Getter for the PDU's type.
Definition
loopback.h:93
Tins::Loopback::family
uint32_t family() const
Getter for the family identifier.
Definition
loopback.h:74
Tins::Loopback::clone
Loopback * clone() const
Definition
loopback.h:109
Tins::NetworkInterface
Abstraction of a network interface.
Definition
network_interface.h:47
Tins::PDU::PDU
PDU()
Default constructor.
Definition
pdu.cpp:50
Tins::PDU::PDUType
PDUType
Enum which identifies each type of PDU.
Definition
pdu.h:127
Tins::PacketSender
Sends packets through a network interface.
Definition
packet_sender.h:118
Tins
The Tins namespace.
Definition
address_range.h:38
Generated on
for libtins by
1.17.0