NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
privilege-helper.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_CORE_PRIVILEGE_HELPER_HPP
27
#define NFD_CORE_PRIVILEGE_HELPER_HPP
28
29
#include "
common.hpp
"
30
31
#include <unistd.h>
32
33
namespace
nfd
{
34
35
class
PrivilegeHelper
36
{
37
public
:
38
44
class
Error
45
{
46
public
:
47
explicit
48
Error
(
const
std::string&
what
)
49
: m_whatMessage(what)
50
{
51
}
52
53
const
char
*
54
what
()
const
55
{
56
return
m_whatMessage.c_str();
57
}
58
59
private
:
60
const
std::string m_whatMessage;
61
};
62
63
static
void
64
initialize
(
const
std::string& userName,
const
std::string& groupName);
65
66
static
void
67
drop
();
68
69
static
void
70
runElevated
(
function
<
void
()> f);
71
72
PUBLIC_WITH_TESTS_ELSE_PRIVATE
:
73
74
static
void
75
raise
();
76
77
PUBLIC_WITH_TESTS_ELSE_PRIVATE
:
78
#ifdef HAVE_PRIVILEGE_DROP_AND_ELEVATE
79
static
uid_t s_normalUid;
80
static
gid_t s_normalGid;
81
82
static
uid_t s_privilegedUid;
83
static
gid_t s_privilegedGid;
84
#endif // HAVE_PRIVILEGE_DROP_AND_ELEVATE
85
};
86
87
}
// namespace nfd
88
89
#endif // NFD_CORE_PRIVILEGE_HELPER_HPP
PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition:
common.hpp:40
nfd::PrivilegeHelper::runElevated
static void runElevated(function< void()> f)
Definition:
privilege-helper.cpp:196
nfd::PrivilegeHelper::Error
represents a serious seteuid/gid failure
Definition:
privilege-helper.hpp:44
nfd::PrivilegeHelper::drop
static void drop()
Definition:
privilege-helper.cpp:141
nfd::PrivilegeHelper::Error::Error
Error(const std::string &what)
Definition:
privilege-helper.hpp:48
common.hpp
nfd::PrivilegeHelper::initialize
static void initialize(const std::string &userName, const std::string &groupName)
Definition:
privilege-helper.cpp:45
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::PrivilegeHelper
Definition:
privilege-helper.hpp:35
nfd::PrivilegeHelper::Error::what
const char * what() const
Definition:
privilege-helper.hpp:54
ndnSIM
NFD
core
privilege-helper.hpp
Generated on Wed Jan 11 2017 18:17:15 for ndnSIM by
1.8.13