Kea 2.5.6
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 {
20namespace 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*
32convertPktInfo6(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
struct in6_pktinfo * convertPktInfo6(char *pktinfo)
Defines the logger used by the top-level component of kea-lfc.