/home/tai/chorist/xian-1.2/src/include/xian_proto.h File Reference

#include <linux/init.h>
#include <linux/module.h>
#include <linux/time.h>
#include <linux/netdevice.h>
#include <linux/version.h>
#include "itm.h"
#include "errors.h"

Go to the source code of this file.

Data Structures

struct  metric_msg
struct  xian_msg
struct  metric_conf
struct  xian_stat
struct  xian_stats
struct  neighbour_table

Defines

#define XIAN_NANO_PROTOCOL_VERSION   1
#define XIAN_NANO_PROTOCOL   1
#define XIAN_HEADER_SIZE   12
#define METRIC_MSG_LEN   sizeof(struct metric_msg)
#define NB_METRICS   10
#define NB_MAX_INDEX   5
#define ETH_ALEN   6
#define HEADER_SIZE   14
#define HH_DATA_MOD   16
#define LL_RESERVED_SPACE(dev)   (((dev)->hard_header_len&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
#define XIAN_EXPORT_SYMBOL(x)   EXPORT_SYMBOL(x)

Functions

void xian_if_send (char *dev_name, void *daddr, void *saddr, struct qos_metric_proto_msg message)
 This is the function used for sending XIAN message.
void xian_netif_rx (struct sk_buff *skb)
 This function is used to establish a step between the driver and the upper layer during reception.
void kinsert_metric (struct qos_metric_proto_msg *msg, unsigned int type, unsigned int id, unsigned int encoding_type, unsigned char mac[ETH_ALEN], struct xian_float value)
 This function is used to insert a metric (type, id, value) in a XIAN message.
void ksend_metric (char *dev_name, char *macadd, struct qos_metric_proto_msg msg, unsigned int *code_err)
 This function allows the sending of the XIAN message.
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.
void delete_mac_to_broadcast (unsigned char *saddr)
 This function deletes a MAC address in the list of neighbour nodes.
void free_mac_to_broadcast (void)
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.
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.
void unregister_id (unsigned int id, unsigned int metric)
 This function is used to unregister a metric configuration.
void config_relay (void *pf)
 Function call by XIAN Manager to configure the relaying of received XIAN message from the RECEIVE function.
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.
struct xian_float get_xian_stat (unsigned char macadd[IEEE80211_MAC_ADDR_LEN+1], unsigned char dev_name[IFNAMESIZ+1], unsigned int id_conf, unsigned int *code_err)
 This function returns the value of a metric.
void update_xian_stat (unsigned char saddr[IEEE80211_MAC_ADDR_LEN+1], unsigned char dev_name[IFNAMESIZ+1], unsigned int id_conf, struct xian_float value)
 This function updates the value of a metric.
void del_xian_stat (unsigned char dev_name[IFNAMESIZ+1], unsigned int id_conf)
 This function deletes the value of a metric.
struct xian_float xian_float_add (struct xian_float a, struct xian_float b)
 This function returns the addition between a and b.
struct xian_float xian_float_mult (struct xian_float a, struct xian_float b)
 This function returns the multiplication between a and b.
struct xian_float xian_float_div (struct xian_float a, struct xian_float b)
 This function returns the division of a by b.
int xian_float_cmp (struct xian_float a, struct xian_float b)
 This function compare a and b.
struct xian_float int2xian_float (unsigned int x)
 This function converts an int x to a xian_float(x/1).
struct xian_neighbour * xian_get_neighbour (char *a)
void xian_print_neighbour (char *a)
int is_hexa (char c)
 This function allows to check if the param in (a "char" type) belongs to Hexadecimal Basis Set.
int is_mac_addr_valid (char *mac_addr)
 This function allows to check if the mac address param in (array of "char" type) is valid.
void convert_mac_addr (char *mac_addr, unsigned char *res, unsigned int *code_err)
 This function allows to convert a Mac Address formatted as follow XX:XX:XX:XX:XX:XX (array of "char" type) into an array of unsigned char.
unsigned char hex2char (unsigned char input)
 This function allows to convert an unsigned char under hexa format to a normal unsigned char.
void convert_hexamac (unsigned char *saddr, unsigned char *res)
 This function allows to convert an array of unsigned char into a Mac Address formatted as follow XX:XX:XX:XX:XX:XX (array of "char" type).
int strcmp_mac (unsigned char mac[6], unsigned char mac_addr_converted[6])
 This function allows to compare two mac address in hexa mode.


Define Documentation

#define XIAN_NANO_PROTOCOL_VERSION   1

Definition at line 31 of file xian_proto.h.

Referenced by xian_if_send().

#define XIAN_NANO_PROTOCOL   1

Definition at line 32 of file xian_proto.h.

Referenced by xian_if_send().

#define XIAN_HEADER_SIZE   12

Definition at line 33 of file xian_proto.h.

Referenced by xian_if_send().

#define METRIC_MSG_LEN   sizeof(struct metric_msg)

Definition at line 34 of file xian_proto.h.

Referenced by xian_if_send().

#define NB_METRICS   10

Definition at line 35 of file xian_proto.h.

#define NB_MAX_INDEX   5

Definition at line 37 of file xian_proto.h.

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

#define ETH_ALEN   6

Definition at line 39 of file xian_proto.h.

#define HEADER_SIZE   14

Definition at line 40 of file xian_proto.h.

Referenced by xian_if_send().

#define HH_DATA_MOD   16

Definition at line 42 of file xian_proto.h.

#define LL_RESERVED_SPACE ( dev   )     (((dev)->hard_header_len&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)

Definition at line 43 of file xian_proto.h.

Referenced by xian_if_send().

#define XIAN_EXPORT_SYMBOL (  )     EXPORT_SYMBOL(x)

Definition at line 49 of file xian_proto.h.


Function Documentation

void xian_if_send ( char *  dev_name,
void *  daddr,
void *  saddr,
struct qos_metric_proto_msg  message 
)

This is the function used for sending XIAN message.

Warnings the length of the XIAN message must be smaller than the maximum size of data in a frame.

Parameters:
dev_name a pointer to an array of char representing the device name
daddr a pointer to an array of char representing the destination Mac Address formatted as follow XX:XX:XX:XX:XX:XX
saddr a pointer to an array of char representing the source Mac Address formatted as follow XX:XX:XX:XX:XX:XX
message a struct qos_metric_proto_msg
Returns:
-

Definition at line 172 of file xnp.c.

Referenced by ksend_metric().

void xian_netif_rx ( struct sk_buff *  skb  ) 

This function is used to establish a step between the driver and the upper layer during reception.

It Acts like a relay to capture the sk_buff and add treatment if necessary.

Parameters:
skb sk_buff build in driver

Definition at line 100 of file xnp.c.

void kinsert_metric ( struct qos_metric_proto_msg msg,
unsigned int  type,
unsigned int  id,
unsigned int  encoding_type,
unsigned char  mac[ETH_ALEN],
struct xian_float  value 
)

This function is used to insert a metric (type, id, value) in a XIAN message.

Parameters:
msg a pointer to a struct qos_metric_proto_msg
type an unsigned int for the type metric
id an unsigned int for the id of the metric
encoding_type an unsigned int for indicate the encoding of the value
mac a pointer to an array of char representing a Mac Address converted
value an unsigned long long for the value's metric
Returns:
-

Definition at line 233 of file xnp.c.

Referenced by thread_function().

void ksend_metric ( char *  dev_name,
char *  macadd,
struct qos_metric_proto_msg  msg,
unsigned int *  code_err 
)

This function allows the sending of the XIAN message.

Parameters:
dev_name a pointer to an array of char representing a device name
macadd a pointer to an array of char representing a Mac Address formatted as follow XX:XX:XX:XX:XX:XX
msg a struct qos_metric_proto_msg
code_err output a code error if an error occurs (ie invalid Mac Address)
Returns:
-

Definition at line 268 of file xnp.c.

Referenced by thread_function().

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.

Referenced by xian_broadcast_neighbour().

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.

void free_mac_to_broadcast ( void   ) 

Definition at line 113 of file xmm.c.

Referenced by xian_broadcast_neighbour().

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.

Referenced by config(), and register_id_no_report().

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.

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.

Referenced by xian_neighbour_exit().

void config_relay ( void *  pf  ) 

Function call by XIAN Manager to configure the relaying of received XIAN message from the RECEIVE function.

Parameters:
*pf pointer on function

Definition at line 47 of file xnp.c.

Referenced by xian_man_exit(), and xian_man_init().

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.

Referenced by xian_man_init().

struct xian_float get_xian_stat ( unsigned char  macadd[IEEE80211_MAC_ADDR_LEN+1],
unsigned char  dev_name[IFNAMESIZ+1],
unsigned int  id_conf,
unsigned int *  code_err 
) [read]

This function returns the value of a metric.

Parameters:
macadd MAC Address of a specified node formatted as follow XX:XX:XX:XX:XX:XX
dev_name name of the network interface
id_conf unsigned int representing the metric
code_err output a code error if an error occurs.
Returns:
struct xian_float the value of the metric

Definition at line 166 of file xmr.c.

Referenced by get_metric().

void update_xian_stat ( unsigned char  saddr[IEEE80211_MAC_ADDR_LEN+1],
unsigned char  dev_name[IFNAMESIZ+1],
unsigned int  id_conf,
struct xian_float  value 
)

This function updates the value of a metric.

Parameters:
saddr MAC Address of a specified node formatted as follow XX:XX:XX:XX:XX:XX
dev_name name of the network interface
id_conf unsigned int representing the metric
value the value of the metric to record
Returns:
-

Definition at line 207 of file xmr.c.

void del_xian_stat ( unsigned char  dev_name[IFNAMESIZ+1],
unsigned int  id_conf 
)

This function deletes the value of a metric.

Parameters:
dev_name name of the network interface
id_conf unsigned int representing the metric
Returns:
-

Definition at line 279 of file xmr.c.

struct xian_float xian_float_add ( struct xian_float  a,
struct xian_float  b 
) [read]

This function returns the addition between a and b.

Parameters:
a a struct xian_float
b a struct xian_float
Returns:
struct xian_float the result of the addition

Definition at line 101 of file usi.c.

struct xian_float xian_float_mult ( struct xian_float  a,
struct xian_float  b 
) [read]

This function returns the multiplication between a and b.

Parameters:
a a struct xian_float
b a struct xian_float
Returns:
struct xian_float the result of the multiplication

Definition at line 124 of file usi.c.

struct xian_float xian_float_div ( struct xian_float  a,
struct xian_float  b 
) [read]

This function returns the division of a by b.

Parameters:
a a struct xian_float
b a struct xian_float
Returns:
struct xian_float the result of the division

Definition at line 137 of file usi.c.

int xian_float_cmp ( struct xian_float  a,
struct xian_float  b 
)

This function compare a and b.

Parameters:
a a struct xian_float
b a struct xian_float
Returns:
int 1 if a>b, -1 if a<b and 0 if a=b

Definition at line 155 of file usi.c.

struct xian_float int2xian_float ( unsigned int  x  )  [read]

This function converts an int x to a xian_float(x/1).

Parameters:
x an int
Returns:
struct xian_float x/1

Definition at line 175 of file usi.c.

struct xian_neighbour* xian_get_neighbour ( char *  a  )  [read]

void xian_print_neighbour ( char *  a  ) 

int is_hexa ( char  c  ) 

This function allows to check if the param in (a "char" type) belongs to Hexadecimal Basis Set.

Parameters:
c a char type representing an hexa symbol
Returns:
int return 1 if it belongs to, 0 otherwise.

Definition at line 148 of file xian_proto.h.

Referenced by is_mac_addr_valid().

int is_mac_addr_valid ( char *  mac_addr  ) 

This function allows to check if the mac address param in (array of "char" type) is valid.

Parameters:
mac_addr a pointer to an array if char representing a Mac Address formatted as follow XX:XX:XX:XX:XX:XX
Returns:
int return -1 in case of bad mac address length, 1 if it is a valid mac address, 0 otherwise. Called function : is_hexa

Definition at line 182 of file xian_proto.h.

References IEEE80211_MAC_ADDR_LEN, and is_hexa().

Referenced by convert_mac_addr().

void convert_mac_addr ( char *  mac_addr,
unsigned char *  res,
unsigned int *  code_err 
)

This function allows to convert a Mac Address formatted as follow XX:XX:XX:XX:XX:XX (array of "char" type) into an array of unsigned char.

Parameters:
mac_addr a pointer to an array of char representing a Mac Address formatted as follow XX:XX:XX:XX:XX:XX
res output a pointer to an array of unsigned char
code_err output code_err => output a code error if an error occurs (ie invalid Mac Address) Return : - Called function : is_mac_addr_valid

Definition at line 219 of file xian_proto.h.

References IEEE80211_MAC_ADDR_LEN, INVALID_MAC_ADDR, and is_mac_addr_valid().

Referenced by get_metric(), get_xian_stat(), ksend_metric(), thread_function(), update_xian_stat(), and XIAN_Manager_receive().

unsigned char hex2char ( unsigned char  input  ) 

This function allows to convert an unsigned char under hexa format to a normal unsigned char.

Parameters:
input an unsigned char in hexa format
Returns:
char the result of the conversion

Definition at line 245 of file xian_proto.h.

Referenced by convert_hexamac().

void convert_hexamac ( unsigned char *  saddr,
unsigned char *  res 
)

This function allows to convert an array of unsigned char into a Mac Address formatted as follow XX:XX:XX:XX:XX:XX (array of "char" type).

Parameters:
saddr a pointer to an array of unsigned char
res output a pointer to an Array of char representing a Mac Address formatted as follow XX:XX:XX:XX:XX:XX
Returns:
: -

Definition at line 272 of file xian_proto.h.

References ETH_ALEN, and hex2char().

Referenced by XIAN_Manager_receive().

int strcmp_mac ( unsigned char  mac[6],
unsigned char  mac_addr_converted[6] 
)

This function allows to compare two mac address in hexa mode.

Parameters:
mac a pointer to an array of unsigned char
mac_addr_converted a pointer to an array of unsigned char
Returns:
int 1 if mac!=mac_addr_converted and 0 else

Definition at line 293 of file xian_proto.h.

Referenced by get_xian_stat(), and update_xian_stat().


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