A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
emu-sock-creator.cc File Reference
#include <unistd.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdlib>
#include <cerrno>
#include <cstring>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/ioctl.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netpacket/packet.h>
#include <arpa/inet.h>
#include "emu-encode-decode.h"
+ Include dependency graph for emu-sock-creator.cc:

Go to the source code of this file.

Macros

#define ABORT(msg, printErrno)
 
#define ABORT_IF(cond, msg, printErrno)
 
#define EMU_MAGIC   65867
 
#define LOG(msg)
 

Functions

int main (int argc, char *argv[])
 
static void SendSocket (const char *path, int fd)
 Send the socket file descriptor we created back to the emu device, which will read it as soon as we're done. More...
 

Variables

static int gVerbose = 0
 

Macro Definition Documentation

#define ABORT (   msg,
  printErrno 
)
Value:
std::cout << __FILE__ << ": fatal error at line " << __LINE__ << ": " << __FUNCTION__ << "(): " << msg << std::endl; \
if (printErrno) \
{ \
std::cout << " errno = " << errno << " (" << std::strerror (errno) << ")" << std::endl; \
} \
exit (-1);

Definition at line 49 of file emu-sock-creator.cc.

#define ABORT_IF (   cond,
  msg,
  printErrno 
)
Value:
if (cond) \
{ \
ABORT (msg, printErrno); \
}
#define ABORT(msg, printErrno)

Definition at line 57 of file emu-sock-creator.cc.

Referenced by CreateTap(), main(), ReceiveVifFd(), ns3::SendSocket(), SendSocket(), SetIpv4(), SetIpv6(), SetMacAddress(), SetTunUp(), SetUp(), and TunAlloc().

#define EMU_MAGIC   65867

Definition at line 39 of file emu-sock-creator.cc.

Referenced by SendSocket().

#define LOG (   msg)
Value:
if (gVerbose) \
{ \
std::cout << __FUNCTION__ << "(): " << msg << std::endl; \
}
static int gVerbose

Definition at line 43 of file emu-sock-creator.cc.

Referenced by main(), and SendSocket().

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 196 of file emu-sock-creator.cc.

References ABORT_IF, gVerbose, LOG, and SendSocket().

+ Here is the call graph for this function:

static void SendSocket ( const char *  path,
int  fd 
)
static

Send the socket file descriptor we created back to the emu device, which will read it as soon as we're done.

Parameters
pathThe socket address information from the Unix socket we use to send the created socket back to.
fdThe socket we're going to send.

Definition at line 72 of file emu-sock-creator.cc.

References ABORT_IF, EMU_MAGIC, ns3::EmuStringToBuffer(), and LOG.

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

int gVerbose = 0
static

Definition at line 41 of file emu-sock-creator.cc.

Referenced by main().