Vanetza
Loading...
Searching...
No Matches
cohda.hpp
1
#ifndef COHDA_HPP_CCA3HKJO
2
#define COHDA_HPP_CCA3HKJO
3
4
#include <vanetza/asio/linklayer_endpoint.hpp>
5
#include <boost/asio/basic_raw_socket.hpp>
6
#include <linux/if_ether.h>
7
#include <net/if.h>
8
9
namespace
vanetza
10
{
11
namespace
asio
12
{
13
14
class
cohda
15
{
16
public
:
17
typedef
linklayer_endpoint<cohda>
endpoint
;
18
typedef
boost::asio::basic_raw_socket<cohda> socket;
19
20
static
cohda
wave_raw()
21
{
22
return
cohda
(
"wave-raw"
, ETH_P_ALL);
23
}
24
25
explicit
cohda
() : m_protocol(ETH_P_ALL), m_ifidx(0) {}
26
27
int
type()
const
{
return
SOCK_RAW; }
28
int
family()
const
{
return
PF_PACKET; }
29
int
protocol()
const
{
return
m_protocol; }
30
int
interface_index()
const
{
return
m_ifidx; }
31
32
private
:
33
explicit
cohda
(
const
char
* if_name,
int
proto) :
34
m_protocol(proto), m_ifidx(if_nametoindex(if_name)) {}
35
36
int
m_protocol;
/*< ethernet protocol number */
37
int
m_ifidx;
/*< network interface card number */
38
};
39
40
}
// namespace asio
41
}
// namespace vanetza
42
43
#endif
/* COHDA_HPP_CCA3HKJO */
44
vanetza::asio::cohda
Definition:
cohda.hpp:15
vanetza::asio::linklayer_endpoint
Definition:
linklayer_endpoint.hpp:15
vanetza
asio
cohda.hpp
Generated on Thu Nov 30 2023 12:03:34 for Vanetza by
1.9.6