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
local-datagram-socket-fd.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011 INRIA
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
* Author: Frederic Urbani <frederic.urbani@inria.fr>
19
*
20
*/
21
#ifndef LOCAL_DATAGRAM_SOCKET_FD_H
22
#define LOCAL_DATAGRAM_SOCKET_FD_H
23
24
#include "
unix-fd.h
"
25
#include "ns3/ptr.h"
26
#include <set>
27
#include "ns3/nstime.h"
28
#include "ns3/object.h"
29
#include "
local-socket-fd.h
"
30
31
namespace
ns3 {
32
33
class
Waiter;
34
43
class
LocalSocketFdFactory;
44
45
#define LOCAL_SOCKET_MAX_BUFFER 1024 * 128
46
47
class
LocalDatagramSocketFd
:
public
LocalSocketFd
48
{
49
public
:
50
static
TypeId
GetTypeId
(
void
);
51
virtual
TypeId
GetInstanceTypeId
(
void
)
const
;
52
53
LocalDatagramSocketFd
(Ptr<LocalSocketFdFactory> f);
54
virtual
~LocalDatagramSocketFd
();
55
56
virtual
void
DoDispose
(
void
);
57
virtual
int
Close
(
void
);
58
virtual
ssize_t
Write
(
const
void
*buf,
size_t
count);
59
virtual
ssize_t
Read
(
void
*buf,
size_t
count);
60
virtual
ssize_t
Recvmsg
(
struct
msghdr *msg,
int
flags);
61
virtual
ssize_t
Sendmsg
(
const
struct
msghdr *msg,
int
flags);
62
63
virtual
int
Setsockopt
(
int
level,
int
optname,
64
const
void
*optval, socklen_t optlen);
65
virtual
int
Getsockopt
(
int
level,
int
optname,
66
void
*optval, socklen_t *optlen);
67
virtual
int
Getsockname
(
struct
sockaddr *name, socklen_t *namelen);
68
virtual
int
Getpeername
(
struct
sockaddr *name, socklen_t *namelen);
69
virtual
int
Bind
(
const
struct
sockaddr *my_addr, socklen_t addrlen);
70
virtual
int
Connect
(
const
struct
sockaddr *my_addr, socklen_t addrlen);
71
virtual
int
Listen
(
int
backlog);
72
virtual
int
Shutdown
(
int
how);
73
virtual
int
Accept
(
struct
sockaddr *my_addr, socklen_t *addrlen);
74
75
virtual
bool
CanRecv
(
void
)
const
;
76
virtual
bool
CanSend
(
void
)
const
;
77
virtual
bool
HangupReceived
(
void
)
const
;
78
virtual
int
Poll
(
PollTable
* ptable);
79
80
protected
:
81
virtual
void
ClearAll
(
bool
andWakeUp);
82
virtual
bool
IsClosed
(
void
)
const
;
83
84
private
:
85
bool
IsBinded
(
void
);
86
void
UnBind
(
void
);
87
ssize_t
Read
(
void
*buf,
size_t
count,
bool
noWait,
bool
peek);
88
void
AddConnected
(
LocalDatagramSocketFd
*newone);
89
void
RemoveConnected
(
LocalDatagramSocketFd
*freeOne,
bool
andWakeUp);
90
91
ssize_t
Write2Peer
(
const
void
*buf,
size_t
count,
LocalDatagramSocketFd
* peer);
92
93
enum
State
94
{
95
CREATED
,
96
BINDED
,
97
CONNECTED
,
98
REMOTECLOSED
,
99
CLOSED
100
};
101
enum
State
m_state
;
102
103
// Because of the implementation of
104
// Filled when CONNECTED
105
LocalDatagramSocketFd
*
m_peer
;
106
// When I am BINDED I could have much peers.
107
std::set<LocalDatagramSocketFd*>
m_myPeers
;
108
};
109
110
}
// namespace ns3
111
112
#endif
/* LOCAL_SOCKET_FD_H */
model
local-datagram-socket-fd.h
Generated on Fri Aug 30 2013 13:57:56 for ns-3-dce by
1.8.1.2