ns-3 Direct Code Execution
Home
Tutorials ▼
Docs ▼
Wiki
Manual
Develop ▼
API
Bugs
API
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
unix-file-fd.h
Go to the documentation of this file.
1
#ifndef UNIX_FILE_FD_H
2
#define UNIX_FILE_FD_H
3
4
#include "
unix-fd.h
"
5
6
namespace
ns3 {
7
8
class
UnixFileFdBase
:
public
UnixFd
9
{
10
public
:
11
UnixFileFdBase
(
int
realFd);
12
virtual
~UnixFileFdBase
();
13
virtual
ssize_t
Write
(
const
void
*buf,
size_t
count);
14
virtual
ssize_t
Read
(
void
*buf,
size_t
count);
15
virtual
ssize_t
Recvmsg
(
struct
msghdr *msg,
int
flags);
16
virtual
ssize_t
Sendmsg
(
const
struct
msghdr *msg,
int
flags);
17
virtual
bool
Isatty
(
void
)
const
;
18
virtual
int
Setsockopt
(
int
level,
int
optname,
19
const
void
*optval, socklen_t optlen);
20
virtual
int
Getsockopt
(
int
level,
int
optname,
21
void
*optval, socklen_t *optlen);
22
virtual
int
Getsockname
(
struct
sockaddr *name, socklen_t *namelen);
23
virtual
int
Getpeername
(
struct
sockaddr *name, socklen_t *namelen);
24
virtual
int
Ioctl
(
int
request,
char
*argp);
25
virtual
int
Bind
(
const
struct
sockaddr *my_addr, socklen_t addrlen);
26
virtual
int
Connect
(
const
struct
sockaddr *my_addr, socklen_t addrlen);
27
virtual
int
Listen
(
int
backlog);
28
virtual
int
Accept
(
struct
sockaddr *my_addr, socklen_t *addrlen);
29
virtual
int
Shutdown
(
int
how);
30
virtual
void
*
Mmap
(
void
*start,
size_t
length,
int
prot,
int
flags,
31
off64_t offset);
32
virtual
off64_t
Lseek
(off64_t offset,
int
whence);
33
virtual
int
Fxstat
(
int
ver, struct ::stat *buf);
34
virtual
int
Fxstat64
(
int
ver, struct ::stat64 *buf);
35
virtual
int
Fcntl
(
int
cmd,
unsigned
long
arg);
36
virtual
int
Settime
(
int
flags,
37
const
struct
itimerspec *new_value,
38
struct
itimerspec *old_value);
39
virtual
int
Gettime
(
struct
itimerspec *cur_value)
const
;
40
virtual
int
Ftruncate
(off_t length);
41
42
virtual
bool
CanRecv
(
void
)
const
;
43
virtual
bool
CanSend
(
void
)
const
;
44
virtual
bool
HangupReceived
(
void
)
const
;
45
virtual
int
Poll
(
PollTable
* ptable);
46
virtual
int
GetRealFd
(
void
)
const
;
47
48
protected
:
49
int
PeekRealFd
(
void
)
const
;
50
private
:
51
int
m_realFd
;
52
};
53
54
class
UnixFileFd
:
public
UnixFileFdBase
55
{
56
public
:
57
UnixFileFd
(
int
realFd);
58
virtual
~UnixFileFd
();
59
virtual
int
Close
(
void
);
60
};
61
62
// Only for stdout and stderr emulation, open file at each write then close it, in order
63
// to have less file opened at same time see option
64
class
UnixFileFdLight
:
public
UnixFileFdBase
65
{
66
public
:
67
UnixFileFdLight
(std::string path);
68
virtual
~UnixFileFdLight
();
69
virtual
ssize_t
Write
(
const
void
*buf,
size_t
count);
70
virtual
int
Close
(
void
);
71
virtual
bool
CanSend
(
void
)
const
;
72
73
private
:
74
std::string
m_path
;
75
};
76
77
class
TermUnixFileFd
:
public
UnixFileFdBase
78
{
79
public
:
80
TermUnixFileFd
(
int
realFd);
81
virtual
~TermUnixFileFd
();
82
virtual
int
Close
(
void
);
83
};
84
85
// Dev Random special files
86
class
UnixRandomFd
:
public
UnixFileFdBase
87
{
88
public
:
89
UnixRandomFd
(std::string devicePath);
90
virtual
~UnixRandomFd
();
91
virtual
ssize_t
Read
(
void
*buf,
size_t
count);
92
virtual
bool
CanRecv
(
void
)
const
;
93
virtual
int
Close
(
void
);
94
virtual
bool
CanSend
(
void
)
const
;
95
virtual
ssize_t
Write
(
const
void
*buf,
size_t
count);
96
virtual
int
Fxstat
(
int
ver, struct ::stat *buf);
97
virtual
int
Fxstat64
(
int
ver, struct ::stat64 *buf);
98
99
private
:
100
std::string
m_devPath
;
101
};
102
103
}
// namespace ns3
104
105
#endif
/* UNIX_FILE_FD_H */
106
model
unix-file-fd.h
Generated on Fri Aug 30 2013 13:57:56 for ns-3-dce by
1.8.1.2