/home/tai/chorist/xian-1.2/src/xmm.c File Reference


Detailed Description

The XMM (XIAN Metric Manager) Module - xmm.c.

The XIAN Manager Module is the core of the XIAN Nano-Protocol. It offers functionnalities to send regularly metrics and to set a function which will be executed at the reception of a metric.

Authors:
THALES Communications
Todo:
improve the management with broadcast.

extends the numbers of configuration managed.

Definition in file xmm.c.

#include <linux/init.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include "include/xian_proto.h"
#include "include/itm.h"
#include "include/ksi.h"
#include <linux/version.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <asm/signal.h>
#include <asm/semaphore.h>

Go to the source code of this file.

Data Structures

struct  tab_mac
struct  my_threads
 a structure to store all information we need for our thread More...

Functions

 MODULE_DESCRIPTION ("XMM - XIAN Metric Manager Module")
 MODULE_LICENSE ("GPL")
void insert_mac_to_broadcast (unsigned char *saddr)
 This function is necessary to build the list of MAC address to send a broadcast message with a metric with different value by nodes representing by its MAC addresses.
 XIAN_EXPORT_SYMBOL (insert_mac_to_broadcast)
void delete_mac_to_broadcast (unsigned char *saddr)
 This function deletes a MAC address in the list of neighbour nodes.
 XIAN_EXPORT_SYMBOL (delete_mac_to_broadcast)
void free_mac_to_broadcast (void)
 XIAN_EXPORT_SYMBOL (free_mac_to_broadcast)
void thread_function (my_threads *thread)
 This function allows the sending of XIAN message report regularly for a thread.
void print_tab (void)
 This function allows to see the configuration of tab with dmesg.
void register_id (unsigned int id, unsigned int metric, char dev[IFNAMESIZ+1], char mac[IEEE80211_MAC_ADDR_LEN+1], unsigned int freq, void *pf)
 This function allows to register a configuration for a metric.
 XIAN_EXPORT_SYMBOL (register_id)
void register_id_no_report (unsigned int id, unsigned int metric, char dev[IFNAMESIZ+1], char mac[IEEE80211_MAC_ADDR_LEN+1], void *pf)
 This function allows to register a configuration for a metric with any message sended.
 XIAN_EXPORT_SYMBOL (register_id_no_report)
void unregister_id (unsigned int id, unsigned int metric)
 This function is used to unregister a metric configuration.
 XIAN_EXPORT_SYMBOL (unregister_id)
int XIAN_Manager_receive (unsigned char *saddr, struct xian_msg *stat)
 This function allows the reception of a XIAN message and call the right function for a metric configured.
 XIAN_EXPORT_SYMBOL (XIAN_Manager_receive)
int xian_man_init (void)
void xian_man_exit (void)
 module_init (xian_man_init)
 module_exit (xian_man_exit)
struct xian_float get_metric (char dev_name[IFNAMESIZ+1], char macaddr[IEEE80211_MAC_ADDR_LEN+1], unsigned int metric, unsigned int *code_err)
 This function gets the value of a metric.
 XIAN_EXPORT_SYMBOL (get_metric)

Variables

struct metric_conf tab [NB_MAX_INDEX]
struct tab_mactab_mac_to_broadcast
my_threads kthreads [NB_MAX_INDEX]


Function Documentation

MODULE_DESCRIPTION ( "XMM - XIAN Metric Manager Module"   ) 

MODULE_LICENSE ( "GPL"   ) 

void insert_mac_to_broadcast ( unsigned char *  saddr  ) 

This function is necessary to build the list of MAC address to send a broadcast message with a metric with different value by nodes representing by its MAC addresses.

Parameters:
saddr an array of char representing a Mac Address formatted as follow XX:XX:XX:XX:XX:XX
Returns:
-

Definition at line 74 of file xmm.c.

References IEEE80211_MAC_ADDR_LEN, tab_mac::mac, and tab_mac::next.

XIAN_EXPORT_SYMBOL ( insert_mac_to_broadcast   ) 

void delete_mac_to_broadcast ( unsigned char *  saddr  ) 

This function deletes a MAC address in the list of neighbour nodes.

Parameters:
saddr an array of char representing a Mac Address formatted as follow XX:XX:XX:XX:XX:XX
Returns:
-

Definition at line 97 of file xmm.c.

References IEEE80211_MAC_ADDR_LEN, tab_mac::mac, and tab_mac::next.

XIAN_EXPORT_SYMBOL ( delete_mac_to_broadcast   ) 

void free_mac_to_broadcast ( void   ) 

Definition at line 113 of file xmm.c.

References tab_mac::next.

XIAN_EXPORT_SYMBOL ( free_mac_to_broadcast   ) 

void thread_function ( my_threads thread  ) 

This function allows the sending of XIAN message report regularly for a thread.

Parameters:
thread a thread
Returns:
-

Definition at line 1028 of file xmm.c.

References convert_mac_addr(), my_threads::data, metric_conf::dev_name, qos_metric_proto_msg::dev_name, ETH_ALEN, metric_conf::frequency, get_metric(), metric_conf::id, IEEE80211_MAC_ADDR_LEN, metric_conf::index, kinsert_metric(), ksend_metric(), tab_mac::mac, metric_conf::macadd, qos_metric_proto_msg::macaddr, metric_conf::metrics, metric_conf::nb, qos_metric_proto_msg::nb, NB_METRICS, tab_mac::next, print_tab(), my_threads::terminate, and metric_conf::value.

Referenced by register_id().

void print_tab ( void   ) 

This function allows to see the configuration of tab with dmesg.

Definition at line 247 of file xmm.c.

References metric_conf::nb, NB_MAX_INDEX, NB_METRICS, and tab.

Referenced by thread_function().

void register_id ( unsigned int  id,
unsigned int  metric,
char  dev[IFNAMESIZ+1],
char  mac[IEEE80211_MAC_ADDR_LEN+1],
unsigned int  freq,
void *  pf 
)

This function allows to register a configuration for a metric.

Parameters:
id identification of the configuration
metric the metric number
dev an array of char representing a device name
mac an array of char representing a Mac Address formatted as follow XX:XX:XX:XX:XX:XX
freq frequency in milliseconds
pf a pointer to a function of treatment
Returns:
-

Definition at line 271 of file xmm.c.

References dev_name, metric_conf::frequency, metric_conf::function, metric_conf::id, IEEE80211_MAC_ADDR_LEN, IFNAMESIZ, metric_conf::index, macadd, metric_conf::metrics, metric_conf::nb, NB_MAX_INDEX, NB_METRICS, tab, and thread_function().

XIAN_EXPORT_SYMBOL ( register_id   ) 

void register_id_no_report ( unsigned int  id,
unsigned int  metric,
char  dev[IFNAMESIZ+1],
char  mac[IEEE80211_MAC_ADDR_LEN+1],
void *  pf 
)

This function allows to register a configuration for a metric with any message sended.

Parameters:
id identification of the configuration
metric the metric number
dev an array of char representing a device name
mac an array of char representing a Mac Address formatted as follow XX:XX:XX:XX:XX:XX
pf a pointer to a function of treatment
Returns:
-

Definition at line 324 of file xmm.c.

References register_id().

XIAN_EXPORT_SYMBOL ( register_id_no_report   ) 

void unregister_id ( unsigned int  id,
unsigned int  metric 
)

This function is used to unregister a metric configuration.

Parameters:
id identification of the configuration
metric the metric number
Returns:
-

Definition at line 335 of file xmm.c.

References metric_conf::function, metric_conf::id, metric_conf::index, metric_conf::metrics, metric_conf::nb, NB_MAX_INDEX, tab, and metric_conf::value.

XIAN_EXPORT_SYMBOL ( unregister_id   ) 

int XIAN_Manager_receive ( unsigned char *  saddr,
struct xian_msg stat 
)

This function allows the reception of a XIAN message and call the right function for a metric configured.

Parameters:
saddr a pointer to an Array of char representing a Mac Address formatted as follow XX:XX:XX:XX:XX:XX
stat a pointer to a XIAN message
Returns:
-

Definition at line 376 of file xmm.c.

References convert_hexamac(), convert_mac_addr(), ETH_ALEN, metric_conf::function, IEEE80211_MAC_ADDR_LEN, xian_msg::length, xian_msg::msg, metric_conf::nb, NB_MAX_INDEX, tab, and metric_msg::type.

XIAN_EXPORT_SYMBOL ( XIAN_Manager_receive   ) 

int xian_man_init ( void   ) 

Definition at line 404 of file xmm.c.

References config_relay(), metric_conf::id, metric_conf::index, metric_conf::nb, NB_MAX_INDEX, tab, and XIAN_Manager_receive().

void xian_man_exit ( void   ) 

Definition at line 422 of file xmm.c.

References config_relay(), and NB_MAX_INDEX.

module_init ( xian_man_init   ) 

module_exit ( xian_man_exit   ) 

struct xian_float get_metric ( char  dev_name[IFNAMESIZ+1],
char  macaddr[IEEE80211_MAC_ADDR_LEN+1],
unsigned int  metric,
unsigned int *  code_err 
) [read]

This function gets the value of a metric.

Parameters:
dev_name name of the network interface
macaddr a pointer to an Array of char representing a Mac Address formatted as follow XX:XX:XX:XX:XX:XX
metric an unsigned int representing the metric
code_err output a code error if an error occurs
Returns:
struct xian_float the value of the metric
Bug:
some metrics are commented to avoid kernel freeze.

Definition at line 444 of file xmm.c.

References AST_ANT_DEFSWITCH, AST_ANT_TXSWITCH, AST_BE_NOBUF, AST_BE_XMIT, AST_BMISS, AST_BSTUCK, AST_HARDWARE, AST_INTRCOAL, AST_MIB, AST_PER_CAL, AST_PER_CALFAIL, AST_PER_RFGAIN, AST_RATE_CALLS, AST_RATE_DROP, AST_RATE_RAISE, AST_RX_BADCRYPT, AST_RX_BADMIC, AST_RX_BUSDMA, AST_RX_CRCERR, AST_RX_CTL, AST_RX_FIFOERR, AST_RX_MGT, AST_RX_NOBUF, AST_RX_ORN, AST_RX_PACKETS, AST_RX_PHYERR, AST_RX_RSSI, AST_RX_TOOBIG, AST_RX_TOOSHORT, AST_RXEOL, AST_RXORN, AST_TX_ALTRATE, AST_TX_BADRATE, AST_TX_BUSDMA, AST_TX_CTS, AST_TX_CTSBURST, AST_TX_CTSEXT, AST_TX_DISCARD, AST_TX_ENCAP, AST_TX_FIFOERR, AST_TX_FILTERED, AST_TX_INVALID, AST_TX_LINEAR, AST_TX_LONGRETRY, AST_TX_MGMT, AST_TX_NOACK, AST_TX_NOBUF, AST_TX_NOBUFMGT, AST_TX_NODATA, AST_TX_NONODE, AST_TX_PACKETS, AST_TX_PROTECT, AST_TX_QSTOP, AST_TX_RSSI, AST_TX_RTS, AST_TX_SHORTPRE, AST_TX_SHORTRETRY, AST_TX_XRETRIES, AST_TXURN, AST_WATCHDOG, convert_mac_addr(), dev_name, ETH_ALEN, get_ast_ant_defswitch(), get_ast_ant_txswitch(), get_ast_be_nobuf(), get_ast_be_xmit(), get_ast_bmiss(), get_ast_bstuck(), get_ast_hardware(), get_ast_intrcoal(), get_ast_mib(), get_ast_per_cal(), get_ast_per_calfail(), get_ast_per_rfgain(), get_ast_rate_calls(), get_ast_rate_drop(), get_ast_rate_raise(), get_ast_rx_badcrypt(), get_ast_rx_badmic(), get_ast_rx_busdma(), get_ast_rx_crcerr(), get_ast_rx_ctl(), get_ast_rx_fifoerr(), get_ast_rx_mgt(), get_ast_rx_nobuf(), get_ast_rx_orn(), get_ast_rx_packets(), get_ast_rx_phyerr(), get_ast_rx_rssi(), get_ast_rx_toobig(), get_ast_rx_tooshort(), get_ast_rxeol(), get_ast_rxorn(), get_ast_tx_altrate(), get_ast_tx_badrate(), get_ast_tx_busdma(), get_ast_tx_cts(), get_ast_tx_ctsburst(), get_ast_tx_ctsext(), get_ast_tx_discard(), get_ast_tx_encap(), get_ast_tx_fifoerr(), get_ast_tx_filtered(), get_ast_tx_invalid(), get_ast_tx_linear(), get_ast_tx_longretry(), get_ast_tx_mgmt(), get_ast_tx_noack(), get_ast_tx_nobuf(), get_ast_tx_nobufmgt(), get_ast_tx_nodata(), get_ast_tx_nonode(), get_ast_tx_packets(), get_ast_tx_protect(), get_ast_tx_qstop(), get_ast_tx_rssi(), get_ast_tx_rts(), get_ast_tx_shortpre(), get_ast_tx_shortretry(), get_ast_tx_xretries(), get_ast_txurn(), get_ast_watchdog(), get_is_rx_ahdemo_mgt(), get_is_rx_assoc_badwpaie(), get_is_rx_assoc_bss(), get_is_rx_assoc_capmismatch(), get_is_rx_assoc_norate(), get_is_rx_assoc_notauth(), get_is_rx_auth_countermeasures(), get_is_rx_auth_fail(), get_is_rx_auth_unsupported(), get_is_rx_bad_auth(), get_is_rx_badchan(), get_is_rx_badsubtype(), get_is_rx_badversion(), get_is_rx_beacon(), get_is_rx_chanmismatch(), get_is_rx_ctl(), get_is_rx_deauth(), get_is_rx_decap(), get_is_rx_decryptcrc(), get_is_rx_disassoc(), get_is_rx_dup(), get_is_rx_elem_missing(), get_is_rx_elem_toobig(), get_is_rx_elem_toosmall(), get_is_rx_elem_unknown(), get_is_rx_mcastecho(), get_is_rx_mgtdiscard(), get_is_rx_nobuf(), get_is_rx_nodealloc(), get_is_rx_noprivacy(), get_is_rx_notassoc(), get_is_rx_rstoobig(), get_is_rx_ssidmismatch(), get_is_rx_tooshort(), get_is_rx_unauth(), get_is_rx_unencrypted(), get_is_rx_wepfail(), get_is_rx_wrongbss(), get_is_rx_wrongdir(), get_node_negotiated_rate(), get_node_on_tx_err(), get_node_on_tx_ok(), get_node_on_tx_retr(), get_node_ps_discard(), get_node_rssi(), get_node_rx_beacons(), get_node_rx_bytes(), get_node_rx_ctrl(), get_node_rx_data(), get_node_rx_deauth(), get_node_rx_decap(), get_node_rx_decryptcrc(), get_node_rx_defrag(), get_node_rx_demicfail(), get_node_rx_disassoc(), get_node_rx_dup(), get_node_rx_mcast(), get_node_rx_mgmt(), get_node_rx_noprivacy(), get_node_rx_proberesp(), get_node_rx_ucast(), get_node_rx_unauth(), get_node_rx_unencrypted(), get_node_rx_wepfail(), get_node_tx_assoc(), get_node_tx_assoc_fail(), get_node_tx_auth(), get_node_tx_auth_fail(), get_node_tx_bytes(), get_node_tx_data(), get_node_tx_deauth(), get_node_tx_deauth_code(), get_node_tx_disassoc(), get_node_tx_disassoc_code(), get_node_tx_mcast(), get_node_tx_mgmt(), get_node_tx_novlantag(), get_node_tx_probereq(), get_node_tx_ucast(), get_node_tx_vlanmismatch(), get_node_txpower(), get_xian_stat(), int2xian_float(), IS_RX_AHDEMO_MGT, IS_RX_ASSOC_BADWPAIE, IS_RX_ASSOC_BSS, IS_RX_ASSOC_CAPMISMATCH, IS_RX_ASSOC_NORATE, IS_RX_ASSOC_NOTAUTH, IS_RX_AUTH_COUNTERMEASURES, IS_RX_AUTH_FAIL, IS_RX_AUTH_UNSUPPORTED, IS_RX_BAD_AUTH, IS_RX_BADCHAN, IS_RX_BADSUBTYPE, IS_RX_BADVERSION, IS_RX_BEACON, IS_RX_CHANMISMATCH, IS_RX_CTL, IS_RX_DEAUTH, IS_RX_DECAP, IS_RX_DECRYPTCRC, IS_RX_DISASSOC, IS_RX_DUP, IS_RX_ELEM_MISSING, IS_RX_ELEM_TOOBIG, IS_RX_ELEM_TOOSMALL, IS_RX_ELEM_UNKNOWN, IS_RX_MCASTECHO, IS_RX_MGTDISCARD, IS_RX_NOBUF, IS_RX_NODEALLOC, IS_RX_NOPRIVACY, IS_RX_NOTASSOC, IS_RX_RSTOOBIG, IS_RX_SSIDMISMATCH, IS_RX_TOOSHORT, IS_RX_UNAUTH, IS_RX_UNENCRYPTED, IS_RX_WEPFAIL, IS_RX_WRONGBSS, IS_RX_WRONGDIR, metric, NODE_NEGOTIATED_RATE, NODE_ON_TX_ERR, NODE_ON_TX_OK, NODE_ON_TX_RETR, NODE_PS_DISCARD, NODE_RSSI, NODE_RX_BEACONS, NODE_RX_BYTES, NODE_RX_CTRL, NODE_RX_DATA, NODE_RX_DEAUTH, NODE_RX_DECAP, NODE_RX_DECRYPTCRC, NODE_RX_DEFRAG, NODE_RX_DEMICFAIL, NODE_RX_DISASSOC, NODE_RX_DUP, NODE_RX_MCAST, NODE_RX_MGMT, NODE_RX_NOPRIVACY, NODE_RX_PROBERESP, NODE_RX_UCAST, NODE_RX_UNAUTH, NODE_RX_UNENCRYPTED, NODE_RX_WEPFAIL, NODE_TX_ASSOC, NODE_TX_ASSOC_FAIL, NODE_TX_AUTH, NODE_TX_AUTH_FAIL, NODE_TX_BYTES, NODE_TX_DATA, NODE_TX_DEAUTH, NODE_TX_DEAUTH_CODE, NODE_TX_DISASSOC, NODE_TX_DISASSOC_CODE, NODE_TX_MCAST, NODE_TX_MGMT, NODE_TX_NOVLANTAG, NODE_TX_PROBEREQ, NODE_TX_UCAST, NODE_TX_VLANMISMATCH, NODE_TXPOWER, and UNKNOW_METRIC.

Referenced by thread_function().

XIAN_EXPORT_SYMBOL ( get_metric   ) 


Variable Documentation

struct metric_conf tab[NB_MAX_INDEX]

Definition at line 61 of file xmm.c.

Referenced by print_tab(), register_id(), unregister_id(), xian_man_init(), and XIAN_Manager_receive().

struct tab_mac* tab_mac_to_broadcast

Definition at line 66 of file xmm.c.

my_threads kthreads[NB_MAX_INDEX]

Definition at line 154 of file xmm.c.


Generated on Mon Jan 21 12:31:48 2008 for XIAN by  doxygen 1.5.3