ns-3 Direct Code Execution
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
exec-utils.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Frederic Urbani <frederic.urbani@inria.fr>
19  *
20  */
21 #ifndef EXEC_UTILS_H
22 #define EXEC_UTILS_H
23 
24 #include "utils.h"
25 
26 namespace ns3 {
27 
87 bool CanonizePath (std::string path, bool ChRootProtected, std::ostringstream &result);
88 
93 {
94 public:
101  SearchPath (std::string basepath, std::string path, bool virt);
102 
110  std::string SeekFile (std::string file, std::string cwd,
111  void *userData, bool (*checker)(std::string, void*));
112 
113 private:
114  bool m_virtual;
115  std::string m_basePath;
116  std::vector <std::string> m_paths;
117 };
118 
119 std::string SearchFile (std::string file,
120  std::string vroot,
121  std::string vpath,
122  std::string dcepath,
123  std::string cwd,
124  std::string altRoots,
125  void *userData,
126  bool (*checker)(std::string, void*));
127 
128 std::string
129 SearchFile (std::string file,
130  std::string vroot,
131  std::string cwd,
132  std::string altRoots,
133  void *userData,
134  bool (*checker)(std::string, void*));
135 
136 bool CheckFileExe (std::string file,void *userData);
137 
138 std::string SearchExecFile (std::string file, std::string vpath, uid_t uid, gid_t gid, int *errNo);
139 
140 // Without PATH only Real or Virtual root
141 std::string SearchExecFile (std::string file, uid_t uid, gid_t gid, int *errNo);
142 
143 // Search using only a path within an environment variable
144 std::string SearchExecFile (std::string env, std::string file, int *errNo);
145 
146 
147 }
148 
149 #endif