22 #ifndef NSC_SIM_INTERFACE_H 23 #define NSC_SIM_INTERFACE_H 25 #define NSC_VERSION 0x000500 39 virtual void init (
int hz) = 0;
66 virtual void if_attach (
const char *addr,
const char *mask,
int mtu) = 0;
102 virtual int get_hz () = 0;
147 virtual int sysctl (
const char *sysctl_name,
void *oldval,
size_t *oldlenp,
148 void *newval,
size_t newlen)
178 virtual int sysctl_get (
const char *name,
char *value,
size_t len)
218 virtual bool get_var (
const char *var,
char *result,
int result_len)
229 virtual bool set_var (
const char *var,
const char *val)
249 virtual int cmd (
const char *)
266 virtual void connect (
const char *,
int) = 0;
274 virtual void listen (
int) = 0;
294 virtual int read_data (
void *buf,
int *buflen) = 0;
307 virtual int setsockopt (
char *optname,
void *val,
size_t valsize) = 0;
356 virtual bool get_var (
const char *var,
char *result,
int result_len)
369 virtual bool set_var (
const char *var,
const char *val)
422 virtual void wakeup () = 0;
426 virtual void gettime (
unsigned int *,
unsigned int *) = 0;
433 #define CREATE_STACK_FUNC(a,b,c) extern "C" INetStack *nsc_create_stack ( \ 434 ISendCallback *a, IInterruptCallback *b, FRandom c) virtual void if_receive_packet(int if_id, const void *data, int datalen)=0
Deliver complete packet to the NSC network stack.
virtual bool is_listening()=0
Check the listening state.
virtual void show_config()
Show the NSC configuration.
virtual void set_destination(const char *, int)=0
Set the destination address and port.
virtual ~INetDatagramSocket()
virtual bool get_var(const char *var, char *result, int result_len)
Optional function to get variables for this stack.
virtual int setsockopt(char *optname, void *val, size_t valsize)=0
Set the socket options.
virtual ~INetStreamSocket()
virtual bool get_var(const char *var, char *result, int result_len)
Optional function used to get variables for this TCP connection.
virtual void if_send_packet(const void *data, int datalen)=0
Send complete packet to the NSC network stack.
virtual void connect(const char *, int)=0
Connect to a remote peer.
virtual void increment_ticks()=0
Increment the time ticks.
Struct interface to NSC send capabilities.
virtual void wakeup()=0
Called by the NSC stack whenever something of interest has happened.
virtual int get_hz()=0
Get the timer_interrupt frequency.
virtual void send_callback(const void *data, int datalen)=0
Invoked by NSCs 'ethernet driver' to re-inject a packet into ns-3.
virtual const char * get_name()=0
Return a short one-word name of the stack.
virtual int send_data(const void *data, int datalen)=0
Send some data.
Struct interface to NSC stack.
virtual void send_data(const void *data, int datalen)=0
Send a datagram.
virtual void buffer_size(int size)=0
Set the buffer size.
virtual bool is_connected()=0
Check the connection state.
virtual void print_state(FILE *)=0
Print the socket state.
virtual int sysctl_set(const char *name, const char *value)
Set system parameters using sysctl.
Struct interface to NSC soft interrupt capabilities.
virtual void timer_interrupt()=0
The stack timer_interrupt function.
virtual void set_diagnostic(int level)
Set the level of debugging or diagnostic information to print out.
virtual struct INetStreamSocket * new_sctp_socket()
Create a new SCTP socket.
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[].
virtual void gettime(unsigned int *, unsigned int *)=0
Get the actual time.
virtual void add_default_gateway(const char *addr)=0
Add a default gateway to the interface.
virtual int getpeername(struct sockaddr *sa, size_t *salen)
Get the peer name.
virtual int getsockname(struct sockaddr *sa, size_t *salen)
Get the socket local name.
virtual void listen(int)=0
Put the socket in Listening state on a port.
virtual bool set_var(const char *var, const char *val)
Optional function used to set variables for this TCP connection.
virtual int sysctl(const char *sysctl_name, void *oldval, size_t *oldlenp, void *newval, size_t newlen)
use sysctl to modify system parameters
virtual ~IInterruptCallback()
virtual void if_attach(const char *addr, const char *mask, int mtu)=0
Attach an interface to the stack.
Struct interface to NSC Stream (i.e., TCP) Sockets.
virtual void disconnect()=0
Disconnect from a remote peer.
Struct interface to NSC Datagram (i.e., UDP) Sockets.
virtual void if_send_finish(int if_id)=0
Signal the completion of send procedure to the NSC network stack.
virtual int read_data(void *buf, int *buflen)=0
Read some data.
virtual struct INetStreamSocket * new_tcp_socket()
Create a new TCP socket.
virtual void init(int hz)=0
Initialize the stack.
virtual int accept(INetStreamSocket **handler)=0
Accept an incoming connection.
virtual bool set_var(const char *var, const char *val)
Optional function to set variables for this stack.
virtual int cmd(const char *)
Simple interface to support sending any textual command to a stack.
virtual int get_id()=0
Returns the internal id of the stack instance.
virtual struct INetDatagramSocket * new_udp_socket()
Create a new UDP socket.
virtual int sysctl_get(const char *name, char *value, size_t len)
Get system parameters using sysctl.