Autoware.Auto
udp_sender.hpp
Go to the documentation of this file.
1
// Copyright 2020 Silexica GmbH, Lichtstr. 25, Cologne, Germany. All rights reserved.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
16
#ifndef LIDAR_INTEGRATION__UDP_SENDER_HPP_
17
#define LIDAR_INTEGRATION__UDP_SENDER_HPP_
18
19
#include <
lidar_integration/visibility_control.hpp
>
20
#include <
common/types.hpp
>
21
22
#include <stdint.h>
23
#include <netinet/in.h>
24
25
using
autoware::common::types::bool8_t
;
26
using
autoware::common::types::char8_t
;
27
28
class
LIDAR_INTEGRATION_PUBLIC
UdpSenderBase
29
{
30
public
:
31
UdpSenderBase
(
32
const
char8_t
*
const
ip,
const
uint16_t port,
33
const
bool8_t
ipv6 =
false
);
34
35
protected
:
36
void
send(
const
void
*
const
data,
const
size_t
length)
const
;
37
38
private
:
39
int
m_socket;
40
struct
sockaddr_in6 m_addr;
41
};
42
43
template
<
typename
Packet>
44
class
UdpSender
:
public
UdpSenderBase
45
{
46
public
:
47
using
UdpSenderBase::UdpSenderBase
;
48
49
public
:
50
void
send
(Packet
const
& pkt)
const
51
{
52
UdpSenderBase::send
(
static_cast<
const
void
* const
>
(&pkt),
sizeof
(pkt));
53
}
54
};
55
56
#endif // LIDAR_INTEGRATION__UDP_SENDER_HPP_
UdpSender::send
void send(Packet const &pkt) const
Definition:
udp_sender.hpp:50
types.hpp
This file includes common type definition.
UdpSender
Definition:
udp_sender.hpp:44
visibility_control.hpp
UdpSenderBase::send
void send(const void *const data, const size_t length) const
Definition:
udp_sender.cpp:60
autoware::common::types::char8_t
char char8_t
Definition:
types.hpp:34
autoware::common::types::bool8_t
bool bool8_t
Definition:
types.hpp:33
UdpSenderBase
Definition:
udp_sender.hpp:28
UdpSenderBase::UdpSenderBase
UdpSenderBase(const char8_t *const ip, const uint16_t port, const bool8_t ipv6=false)
Definition:
udp_sender.cpp:27