SENF Extensible Network Framework
Home
Overview
Examples
HowTos
Glossary
Ext
NetEmu
PPI
Packets
Scheduler
Socket
Utils
Console
Daemon
Logger
Termlib
Protocols
UN
ConnectedUNDatagramSocketHandle.cc
Go to the documentation of this file.
1
//
2
// Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3
// Network Research Group (NET)
4
// Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5
// Contact: support@wiback.org
6
//
7
// This file is part of the SENF code tree.
8
// It is licensed under the 3-clause BSD License (aka New BSD License).
9
// See LICENSE.txt in the top level directory for details or visit
10
// https://opensource.org/licenses/BSD-3-Clause
11
//
12
13
17
#include "
ConnectedUNDatagramSocketHandle.hh
"
18
19
// Custom includes
20
#include <sys/socket.h>
21
#include <sys/types.h>
22
#include <sys/ioctl.h>
23
24
#include <
senf/Utils/Exception.hh
>
25
26
//#include "UNDatagramSocketHandle.mpp"
27
#define prefix_
28
//-/////////////////////////////////////////////////////////////////////////////////////////////////
29
30
prefix_
void
senf::ConnectedUNDatagramSocketProtocol::init_client
()
const
31
{
32
int
sock = ::socket(PF_UNIX, SOCK_DGRAM, 0);
33
if
(sock < 0)
34
SENF_THROW_SYSTEM_EXCEPTION
(
"Could not create socket(PF_UNIX,SOCK_DGRAM,0)."
);
35
fd
(sock);
36
}
37
38
prefix_
void
senf::ConnectedUNDatagramSocketProtocol::init_client
(
UNSocketAddress
const
& address)
const
39
{
40
init_client
();
41
clientHandle
().connect(address);
42
}
43
44
//-/////////////////////////////////////////////////////////////////////////////////////////////////
45
#undef prefix_
46
//#include "UNDatagramSocketHandle.mpp"
47
48
49
// Local Variables:
50
// mode: c++
51
// fill-column: 100
52
// comment-column: 40
53
// c-file-style: "senf"
54
// indent-tabs-mode: nil
55
// ispell-local-dictionary: "american"
56
// compile-command: "scons -u test"
57
// End:
senf::ConcreteSocketProtocol< ConnectedUNDatagramSocket_Policy, ConnectedUNDatagramSocketProtocol >::clientHandle
ClientSocketHandle< Policy > clientHandle() const
Get client handle for associated socket.
SENF_THROW_SYSTEM_EXCEPTION
#define SENF_THROW_SYSTEM_EXCEPTION(desc)
senf::UNSocketAddress
Unix domain socket address.
Definition:
UNAddressing.hh:41
senf::SocketProtocol::fd
int fd() const
Get file descriptor.
ConnectedUNDatagramSocketHandle.hh
ConnectedUNDatagramSocketHandle public header.
prefix_
#define prefix_
Definition:
ConnectedUNDatagramSocketHandle.cc:27
Exception.hh
senf::ConnectedUNDatagramSocketProtocol::init_client
void init_client() const
Create unconnected client socket.
Definition:
ConnectedUNDatagramSocketHandle.cc:30