A Discrete-Event Network Simulator
API
INetStack Struct Referenceabstract

Struct interface to NSC stack. More...

#include "sim_interface.h"

Public Member Functions

virtual ~INetStack ()
 
virtual void add_default_gateway (const char *addr)=0
 Add a default gateway to the interface. More...
 
virtual void buffer_size (int size)=0
 Set the buffer size. More...
 
virtual int cmd (const char *)
 Simple interface to support sending any textual command to a stack. More...
 
virtual int get_hz ()=0
 Get the timer_interrupt frequency. More...
 
virtual int get_id ()=0
 Returns the internal id of the stack instance. More...
 
virtual const char * get_name ()=0
 Return a short one-word name of the stack. More...
 
virtual bool get_var (const char *var, char *result, int result_len)
 Optional function to get variables for this stack. More...
 
virtual void if_attach (const char *addr, const char *mask, int mtu)=0
 Attach an interface to the stack. More...
 
virtual void if_receive_packet (int if_id, const void *data, int datalen)=0
 Deliver complete packet to the NSC network stack. More...
 
virtual void if_send_finish (int if_id)=0
 Signal the completion of send procedure to the NSC network stack. More...
 
virtual void if_send_packet (const void *data, int datalen)=0
 Send complete packet to the NSC network stack. More...
 
virtual void increment_ticks ()=0
 Increment the time ticks. More...
 
virtual void init (int hz)=0
 Initialize the stack. More...
 
virtual struct INetStreamSocketnew_sctp_socket ()
 Create a new SCTP socket. More...
 
virtual struct INetStreamSocketnew_tcp_socket ()
 Create a new TCP socket. More...
 
virtual struct INetDatagramSocketnew_udp_socket ()
 Create a new UDP socket. More...
 
virtual void set_diagnostic (int level)
 Set the level of debugging or diagnostic information to print out. More...
 
virtual bool set_var (const char *var, const char *val)
 Optional function to set variables for this stack. More...
 
virtual void show_config ()
 Show the NSC configuration. More...
 
virtual int sysctl (const char *sysctl_name, void *oldval, size_t *oldlenp, void *newval, size_t newlen)
 use sysctl to modify system parameters More...
 
virtual int sysctl_get (const char *name, char *value, size_t len)
 Get system parameters using sysctl. More...
 
virtual int sysctl_getnum (size_t idx, char *name, size_t len)
 Tell the cradle code to put the name of sysctl number 'idx' into name[]. More...
 
virtual int sysctl_set (const char *name, const char *value)
 Set system parameters using sysctl. More...
 
virtual void timer_interrupt ()=0
 The stack timer_interrupt function. More...
 

Detailed Description

Struct interface to NSC stack.

Definition at line 31 of file sim_interface.h.

Constructor & Destructor Documentation

virtual INetStack::~INetStack ( )
inlinevirtual

Definition at line 33 of file sim_interface.h.

Member Function Documentation

virtual void INetStack::add_default_gateway ( const char *  addr)
pure virtual

Add a default gateway to the interface.

Parameters
addrgateway address

Referenced by ns3::NscTcpL4Protocol::AddInterface().

+ Here is the caller graph for this function:

virtual void INetStack::buffer_size ( int  size)
pure virtual

Set the buffer size.

virtual int INetStack::cmd ( const char *  )
inlinevirtual

Simple interface to support sending any textual command to a stack.

Returns
0 on success

Definition at line 245 of file sim_interface.h.

virtual int INetStack::get_hz ( )
pure virtual

Get the timer_interrupt frequency.

This is used so the simulator can call the stack timer_interrupt function the correct amount of times per second. For example, lwip has a hz of 10, which it returns here to say that it's timer_interrupt should be called 10 times a second. FreeBSD uses 100, as does Linux 2.4, while Linux 2.6 uses 1000. (This is often configurable in the kernel in question, also.)

Returns
frequency

Referenced by ns3::NscTcpL4Protocol::SetNode().

+ Here is the caller graph for this function:

virtual int INetStack::get_id ( )
pure virtual

Returns the internal id of the stack instance.

Purely for debugging/diagnostic purposes.

Returns
internal stack id
virtual const char* INetStack::get_name ( )
pure virtual

Return a short one-word name of the stack.

Should return a short one-word name of the stack. Eg. Linux 2.4.x -> linux24, FreeBSD 5.x -> freebsd5. This can be used to identify output from a stack, for example a packet trace file.

Returns
short one-word name of the stack

Referenced by ns3::Ns3NscStack::GetInstanceTypeId().

+ Here is the caller graph for this function:

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

Optional function to get variables for this stack.

Parameters
varthe variable
resultthe result
result_lenresult length
Returns
true on success

Definition at line 214 of file sim_interface.h.

virtual void INetStack::if_attach ( const char *  addr,
const char *  mask,
int  mtu 
)
pure virtual

Attach an interface to the stack.

Parameters
addraddress
masknetwork mask
mtuMTU

Referenced by ns3::NscTcpL4Protocol::AddInterface().

+ Here is the caller graph for this function:

virtual void INetStack::if_receive_packet ( int  if_id,
const void *  data,
int  datalen 
)
pure virtual

Deliver complete packet to the NSC network stack.

Parameters
if_idinterface ID
datadata
datalendata length

Referenced by ns3::NscTcpL4Protocol::Receive().

+ Here is the caller graph for this function:

virtual void INetStack::if_send_finish ( int  if_id)
pure virtual

Signal the completion of send procedure to the NSC network stack.

Parameters
if_idinterface ID

Referenced by ns3::NscTcpL4Protocol::send_callback().

+ Here is the caller graph for this function:

virtual void INetStack::if_send_packet ( const void *  data,
int  datalen 
)
pure virtual

Send complete packet to the NSC network stack.

Parameters
datadata
datalendata length
virtual void INetStack::increment_ticks ( )
pure virtual

Increment the time ticks.

Referenced by ns3::NscTcpL4Protocol::SoftInterrupt().

+ Here is the caller graph for this function:

virtual void INetStack::init ( int  hz)
pure virtual

Initialize the stack.

Parameters
hztimer_interrupt frequency

Referenced by ns3::NscTcpL4Protocol::SetNode().

+ Here is the caller graph for this function:

virtual struct INetStreamSocket* INetStack::new_sctp_socket ( )
inlinevirtual

Create a new SCTP socket.

Definition at line 130 of file sim_interface.h.

virtual struct INetStreamSocket* INetStack::new_tcp_socket ( )
inlinevirtual

Create a new TCP socket.

Definition at line 126 of file sim_interface.h.

virtual struct INetDatagramSocket* INetStack::new_udp_socket ( )
inlinevirtual

Create a new UDP socket.

Definition at line 122 of file sim_interface.h.

virtual void INetStack::set_diagnostic ( int  level)
inlinevirtual

Set the level of debugging or diagnostic information to print out.

This normally means kernel messages printed out during initialisation but may also include extra debugging messages that are part of NSC.

Parameters
leveldebugging/diagnostic level

Definition at line 238 of file sim_interface.h.

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

Optional function to set variables for this stack.

Parameters
varthe variable
valthe new value
Returns
true on success

Definition at line 225 of file sim_interface.h.

virtual void INetStack::show_config ( )
inlinevirtual

Show the NSC configuration.

Definition at line 202 of file sim_interface.h.

virtual int INetStack::sysctl ( const char *  sysctl_name,
void *  oldval,
size_t *  oldlenp,
void *  newval,
size_t  newlen 
)
inlinevirtual

use sysctl to modify system parameters

Parameters
sysctl_namename of the parameter to modify
oldvalold value
oldlenpold value length
newvalnew value
newlennew value length
Returns

Definition at line 143 of file sim_interface.h.

virtual int INetStack::sysctl_get ( const char *  name,
char *  value,
size_t  len 
)
inlinevirtual

Get system parameters using sysctl.

Parameters
namename of the parameter to modify
valuevalue
lenvalue length
Returns
length of the string in value, i.e. retval > len: 'output truncated'.

Definition at line 174 of file sim_interface.h.

Referenced by ns3::Ns3NscStack::Get(), and ns3::Ns3NscStack::GetInstanceTypeId().

+ Here is the caller graph for this function:

virtual int INetStack::sysctl_getnum ( size_t  idx,
char *  name,
size_t  len 
)
inlinevirtual

Tell the cradle code to put the name of sysctl number 'idx' into name[].

The idea is that this can be used to get a list of all available sysctls:

char buf[256]
for (i=0; sysctl_getnum(i, buf, sizeof(buf)) > 0 ;i++)
   puts(buf);
Parameters
idxindex
namesysctl name
lensysctl length
Returns
-1 if idx is out of range and the length of the sysctl name otherwise.

Definition at line 194 of file sim_interface.h.

Referenced by ns3::Ns3NscStack::GetInstanceTypeId().

+ Here is the caller graph for this function:

virtual int INetStack::sysctl_set ( const char *  name,
const char *  value 
)
inlinevirtual

Set system parameters using sysctl.

Parameters
namename of the parameter to modify
valuenew value
Returns

Definition at line 159 of file sim_interface.h.

Referenced by ns3::Ns3NscStack::Set().

+ Here is the caller graph for this function:

virtual void INetStack::timer_interrupt ( )
pure virtual

The stack timer_interrupt function.

Referenced by ns3::NscTcpL4Protocol::SoftInterrupt().

+ Here is the caller graph for this function:


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