SENF Extensible Network Framework
Home
Overview
Examples
HowTos
Glossary
Ext
NetEmu
PPI
Packets
Scheduler
Socket
Utils
Console
Daemon
Logger
Termlib
Protocols
UN
UNDatagramSocketHandle.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 "
UNDatagramSocketHandle.hh
"
18
//#include "UNDatagramSocketHandle.ih"
19
20
// Custom includes
21
#include <sys/socket.h>
22
#include <sys/types.h>
23
#include <sys/ioctl.h>
24
25
#include <
senf/Utils/Exception.hh
>
26
27
//#include "UNDatagramSocketHandle.mpp"
28
#define prefix_
29
//-/////////////////////////////////////////////////////////////////////////////////////////////////
30
31
prefix_
void
senf::UNDatagramSocketProtocol::init_client
()
const
32
{
33
int
sock = ::socket(PF_UNIX,SOCK_DGRAM | SOCK_CLOEXEC, 0);
34
if
(sock < 0)
35
SENF_THROW_SYSTEM_EXCEPTION
(
"Could not create socket(PF_UNIX,SOCK_DGRAM,0)."
);
36
fd
(sock);
37
}
38
39
prefix_
void
senf::UNDatagramSocketProtocol::init_client
(
UNSocketAddress
const
& address)
const
40
{
41
init_client
();
42
clientHandle
().bind(address);
43
}
44
45
//-/////////////////////////////////////////////////////////////////////////////////////////////////
46
#undef prefix_
47
//#include "UNDatagramSocketHandle.mpp"
48
49
50
// Local Variables:
51
// mode: c++
52
// fill-column: 100
53
// comment-column: 40
54
// c-file-style: "senf"
55
// indent-tabs-mode: nil
56
// ispell-local-dictionary: "american"
57
// compile-command: "scons -u test"
58
// End:
UNDatagramSocketHandle.hh
UNDatagramSocketHandle public header.
senf::ConcreteSocketProtocol< UNDatagramSocket_Policy, UNDatagramSocketProtocol >::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.
Exception.hh
senf::UNDatagramSocketProtocol::init_client
void init_client() const
Create unconnected client socket.
Definition:
UNDatagramSocketHandle.cc:31
prefix_
#define prefix_
Definition:
UNDatagramSocketHandle.cc:28