SyslogUDPTarget.cci
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 
14 /** \file
15  \brief SyslogUDPTarget inline non-template implementation */
16 
17 //#include "SyslogUDPTarget.ih"
18 
19 // Custom includes
20 #include <senf/Socket/Protocols/INet/ConnectedUDPSocketHandle.hh>
21 #include <senf/Utils/String.hh>
22 
23 #define prefix_ inline
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
26 prefix_ senf::log::SyslogUDPTarget::SyslogUDPTarget(INet4Address const & target, int facility)
27  : Target("udp-" + senf::str(target)), LogFormat(consoleDir()), facility_ (facility),
28  handle_ ( ConnectedUDPv4ClientSocketHandle(INet4SocketAddress(target, 514u)) ),
29  syslogFormat_ (true)
30 {
31  init();
32 }
33 
34 prefix_ senf::log::SyslogUDPTarget::SyslogUDPTarget(INet4SocketAddress const & target, int facility)
35  : Target("udp-" + senf::str(target)), LogFormat(consoleDir()), facility_ (facility),
36  handle_ ( ConnectedUDPv4ClientSocketHandle(target) ),
37  syslogFormat_ (true)
38 {
39  init();
40 }
41 
42 prefix_ senf::log::SyslogUDPTarget::SyslogUDPTarget(INet6Address const & target, int facility)
43  : Target("udp-" + senf::str(target)), LogFormat(consoleDir()), facility_ (facility),
44  handle_ ( ConnectedUDPv6ClientSocketHandle(INet6SocketAddress(target, 514u)) ),
45  syslogFormat_ (true)
46 {
47  init();
48 }
49 
50 prefix_ senf::log::SyslogUDPTarget::SyslogUDPTarget(INet6SocketAddress const & target, int facility)
51  : Target("udp-" + senf::str(target)), LogFormat(consoleDir()), facility_ (facility),
52  handle_ ( ConnectedUDPv6ClientSocketHandle(target) ),
53  syslogFormat_ (true)
54 {
55  init();
56 }
57 
58 prefix_ bool senf::log::SyslogUDPTarget::syslog()
59  const
60 {
61  return syslogFormat_;
62 }
63 
64 prefix_ void senf::log::SyslogUDPTarget::syslog(bool enabled)
65 {
66  syslogFormat_ = enabled;
67 }
68 
69 //-/////////////////////////////////////////////////////////////////////////////////////////////////
70 #undef prefix_
71 
72 
73 // Local Variables:
74 // mode: c++
75 // fill-column: 100
76 // comment-column: 40
77 // c-file-style: "senf"
78 // indent-tabs-mode: nil
79 // ispell-local-dictionary: "american"
80 // compile-command: "scons -u test"
81 // End: