ns-3 Direct Code Execution
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dce-fd.cc File Reference
#include "dce-manager.h"
#include "process.h"
#include "utils.h"
#include "unix-fd.h"
#include "unix-file-fd.h"
#include "socket-fd-factory.h"
#include "waiter.h"
#include "dce-fcntl.h"
#include "dce-unistd.h"
#include "dce-poll.h"
#include "dce-stdio.h"
#include "sys/dce-socket.h"
#include "sys/dce-ioctl.h"
#include "sys/dce-stat.h"
#include "sys/dce-mman.h"
#include "sys/dce-select.h"
#include "ns3/log.h"
#include "ns3/event-id.h"
#include "ns3/simulator.h"
#include "ns3/nstime.h"
#include <fcntl.h>
#include <errno.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <sys/mman.h>
#include <sys/types.h>
#include "ns3/node.h"
#include "local-socket-fd-factory.h"
#include "ns3-socket-fd-factory.h"
#include "file-usage.h"
#include "dce-stdlib.h"
#include "pipe-fd.h"
+ Include dependency graph for dce-fd.cc:

Go to the source code of this file.

Macros

#define _LARGEFILE64_SOURCE   1
#define DEFINE_FORWARDER_PATH(name, pathname,...)
#define SOCK_MAX_ADDRESS_SIZE   128

Functions

int dce_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
int dce_access (const char *pathname, int mode)
int dce_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen)
int dce_close (int fd)
int dce_connect (int fd, const struct sockaddr *my_addr, socklen_t addrlen)
int dce_creat (const char *path, mode_t mode)
int dce_dup (int oldfd)
int dce_dup2 (int oldfd, int newfd)
int dce_fcntl (int fd, int cmd,...)
int dce_ftruncate (int fd, off_t length)
int dce_ftruncate64 (int fd, off_t length)
int dce_getpeername (int fd, struct sockaddr *name, socklen_t *namelen)
int dce_getsockname (int fd, struct sockaddr *name, socklen_t *namelen)
int dce_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen)
int dce_ioctl (int fd, long unsigned int request,...)
int dce_isatty (int fd)
int dce_listen (int fd, int backlog)
off_t dce_lseek (int fildes, off_t offset, int whence)
off64_t dce_lseek64 (int fd, off64_t offset, int whence)
int dce_mkdir (const char *pathname, mode_t mode)
void * dce_mmap (void *addr, size_t length, int prot, int flags, int fd, off_t offset)
void * dce_mmap64 (void *start, size_t length, int prot, int flags, int fd, off64_t offset)
int dce_munmap (void *start, size_t length)
int dce_open (const char *path, int flags,...)
int dce_open64 (const char *path, int flags,...)
int dce_pipe (int pipefd[2])
ssize_t dce_pread (int fd, void *buf, size_t count, off_t offset)
ssize_t dce_pwrite (int fd, const void *buf, size_t count, off_t offset)
ssize_t dce_read (int fd, void *buf, size_t count)
ssize_t dce_readv (int fd, const struct iovec *iov, int iovcnt)
ssize_t dce_recv (int fd, void *buf, size_t count, int flags)
ssize_t dce_recvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)
ssize_t dce_recvmsg (int fd, struct msghdr *msg, int flags)
int dce_rmdir (const char *pathname)
ssize_t dce_send (int fd, const void *buf, size_t len, int flags)
ssize_t dce_sendmsg (int fd, const struct msghdr *msg, int flags)
ssize_t dce_sendto (int fd, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)
int dce_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen)
int dce_shutdown (int fd, int how)
int dce_socket (int domain, int type, int protocol)
int dce_socketpair (int domain, int type, int protocol, int sv[2])
int dce_truncate (const char *path, off_t length)
char * dce_ttyname (int fd)
int dce_unlink (const char *pathname)
int dce_unlink_real (const char *pathname)
ssize_t dce_write (int fd, const void *buf, size_t count)
ssize_t dce_writev (int fd, const struct iovec *iov, int iovcnt)
 NS_LOG_COMPONENT_DEFINE ("SimuFd")
void unlink_notify (std::string fullpath)

Macro Definition Documentation

#define _LARGEFILE64_SOURCE   1

Definition at line 1 of file dce-fd.cc.

#define DEFINE_FORWARDER_PATH (   name,
  pathname,
  ... 
)
Value:
{ \
Thread *current = Current (); \
NS_LOG_FUNCTION (Current () << UtilsGetNodeId () << pathname); \
NS_ASSERT (Current () != 0); \
\
if (std::string (pathname) == std::string ("")) \
{ \
current->err = ENOENT; \
return -1; \
} \
std::string fullpath = UtilsGetRealFilePath (pathname); \
int status = ::name (fullpath.c_str (), ## __VA_ARGS__); \
if (status == -1) \
{ \
current->err = errno; \
return -1; \
} \
return status; \
}

Definition at line 44 of file dce-fd.cc.

Referenced by dce_access(), dce_mkdir(), dce_rmdir(), and dce_unlink_real().

#define SOCK_MAX_ADDRESS_SIZE   128

Definition at line 41 of file dce-fd.cc.

Referenced by dce_recvfrom().

Function Documentation

int dce_accept ( int  fd,
struct sockaddr *  addr,
socklen_t *  addrlen 
)

Definition at line 459 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

int dce_access ( const char *  pathname,
int  mode 
)

Definition at line 188 of file dce-fd.cc.

References DEFINE_FORWARDER_PATH.

Referenced by ns3::LinuxSocketFdFactory::Access().

+ Here is the caller graph for this function:

int dce_bind ( int  fd,
const struct sockaddr *  my_addr,
socklen_t  addrlen 
)

Definition at line 435 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

Referenced by dce_getifaddrs().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dce_connect ( int  fd,
const struct sockaddr *  my_addr,
socklen_t  addrlen 
)

Definition at line 443 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

int dce_creat ( const char *  path,
mode_t  mode 
)

Definition at line 138 of file dce-fd.cc.

References dce_open().

Referenced by ns3::DceManager::CreatePidFile().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dce_dup ( int  oldfd)

Definition at line 554 of file dce-fd.cc.

References ns3::CheckFdExists(), ns3::Current(), ns3::Thread::err, ns3::UnixFd::IncFdCount(), ns3::Process::openFiles, ns3::Thread::process, ns3::UtilsAllocateFd(), and ns3::UtilsGetNodeId().

Referenced by dce_fcntl().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dce_dup2 ( int  oldfd,
int  newfd 
)
int dce_fcntl ( int  fd,
int  cmd,
  ... 
)

Definition at line 656 of file dce-fd.cc.

References ns3::Current(), dce_dup(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

int dce_ftruncate ( int  fd,
off_t  length 
)

Definition at line 697 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

Referenced by dce_ftruncate64(), and dce_truncate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dce_ftruncate64 ( int  fd,
off_t  length 
)

Definition at line 715 of file dce-fd.cc.

References ns3::Current(), dce_ftruncate(), and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

int dce_getpeername ( int  fd,
struct sockaddr *  name,
socklen_t *  namelen 
)

Definition at line 546 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

int dce_getsockname ( int  fd,
struct sockaddr *  name,
socklen_t *  namelen 
)

Definition at line 538 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

Referenced by dce_getifaddrs().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dce_getsockopt ( int  fd,
int  level,
int  optname,
void *  optval,
socklen_t *  optlen 
)

Definition at line 529 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

int dce_ioctl ( int  fd,
long unsigned int  request,
  ... 
)

Definition at line 275 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

Referenced by dce_if_indextoname(), and dce_if_nametoindex().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dce_isatty ( int  fd)

Definition at line 226 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

int dce_listen ( int  fd,
int  backlog 
)

Definition at line 451 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

off_t dce_lseek ( int  fildes,
off_t  offset,
int  whence 
)

Definition at line 643 of file dce-fd.cc.

References ns3::Current(), dce_lseek64(), and ns3::UtilsGetNodeId().

Referenced by dce_fdopen(), dce_pread(), dce_pwrite(), anonymous_namespace{dce-stdio.cc}::mode_setup(), and anonymous_namespace{dce-stdio.cc}::my_seek().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

off64_t dce_lseek64 ( int  fd,
off64_t  offset,
int  whence 
)

Definition at line 648 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

Referenced by dce_lseek().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dce_mkdir ( const char *  pathname,
mode_t  mode 
)

Definition at line 179 of file dce-fd.cc.

References ns3::Current(), DEFINE_FORWARDER_PATH, ns3::Thread::process, and ns3::Process::uMask.

Referenced by ns3::DceManager::EnsureDirectoryExists(), and ns3::LinuxSocketFdFactory::Mkdir().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void* dce_mmap ( void *  addr,
size_t  length,
int  prot,
int  flags,
int  fd,
off_t  offset 
)

Definition at line 615 of file dce-fd.cc.

References dce_mmap64().

+ Here is the call graph for this function:

void* dce_mmap64 ( void *  start,
size_t  length,
int  prot,
int  flags,
int  fd,
off64_t  offset 
)

Definition at line 621 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD_ERR, and ns3::UtilsGetNodeId().

Referenced by dce_mmap().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dce_munmap ( void *  start,
size_t  length 
)

Definition at line 630 of file dce-fd.cc.

References ns3::Current(), ns3::Thread::err, errno, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

int dce_open ( const char *  path,
int  flags,
  ... 
)
int dce_open64 ( const char *  path,
int  flags,
  ... 
)

Definition at line 67 of file dce-fd.cc.

References dce_open().

+ Here is the call graph for this function:

int dce_pipe ( int  pipefd[2])

Definition at line 723 of file dce-fd.cc.

References ns3::Current(), ns3::Thread::err, ns3::UnixFd::IncFdCount(), ns3::Process::openFiles, ns3::Thread::process, ns3::UtilsAllocateFd(), and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

ssize_t dce_pread ( int  fd,
void *  buf,
size_t  count,
off_t  offset 
)

Definition at line 780 of file dce-fd.cc.

References ns3::Current(), dce_lseek(), dce_read(), ns3::Thread::err, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

ssize_t dce_pwrite ( int  fd,
const void *  buf,
size_t  count,
off_t  offset 
)

Definition at line 810 of file dce-fd.cc.

References ns3::Current(), dce_lseek(), dce_write(), ns3::Thread::err, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

ssize_t dce_read ( int  fd,
void *  buf,
size_t  count 
)

Definition at line 336 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

Referenced by dce_pread(), dce_readv(), and anonymous_namespace{dce-stdio.cc}::my_read().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ssize_t dce_readv ( int  fd,
const struct iovec *  iov,
int  iovcnt 
)

Definition at line 390 of file dce-fd.cc.

References ns3::Current(), dce_read(), and ns3::Thread::err.

+ Here is the call graph for this function:

ssize_t dce_recv ( int  fd,
void *  buf,
size_t  count,
int  flags 
)

Definition at line 475 of file dce-fd.cc.

References dce_recvfrom().

+ Here is the call graph for this function:

ssize_t dce_recvfrom ( int  fd,
void *  buf,
size_t  len,
int  flags,
struct sockaddr *  from,
socklen_t *  fromlen 
)

Definition at line 480 of file dce-fd.cc.

References ns3::Current(), dce_recvmsg(), ns3::Thread::err, and SOCK_MAX_ADDRESS_SIZE.

Referenced by dce_recv().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ssize_t dce_recvmsg ( int  fd,
struct msghdr *  msg,
int  flags 
)

Definition at line 512 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

Referenced by dce_recvfrom(), and netlink_request().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dce_rmdir ( const char *  pathname)

Definition at line 184 of file dce-fd.cc.

References DEFINE_FORWARDER_PATH.

ssize_t dce_send ( int  fd,
const void *  buf,
size_t  len,
int  flags 
)

Definition at line 242 of file dce-fd.cc.

References dce_sendto().

+ Here is the call graph for this function:

ssize_t dce_sendmsg ( int  fd,
const struct msghdr *  msg,
int  flags 
)

Definition at line 266 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

Referenced by dce_sendto().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ssize_t dce_sendto ( int  fd,
const void *  buf,
size_t  len,
int  flags,
const struct sockaddr *  to,
socklen_t  tolen 
)

Definition at line 247 of file dce-fd.cc.

References ns3::Current(), and dce_sendmsg().

Referenced by dce_send(), and netlink_request().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dce_setsockopt ( int  fd,
int  level,
int  optname,
const void *  optval,
socklen_t  optlen 
)

Definition at line 520 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

int dce_shutdown ( int  fd,
int  how 
)

Definition at line 467 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

int dce_socket ( int  domain,
int  type,
int  protocol 
)

Definition at line 344 of file dce-fd.cc.

References ns3::Current(), ns3::Thread::err, ns3::UnixFd::IncFdCount(), ns3::Process::manager, ns3::Process::openFiles, ns3::Thread::process, ns3::UtilsAllocateFd(), and ns3::UtilsGetNodeId().

Referenced by dce_getifaddrs(), dce_if_indextoname(), dce_if_nametoindex(), and dce_socketpair().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dce_socketpair ( int  domain,
int  type,
int  protocol,
int  sv[2] 
)

Definition at line 418 of file dce-fd.cc.

References dce_socket().

+ Here is the call graph for this function:

int dce_truncate ( const char *  path,
off_t  length 
)

Definition at line 681 of file dce-fd.cc.

References ns3::Current(), dce_ftruncate(), dce_open(), ns3::Thread::err, errno, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

char* dce_ttyname ( int  fd)

Definition at line 234 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

+ Here is the call graph for this function:

int dce_unlink ( const char *  pathname)

Definition at line 165 of file dce-fd.cc.

References dce_unlink_real(), unlink_notify(), and ns3::UtilsGetRealFilePath().

+ Here is the call graph for this function:

int dce_unlink_real ( const char *  pathname)

Definition at line 143 of file dce-fd.cc.

References DEFINE_FORWARDER_PATH.

Referenced by dce_unlink().

+ Here is the caller graph for this function:

ssize_t dce_write ( int  fd,
const void *  buf,
size_t  count 
)

Definition at line 288 of file dce-fd.cc.

References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().

Referenced by dce_pwrite(), and anonymous_namespace{dce-stdio.cc}::my_write().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ssize_t dce_writev ( int  fd,
const struct iovec *  iov,
int  iovcnt 
)
NS_LOG_COMPONENT_DEFINE ( "SimuFd"  )
void unlink_notify ( std::string  fullpath)

Definition at line 148 of file dce-fd.cc.

References ns3::Current(), ns3::Process::manager, ns3::Thread::process, ns3::SocketFdFactory::UnlinkNotify(), and ns3::LocalSocketFdFactory::UnlinkNotify().

Referenced by dce_unlink(), and dce_unlinkat().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: