#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 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 |
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 |
#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) |
#define XIAN_EXPORT_SYMBOL | ( | x | ) | EXPORT_SYMBOL(x) |
Definition at line 49 of file xian_proto.h.
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.
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 |
Definition at line 172 of file xnp.c.
Referenced by ksend_metric().
void xian_netif_rx | ( | struct sk_buff * | skb | ) |
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.
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 |
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.
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) |
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.
saddr | an array of char representing a Mac Address formatted as follow XX:XX:XX:XX:XX:XX |
Definition at line 74 of file xmm.c.
Referenced by xian_broadcast_neighbour().
void delete_mac_to_broadcast | ( | unsigned char * | saddr | ) |
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.
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 |
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.
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 |
void unregister_id | ( | unsigned int | id, | |
unsigned int | metric | |||
) |
This function is used to unregister a metric configuration.
id | identification of the configuration | |
metric | the metric number |
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.
*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.
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 |
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.
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. |
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.
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 |
void del_xian_stat | ( | unsigned char | dev_name[IFNAMESIZ+1], | |
unsigned int | id_conf | |||
) |
struct xian_float xian_float_add | ( | struct xian_float | a, | |
struct xian_float | b | |||
) | [read] |
This function returns the addition between a and b.
a | a struct xian_float | |
b | a struct xian_float |
struct xian_float xian_float_mult | ( | struct xian_float | a, | |
struct xian_float | b | |||
) | [read] |
This function returns the multiplication between a and b.
a | a struct xian_float | |
b | a struct xian_float |
struct xian_float xian_float_div | ( | struct xian_float | a, | |
struct xian_float | b | |||
) | [read] |
This function returns the division of a by b.
a | a struct xian_float | |
b | a struct xian_float |
int xian_float_cmp | ( | struct xian_float | a, | |
struct xian_float | b | |||
) |
This function compare a and b.
a | a struct xian_float | |
b | a struct xian_float |
struct xian_float int2xian_float | ( | unsigned int | x | ) | [read] |
This function converts an int x to a xian_float(x/1).
x | an int |
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.
c | a char type representing an hexa symbol |
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.
mac_addr | a pointer to an array if char representing a Mac Address formatted as follow XX:XX:XX:XX:XX:XX |
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.
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.
input | an unsigned char in hexa format |
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).
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 |
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.
mac | a pointer to an array of unsigned char | |
mac_addr_converted | a pointer to an array of unsigned char |
Definition at line 293 of file xian_proto.h.
Referenced by get_xian_stat(), and update_xian_stat().