A Discrete-Event Network Simulator
API
creator-utils.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) University of Washington
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 
19 #ifndef CREATOR_UTILS_H
20 #define CREATOR_UTILS_H
21 
22 #include <unistd.h>
23 #include <string>
24 #include <iostream>
25 #include <iomanip>
26 #include <sstream>
27 #include <stdlib.h>
28 #include <errno.h>
29 
30 #include <sys/socket.h>
31 
32 namespace ns3 {
33 
34 extern int gVerbose;
35 
36 #define LOG(msg) \
37  if (gVerbose) \
38  { \
39  std::cout << __FUNCTION__ << "(): " << msg << std::endl; \
40  }
41 
42 #define ABORT(msg, printErrno) \
43  std::cout << __FILE__ << ": fatal error at line " << __LINE__ << ": " << __FUNCTION__ << "(): " << msg << std::endl; \
44  if (printErrno) \
45  { \
46  std::cout << " errno = " << errno << " (" << strerror (errno) << ")" << std::endl; \
47  } \
48  exit (-1);
49 
50 #define ABORT_IF(cond, msg, printErrno) \
51  if (cond) \
52  { \
53  ABORT (msg, printErrno); \
54  }
55 
66 void SendSocket (const char *path, int fd, const int magic_number);
67 
68 } // namespace ns3
69 
70 #endif /* CREATOR_UTILS_DEVICE_H */
71 
void SendSocket(const char *path, int fd, const int magic_number)
Send the file descriptor back to the code that invoked the creation.
int gVerbose
Flag to enable / disable verbose log mode.
Every class exported by the ns3 library is enclosed in the ns3 namespace.