DatagramSocketProtocol.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 
18 //#include "DatagramSocketProtocol.ih"
19 
20 // Custom includes
21 #include <sys/types.h>
22 #include <sys/socket.h>
23 #include <sys/ioctl.h>
24 #include <linux/sockios.h>
26 
27 //#include "DatagramSocketProtocol.mpp"
28 #define prefix_
29 //-/////////////////////////////////////////////////////////////////////////////////////////////////
30 
32  const
33 {
34  struct timeval tv;
35  if (::ioctl(fd(), SIOCGSTAMP, &tv) < 0)
36  SENF_THROW_SYSTEM_EXCEPTION("could not get timestamp in DatagramSocketProtocol");
37  return ClockService::from_timeval(tv);
38 }
39 
41  const
42 {
43  if (::ioctl(fd(), SIOCGSTAMPNS, spec) < 0)
44  SENF_THROW_SYSTEM_EXCEPTION("could not get timestamp in DatagramSocketProtocol");
45 }
46 
47 
48 //-/////////////////////////////////////////////////////////////////////////////////////////////////
49 #undef prefix_
50 //#include "DatagramSocketProtocol.mpp"
51 
52 
53 // Local Variables:
54 // mode: c++
55 // fill-column: 100
56 // comment-column: 40
57 // c-file-style: "senf"
58 // indent-tabs-mode: nil
59 // ispell-local-dictionary: "american"
60 // compile-command: "scons -u test"
61 // End:
config::time_type clock_type
#define SENF_THROW_SYSTEM_EXCEPTION(desc)
#define prefix_
int fd() const
Get file descriptor.
DatagramSocketProtocol public header.
ClockService::clock_type timestamp() const
Return packet timestamp of last packet.
static clock_type from_timeval(timeval const &time)