A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
INetStreamSocket Struct Referenceabstract

Struct interface to NSC Stream (i.e., TCP) Sockets. More...

#include <sim_interface.h>

Public Member Functions

virtual ~INetStreamSocket ()
 
virtual int accept (INetStreamSocket **)=0
 Accept an incoming connection. More...
 
virtual void connect (const char *, int)=0
 Connect to a remote peer. More...
 
virtual void disconnect ()=0
 Disconnect from a remote peer. More...
 
virtual bool get_var (const char *var, char *result, int result_len)
 Optional function used to get variables for this TCP connection. More...
 
virtual int getpeername (struct sockaddr *sa, size_t *salen)
 Get the peer name. More...
 
virtual int getsockname (struct sockaddr *sa, size_t *salen)
 Get the socket local name. More...
 
virtual bool is_connected ()=0
 Check the connection state. More...
 
virtual bool is_listening ()=0
 Check the listening state. More...
 
virtual void listen (int)=0
 Put the socket in Listening state on a port. More...
 
virtual void print_state (FILE *)=0
 Print the socket state. More...
 
virtual int read_data (void *buf, int *buflen)=0
 Read some data. More...
 
virtual int send_data (const void *data, int datalen)=0
 Send some data. More...
 
virtual bool set_var (const char *var, const char *val)
 Optional function used to set variables for this TCP connection. More...
 
virtual int setsockopt (char *optname, void *val, size_t valsize)=0
 Set the socket options. More...
 

Detailed Description

Struct interface to NSC Stream (i.e., TCP) Sockets.

Definition at line 255 of file sim_interface.h.

Constructor & Destructor Documentation

virtual INetStreamSocket::~INetStreamSocket ( )
inlinevirtual

Definition at line 257 of file sim_interface.h.

Member Function Documentation

virtual int INetStreamSocket::accept ( INetStreamSocket **  )
pure virtual

Accept an incoming connection.

Referenced by ns3::NscTcpSocketImpl::Accept().

+ Here is the caller graph for this function:

virtual void INetStreamSocket::connect ( const char *  ,
int   
)
pure virtual

Connect to a remote peer.

Referenced by ns3::NscTcpSocketImpl::Connect().

+ Here is the caller graph for this function:

virtual void INetStreamSocket::disconnect ( )
pure virtual

Disconnect from a remote peer.

Referenced by ns3::NscTcpSocketImpl::Close(), and ns3::NscTcpSocketImpl::SendPendingData().

+ Here is the caller graph for this function:

virtual bool INetStreamSocket::get_var ( const char *  var,
char *  result,
int  result_len 
)
inlinevirtual

Optional function used to get variables for this TCP connection.

Note
not implemented
Parameters
varvariable requested
resultresult result
result_lenresult length
Returns
always false

Definition at line 350 of file sim_interface.h.

virtual int INetStreamSocket::getpeername ( struct sockaddr *  sa,
size_t *  salen 
)
inlinevirtual

Get the peer name.

Note
not implemented
Parameters
sasockaddr structure to fill
salensockaddr structure length
Returns
-1 on error (always returns -1)

Definition at line 325 of file sim_interface.h.

Referenced by ns3::NscTcpSocketImpl::CompleteFork().

+ Here is the caller graph for this function:

virtual int INetStreamSocket::getsockname ( struct sockaddr *  sa,
size_t *  salen 
)
inlinevirtual

Get the socket local name.

Note
not implemented
Parameters
sasockaddr structure to fill
salensockaddr structure length
Returns
-1 on error (always returns -1)

Definition at line 337 of file sim_interface.h.

Referenced by ns3::NscTcpSocketImpl::CompleteFork(), and ns3::NscTcpSocketImpl::ConnectionSucceeded().

+ Here is the caller graph for this function:

virtual bool INetStreamSocket::is_connected ( )
pure virtual

Check the connection state.

Returns
true if socket is in connected state

Referenced by ns3::NscTcpSocketImpl::NSCWakeup().

+ Here is the caller graph for this function:

virtual bool INetStreamSocket::is_listening ( )
pure virtual

Check the listening state.

Returns
true if socket is in listening state

Referenced by ns3::NscTcpSocketImpl::Accept().

+ Here is the caller graph for this function:

virtual void INetStreamSocket::listen ( int  )
pure virtual

Put the socket in Listening state on a port.

Referenced by ns3::NscTcpSocketImpl::Listen().

+ Here is the caller graph for this function:

virtual void INetStreamSocket::print_state ( FILE *  )
pure virtual

Print the socket state.

virtual int INetStreamSocket::read_data ( void *  buf,
int *  buflen 
)
pure virtual

Read some data.

Parameters
bufthe buffer to store the data
buflenbuffer length
Returns
the number of data read or -1 on error

Referenced by ns3::NscTcpSocketImpl::ReadPendingData().

+ Here is the caller graph for this function:

virtual int INetStreamSocket::send_data ( const void *  data,
int  datalen 
)
pure virtual

Send some data.

Parameters
datathe data
datalendata length
Returns
the number of data sent or -1 on error

Referenced by ns3::NscTcpSocketImpl::SendPendingData().

+ Here is the caller graph for this function:

virtual bool INetStreamSocket::set_var ( const char *  var,
const char *  val 
)
inlinevirtual

Optional function used to set variables for this TCP connection.

Note
not implemented
Parameters
varvariable to set
valvalue to set
Returns
always false

Definition at line 363 of file sim_interface.h.

virtual int INetStreamSocket::setsockopt ( char *  optname,
void *  val,
size_t  valsize 
)
pure virtual

Set the socket options.

We need to pass the option name in as a string here. The reason for this is that different operating systems you compile on will have different numbers defined for the constants SO_SNDBUF and so on.

Parameters
optnamename of the option
valoption value
valsizesize of the option value
Returns

The documentation for this struct was generated from the following file: