Kea: pktinfo_utilities.h Source File

| Kea 3.0.0

pktinfo_utilities.h
Go to the documentation of this file.
1// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef PKTINFO_UTIL_H
8#define PKTINFO_UTIL_H 1
9
10#include <sys/socket.h>
11#include <netinet/in.h>
12
13// These definitions in this file are for the convenience of internal
14// implementation and test code, and are not intended to be used publicly.
15// The namespace "internal" indicates the intent.
16
17namespace isc {
18namespace util {
19namespace io {
20 namespace internal {
21
22// Lower level C-APIs require conversion between char* pointers
23// (like structures returned by CMSG_DATA macro) and in6_pktinfo,
24// which is not friendly with C++. The following templates
25// are a shortcut of common workaround conversion in such cases.
26inline struct in6_pktinfo*
27convertPktInfo6(char* pktinfo) {
28 return (static_cast<struct in6_pktinfo*>(static_cast<void*>(pktinfo)));
29}
30
31inline struct in6_pktinfo*
32 convertPktInfo6(unsigned char* pktinfo) {
33 return (static_cast<struct in6_pktinfo*>(static_cast<void*>(pktinfo)));
34}
35
37
38}
39}
40}
41}
42
43#endif // PKTINFO_UTIL_H
isc::util::io::internal
Definition pktinfo_utilities.h:20
isc::util::io::internal::convertPktInfo6
struct in6_pktinfo * convertPktInfo6(char *pktinfo)
Definition pktinfo_utilities.h:27
isc::util::io
Definition fd.cc:16
isc::util
Definition time_utils.cc:43
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148