A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
creator-utils.h
Go to the documentation of this file.
1/*
2 * Copyright (c) University of Washington
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7#ifndef CREATOR_UTILS_H
8#define CREATOR_UTILS_H
9
10#include <cstring>
11#include <errno.h>
12#include <iomanip>
13#include <iostream>
14#include <sstream>
15#include <stdlib.h>
16#include <string>
17#include <sys/socket.h>
18#include <unistd.h>
19
20namespace ns3
21{
22
23extern bool gVerbose;
24
25#define LOG(msg) \
26 if (gVerbose) \
27 { \
28 std::cout << __FUNCTION__ << "(): " << msg << std::endl; \
29 }
30
31#define ABORT(msg, printErrno) \
32 std::cout << __FILE__ << ": fatal error at line " << __LINE__ << ": " << __FUNCTION__ \
33 << "(): " << msg << std::endl; \
34 if (printErrno) \
35 { \
36 std::cout << " errno = " << errno << " (" << strerror(errno) << ")" << std::endl; \
37 } \
38 exit(-1);
39
40#define ABORT_IF(cond, msg, printErrno) \
41 if (cond) \
42 { \
43 ABORT(msg, printErrno); \
44 }
45
46/**
47 * \ingroup fd-net-device
48 * \brief Send the file descriptor back to the code that invoked the creation.
49 *
50 * \param path The socket address information from the Unix socket we use
51 * to send the created socket back to.
52 * \param fd The file descriptor we're going to send.
53 * \param magic_number A verification number to verify the caller is talking to the
54 * right process.
55 */
56void SendSocket(const char* path, int fd, const int magic_number);
57
58} // namespace ns3
59
60#endif /* CREATOR_UTILS_DEVICE_H */
void SendSocket(const char *path, int fd, const int magic_number)
Send the file descriptor back to the code that invoked the creation.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool gVerbose
Flag to enable / disable verbose log mode.