N-sim
Emulation and simulation of
Wireless Sensor Networks



   Home


   Project Page


   Download


   CVS



   Installation


   Configuration


   Plug-ins




 Hosted by
SourceForge.net Logo

/home/brennan/n-sim/OrbisQuartus/server/xen/backend/sim_if.c File Reference

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/ioctl.h>
#include <linux/proc_fs.h>
#include <linux/fs.h>
#include "oq_kmod.h"
#include "avl.h"
#include <sim_if.h>

Go to the source code of this file.

Classes

struct  knode
struct  ksensor
struct  khost
struct  data_t

Defines

#define META_NUM_TYPES   4

Enumerations

enum  file_t { SIM_ID = 0, TIME = 1, ADD_HOST = 2, RM_HOST = 3 }

Functions

 EXPORT_SYMBOL (req_resp_lists)
int add_node (unsigned int id)
void remove_node (unsigned int number)
int add_sensor_entry (unsigned int node, unsigned int number, unsigned int id)
void remove_sensor_entry (unsigned int number)
int post_sensor_stats (struct sensor_stats stats)
loff_t oq_llseek (struct file *filp, loff_t pos, int where)
ssize_t oq_read (struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
ssize_t oq_write (struct file *filp, const char __user *buf, size_t count, loff_t *f_pos)
int oq_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
int oq_open (struct inode *inode, struct file *filp)
int oq_release (struct inode *inode, struct file *filp)
int OQLOG (const char *fmt,...)
int init_simulator_iface (int test)
void shutdown_simulator_iface (void)

Variables

oq_req_resp_list * req_resp_lists
char oq_simulation_daemon [PATH_MAX]
proc_dir_entry * oq_dir
oq_devoq_device
proc_dir_entry * oq_hosts
proc_dir_entry * oq_sensors
avltree ksensors
avltree knodes
unsigned int simulation_on
unsigned long ksim_id
unsigned long ktime_dilation_ratio
khost khosts
data_t metadata [META_NUM_TYPES]


Define Documentation

#define META_NUM_TYPES   4
 

Definition at line 97 of file sim_if.c.


Enumeration Type Documentation

enum file_t
 

Enumerator:
SIM_ID 
TIME 
ADD_HOST 
RM_HOST 

Definition at line 99 of file sim_if.c.


Function Documentation

int add_node unsigned int  id  ) 
 

Definition at line 259 of file sim_if.c.

References avl_insert(), and knodes.

int add_sensor_entry unsigned int  node,
unsigned int  number,
unsigned int  id
 

Definition at line 290 of file sim_if.c.

References avl_delete(), avl_insert(), avl_retrieve(), ksensors, MAX_NAME, and oq_sensors.

EXPORT_SYMBOL req_resp_lists   ) 
 

int init_simulator_iface int  test  ) 
 

Definition at line 681 of file sim_if.c.

References add_entry(), ADD_HOST, khosts, khost::list, metadata, oq_dir, oq_hosts, oq_sensors, req_resp_lists, RM_HOST, SIM_ID, simulation_on, and TIME.

int oq_ioctl struct inode *  inode,
struct file *  filp,
unsigned int  cmd,
unsigned long  arg
 

Todo:
{sensor config/reconfig and stats}

Definition at line 567 of file sim_if.c.

References oq_req_resp::list, OQ_REQ_REPEAT, OQ_RESP_INIT, OQ_RESP_REINIT, OQ_RESP_RESULT, req_resp_lists, and simulation_on.

loff_t oq_llseek struct file *  filp,
loff_t  pos,
int  where
 

Definition at line 433 of file sim_if.c.

References oq_dev::size.

int oq_open struct inode *  inode,
struct file *  filp
 

Definition at line 633 of file sim_if.c.

References oq_dev::cdev, and oq_dev::sem.

ssize_t oq_read struct file *  filp,
char __user *  buf,
size_t  count,
loff_t *  f_pos
 

Definition at line 463 of file sim_if.c.

References oq_log_item::data, OQ_LOG_ITEM_SIZE, OQ_LOG_SIZE, oq_dev::sem, and oq_dev::size.

int oq_release struct inode *  inode,
struct file *  filp
 

Definition at line 649 of file sim_if.c.

ssize_t oq_write struct file *  filp,
const char __user *  buf,
size_t  count,
loff_t *  f_pos
 

Definition at line 558 of file sim_if.c.

int OQLOG const char *  fmt,
  ...
 

Definition at line 656 of file sim_if.c.

References oq_device, OQ_LOG_ITEM_SIZE, and oq_dev::size.

int post_sensor_stats struct sensor_stats  stats  ) 
 

Definition at line 361 of file sim_if.c.

References avl_retrieve(), sensor_stats::id, ksensors, sensor_stats::rx_bytes, sensor_stats::rx_dropped, sensor_stats::rx_errors, sensor_stats::rx_overruns, ksensor::sensor, sensor_stats::tx_bytes, sensor_stats::tx_dropped, sensor_stats::tx_errors, and sensor_stats::tx_overruns.

void remove_node unsigned int  number  ) 
 

Definition at line 281 of file sim_if.c.

References avl_delete(), and knodes.

Referenced by shutdown_simulator_iface().

void remove_sensor_entry unsigned int  number  ) 
 

Definition at line 343 of file sim_if.c.

References avl_delete(), avl_retrieve(), sensor_stats::id, ksensors, MAX_NAME, ksensor::node_id, oq_sensors, ksensor::proc_entry, ksensor::sensor, and ksensor::sensor_number.

Referenced by shutdown_simulator_iface().

void shutdown_simulator_iface void   ) 
 

Definition at line 811 of file sim_if.c.

References avl_find_min(), avlnode::element, khosts, ksensors, khost::list, khost::name, oq_dir, oq_hosts, remove_node(), remove_sensor_entry(), and simulation_on.


Variable Documentation

struct khost khosts
 

Referenced by init_simulator_iface(), and shutdown_simulator_iface().

struct avltree knodes
 

Definition at line 74 of file sim_if.c.

Referenced by add_node(), and remove_node().

struct avltree ksensors
 

Definition at line 73 of file sim_if.c.

Referenced by add_sensor_entry(), post_sensor_stats(), remove_sensor_entry(), and shutdown_simulator_iface().

unsigned long ksim_id
 

Definition at line 78 of file sim_if.c.

unsigned long ktime_dilation_ratio
 

Definition at line 79 of file sim_if.c.

struct data_t metadata[META_NUM_TYPES]
 

Referenced by init_simulator_iface().

struct oq_dev* oq_device
 

Definition at line 59 of file oq.c.

Referenced by OQLOG().

struct proc_dir_entry* oq_dir
 

Definition at line 58 of file oq.c.

Referenced by init_simulator_iface(), and shutdown_simulator_iface().

struct proc_dir_entry* oq_hosts
 

Definition at line 59 of file sim_if.c.

Referenced by init_simulator_iface(), and shutdown_simulator_iface().

struct proc_dir_entry* oq_sensors
 

Definition at line 60 of file sim_if.c.

Referenced by add_sensor_entry(), init_simulator_iface(), and remove_sensor_entry().

char oq_simulation_daemon[PATH_MAX]
 

Definition at line 57 of file oq.c.

struct oq_req_resp_list* req_resp_lists
 

Todo:
Test failure modes

Definition at line 50 of file sim_if.c.

unsigned int simulation_on
 

Definition at line 77 of file sim_if.c.

Referenced by init_simulator_iface(), oq_ioctl(), and shutdown_simulator_iface().


© 2007, Los Alamos National Security, LLC.