00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <linux/kernel.h>
00031 #include <linux/module.h>
00032 #include <asm/uaccess.h>
00033 #include <asm/semaphore.h>
00034 #include <linux/version.h>
00035 #include <linux/netdevice.h>
00036
00037
00038 #include "include/itm.h"
00039 #include "include/usi.h"
00040
00041
00042 #include "compat.h"
00043 #include "net80211/if_media.h"
00044 #include "net80211/ieee80211_var.h"
00045
00046 #include "include/xian_proto.h"
00047
00048
00049
00050
00051 int cross_layer_mod_init (void);
00052 void cross_layer_mod_unload (void);
00053 static int cross_layer_device_open (struct inode *, struct file *);
00054 static int cross_layer_device_release (struct inode *, struct file *);
00055 static ssize_t cross_layer_device_read (struct file *, char *, size_t, loff_t *);
00056 static ssize_t cross_layer_device_write (struct file *, const char *, size_t, loff_t *);
00057
00058
00059 static int device_open = 0;
00060 static char cross_layer_kmsg_r[BUF_LEN];
00061 static char * cross_layer_kmsg_ptr_r;
00062 static int cross_layer_kmsg_length_r = 0;
00063
00064 static struct file_operations fops =
00065 {
00066 .read = cross_layer_device_read,
00067 .write = cross_layer_device_write,
00068 .open = cross_layer_device_open,
00069 .release = cross_layer_device_release
00070 };
00071
00072 static wait_queue_head_t waiting_data_ready;
00073 static int data_ready = 0;
00074
00075
00080 int
00081 cross_layer_mod_init(void)
00082 {
00083 if (register_chrdev(CROSS_LAYER_DEV_MAJOR, CROSS_LAYER_DEV_NAME, &fops)) {
00084 printk("Init XIAN ITM module : XIAN ITM device registration failure with major %d\n", CROSS_LAYER_DEV_MAJOR);
00085 return -EIO;
00086 }
00087
00088 init_waitqueue_head(&waiting_data_ready);
00089
00090 printk("Init XIAN ITM module : XIAN ITM device registered!\n");
00091
00092 return 0;
00093 }
00094
00095
00103 static void
00104 send_metric_for_read(char * msg,
00105 int length)
00106 {
00107 int min, i;
00108
00109 if (length <= BUF_LEN)
00110 min = length;
00111 else
00112 min = BUF_LEN;
00113
00114 for (i=0; i < BUF_LEN; i++)
00115 cross_layer_kmsg_r[i] = 0;
00116
00117 for (i=0; i < min; i++)
00118 cross_layer_kmsg_r[i] = msg[i];
00119
00120 cross_layer_kmsg_ptr_r = cross_layer_kmsg_r;
00121 cross_layer_kmsg_length_r = length;
00122
00123 wake_up_all(&waiting_data_ready);
00124
00125 data_ready = 1;
00126
00127 return;
00128 }
00129
00130
00135 void
00136 cross_layer_mod_unload(void)
00137 {
00138 int ret = 0;
00139 ret = unregister_chrdev(CROSS_LAYER_DEV_MAJOR, CROSS_LAYER_DEV_NAME);
00140 if (ret < 0)
00141 printk("Unload XIAN ITM module : Error in unregister_chrdev for device: %d\n", ret);
00142 printk("Unload XIAN ITM module : XIAN ITM device unregistered!\n");
00143 return;
00144 }
00145
00146
00147
00148
00155 static int
00156 cross_layer_device_open(struct inode *inode,
00157 struct file *file)
00158 {
00159
00160 if (device_open)
00161 return -EBUSY;
00162 device_open++;
00163 cross_layer_kmsg_ptr_r = cross_layer_kmsg_r;
00164
00165 _MOD_INC_USE(THIS_MODULE, return 0);
00166 return 0;
00167 }
00168
00169
00176 static int
00177 cross_layer_device_release(struct inode *inode,
00178 struct file *file)
00179 {
00180 device_open--;
00181 _MOD_DEC_USE(THIS_MODULE);
00182 return 0;
00183 }
00184
00185
00195 static ssize_t
00196 cross_layer_device_read(struct file *filp,
00197 char *buffer,
00198 size_t length,
00199 loff_t *offset)
00200 {
00201 int bytes_to_read;
00202 int bytes_read = 0;
00203 wait_event_interruptible (waiting_data_ready, data_ready);
00204 bytes_to_read = cross_layer_kmsg_length_r;
00205
00206 while (length && bytes_to_read)
00207 {
00208 put_user(*(cross_layer_kmsg_ptr_r++), buffer++);
00209 length--;
00210 bytes_read++;
00211 bytes_to_read--;
00212 }
00213 data_ready = 0;
00214 return bytes_read;
00215 }
00216
00217
00218
00219
00220 #define GET_NODE_METRIC(_type, _func) \
00221 msg->type_metric = _type; \
00222 switch (msg->type_metric) \
00223 { \
00224 case INT8: \
00225 msg->metric.int8 = _func(mac_addr_converted, msg->dev_name, &(msg->id_error)); \
00226 break; \
00227 case INT32: \
00228 msg->metric.int32 = _func(mac_addr_converted, msg->dev_name, &(msg->id_error)); \
00229 break; \
00230 case INT64: \
00231 msg->metric.int64 = _func(mac_addr_converted, msg->dev_name, &(msg->id_error)); \
00232 break; \
00233 default : \
00234 { \
00235 msg->id_error = UNKNOW_METRIC; \
00236 printk("Function GET_NODE_METRIC : Unknown Specified Metric.\n"); \
00237 break; \
00238 } \
00239 } \
00240 break; \
00241
00242 #define GET_METRIC(_type, _func) \
00243 msg->type_metric = _type; \
00244 switch (msg->type_metric) \
00245 { \
00246 case INT8: \
00247 msg->metric.int8 = _func(msg->dev_name, &(msg->id_error)); \
00248 break; \
00249 case INT32: \
00250 msg->metric.int32 = _func(msg->dev_name, &(msg->id_error)); \
00251 break; \
00252 case INT64: \
00253 msg->metric.int64 = _func(msg->dev_name, &(msg->id_error)); \
00254 break; \
00255 default : \
00256 { \
00257 msg->id_error = UNKNOW_METRIC; \
00258 printk("Function GET_METRIC : Unknown Specified Metric.\n"); \
00259 break; \
00260 } \
00261 } \
00262 break;
00263
00264
00274 static ssize_t
00275 cross_layer_device_write(struct file *filp,
00276 const char *buff,
00277 size_t len,
00278 loff_t *off)
00279 {
00280 int bytes_written;
00281 struct qos_generic_msg * msg = (struct qos_generic_msg *) buff;
00282 bytes_written = len;
00283 if (msg->type_msg==T_QUERY_MSG)
00284 {
00285 switch (msg->struct_id)
00286 {
00287 case T_QOS_METRIC_NODE_MSG:
00288 {
00289 struct qos_metric_node_msg * msg;
00290 unsigned char mac_addr_converted[6];
00291 msg = (struct qos_metric_node_msg *) buff;
00292 msg->id_error = NO_ERRORS;
00293 convert_mac_addr (msg->macaddr, mac_addr_converted, &(msg->id_error));
00294 if (msg->id_error == NO_ERRORS)
00295
00296 switch (msg->metric_name)
00297 {
00298 case NODE_TXPOWER:
00299 GET_NODE_METRIC(INT8, get_node_txpower);
00300 case NODE_RSSI:
00301 GET_NODE_METRIC(INT8, get_node_rssi);
00302 case NODE_NEGOTIATED_RATE:
00303 GET_NODE_METRIC(INT8, get_node_negotiated_rate);
00304 case NODE_RX_DATA:
00305 GET_NODE_METRIC(INT32, get_node_rx_data);
00306 case NODE_RX_MGMT:
00307 GET_NODE_METRIC(INT32, get_node_rx_mgmt);
00308 case NODE_RX_CTRL:
00309 GET_NODE_METRIC(INT32, get_node_rx_ctrl);
00310 case NODE_RX_UCAST:
00311 GET_NODE_METRIC(INT32, get_node_rx_ucast);
00312 case NODE_RX_MCAST:
00313 GET_NODE_METRIC(INT32, get_node_rx_mcast);
00314 case NODE_RX_BYTES:
00315 GET_NODE_METRIC(INT64, get_node_rx_bytes);
00316 case NODE_RX_BEACONS:
00317 GET_NODE_METRIC(INT64, get_node_rx_beacons);
00318 case NODE_RX_PROBERESP:
00319 GET_NODE_METRIC(INT32, get_node_rx_proberesp);
00320 case NODE_RX_DUP:
00321 GET_NODE_METRIC(INT32, get_node_rx_dup);
00322 case NODE_RX_NOPRIVACY:
00323 GET_NODE_METRIC(INT32, get_node_rx_noprivacy);
00324 case NODE_RX_WEPFAIL:
00325 GET_NODE_METRIC(INT32, get_node_rx_wepfail);
00326 case NODE_RX_DEMICFAIL:
00327 GET_NODE_METRIC(INT32, get_node_rx_demicfail);
00328 case NODE_RX_DECAP:
00329 GET_NODE_METRIC(INT32, get_node_rx_decap);
00330 case NODE_RX_DEFRAG:
00331 GET_NODE_METRIC(INT32, get_node_rx_defrag);
00332 case NODE_RX_DISASSOC:
00333 GET_NODE_METRIC(INT32, get_node_rx_disassoc);
00334 case NODE_RX_DEAUTH:
00335 GET_NODE_METRIC(INT32, get_node_rx_deauth);
00336 case NODE_RX_DECRYPTCRC:
00337 GET_NODE_METRIC(INT32, get_node_rx_decryptcrc);
00338 case NODE_RX_UNAUTH:
00339 GET_NODE_METRIC(INT32, get_node_rx_unauth);
00340 case NODE_RX_UNENCRYPTED:
00341 GET_NODE_METRIC(INT32, get_node_rx_unencrypted);
00342 case NODE_TX_DATA:
00343 GET_NODE_METRIC(INT32, get_node_tx_data);
00344 case NODE_TX_MGMT:
00345 GET_NODE_METRIC(INT32, get_node_tx_mgmt);
00346 case NODE_TX_UCAST:
00347 GET_NODE_METRIC(INT32,get_node_tx_ucast);
00348 case NODE_TX_MCAST:
00349 GET_NODE_METRIC(INT32, get_node_tx_mcast);
00350 case NODE_TX_BYTES:
00351 GET_NODE_METRIC(INT64, get_node_tx_bytes);
00352 case NODE_TX_PROBEREQ:
00353 GET_NODE_METRIC(INT32, get_node_tx_probereq);
00354 case NODE_TX_NOVLANTAG:
00355 GET_NODE_METRIC(INT32, get_node_tx_novlantag);
00356 case NODE_TX_VLANMISMATCH:
00357 GET_NODE_METRIC(INT32, get_node_tx_vlanmismatch);
00358 case NODE_PS_DISCARD:
00359 GET_NODE_METRIC(INT32, get_node_ps_discard);
00360 case NODE_TX_ASSOC:
00361 GET_NODE_METRIC(INT32, get_node_tx_assoc);
00362 case NODE_TX_ASSOC_FAIL:
00363 GET_NODE_METRIC(INT32, get_node_tx_assoc_fail);
00364 case NODE_TX_AUTH:
00365 GET_NODE_METRIC(INT32, get_node_tx_auth);
00366 case NODE_TX_AUTH_FAIL:
00367 GET_NODE_METRIC(INT32, get_node_tx_auth_fail);
00368 case NODE_TX_DEAUTH:
00369 GET_NODE_METRIC(INT32, get_node_tx_deauth);
00370 case NODE_TX_DEAUTH_CODE:
00371 GET_NODE_METRIC(INT32, get_node_tx_deauth_code);
00372 case NODE_TX_DISASSOC:
00373 GET_NODE_METRIC(INT32, get_node_tx_disassoc);
00374 case NODE_TX_DISASSOC_CODE:
00375 GET_NODE_METRIC(INT32, get_node_tx_disassoc_code);
00376 case NODE_ON_TX_ERR:
00377 GET_NODE_METRIC(INT32, get_node_on_tx_err);
00378 case NODE_ON_TX_OK:
00379 GET_NODE_METRIC(INT32, get_node_on_tx_ok);
00380 case NODE_ON_TX_RETR:
00381 GET_NODE_METRIC(INT32, get_node_on_tx_retr);
00382 default :
00383 {
00384 msg->id_error = UNKNOW_METRIC;
00385 printk("Unknown Specified Metric.\n");
00386 break;
00387 }
00388 }
00389 break;
00390 }
00391 case T_QOS_METRIC_ATH_MSG :
00392 {
00393 struct qos_metric_ath_msg * msg;
00394 msg = (struct qos_metric_ath_msg *) buff;
00395 msg->id_error = NO_ERRORS;
00396
00397
00398 switch (msg->metric_name)
00399 {
00400 case AST_WATCHDOG:
00401 GET_METRIC(INT32, get_ast_watchdog);
00402 case AST_HARDWARE:
00403 GET_METRIC(INT32, get_ast_hardware);
00404 case AST_BMISS:
00405 GET_METRIC(INT32,get_ast_bmiss);
00406 case AST_BSTUCK:
00407 GET_METRIC(INT32, get_ast_bstuck);
00408 case AST_RXORN:
00409 GET_METRIC(INT32, get_ast_rxorn);
00410 case AST_RXEOL:
00411 GET_METRIC(INT32, get_ast_rxeol);
00412 case AST_TXURN:
00413 GET_METRIC(INT32, get_ast_txurn);
00414 case AST_MIB:
00415 GET_METRIC(INT32, get_ast_mib);
00416 case AST_INTRCOAL:
00417 GET_METRIC(INT32, get_ast_intrcoal);
00418 case AST_TX_PACKETS:
00419 GET_METRIC(INT32, get_ast_tx_packets);
00420 case AST_TX_MGMT:
00421 GET_METRIC(INT32, get_ast_tx_mgmt);
00422 case AST_TX_DISCARD:
00423 GET_METRIC(INT32, get_ast_tx_discard);
00424 case AST_TX_INVALID:
00425 GET_METRIC(INT32, get_ast_tx_invalid);
00426 case AST_TX_QSTOP:
00427 GET_METRIC(INT32, get_ast_tx_qstop);
00428 case AST_TX_ENCAP:
00429 GET_METRIC(INT32, get_ast_tx_encap);
00430 case AST_TX_NONODE:
00431 GET_METRIC(INT32, get_ast_tx_nonode);
00432 case AST_TX_NOBUF:
00433 GET_METRIC(INT32, get_ast_tx_nobuf);
00434 case AST_TX_NOBUFMGT:
00435 GET_METRIC(INT32 ,get_ast_tx_nobufmgt);
00436 case AST_TX_LINEAR:
00437 GET_METRIC(INT32 ,get_ast_tx_linear);
00438 case AST_TX_NODATA:
00439 GET_METRIC(INT32 ,get_ast_tx_nodata);
00440 case AST_TX_BUSDMA:
00441 GET_METRIC(INT32 ,get_ast_tx_busdma);
00442 case AST_TX_XRETRIES:
00443 GET_METRIC(INT32 ,get_ast_tx_xretries);
00444 case AST_TX_FIFOERR:
00445 GET_METRIC(INT32 ,get_ast_tx_fifoerr);
00446 case AST_TX_FILTERED:
00447 GET_METRIC(INT32 ,get_ast_tx_filtered);
00448 case AST_TX_SHORTRETRY:
00449 GET_METRIC(INT32 ,get_ast_tx_shortretry);
00450 case AST_TX_LONGRETRY:
00451 GET_METRIC(INT32 ,get_ast_tx_longretry);
00452 case AST_TX_BADRATE:
00453 GET_METRIC(INT32 ,get_ast_tx_badrate);
00454 case AST_TX_NOACK:
00455 GET_METRIC(INT32 ,get_ast_tx_noack);
00456 case AST_TX_RTS:
00457 GET_METRIC(INT32 ,get_ast_tx_rts);
00458 case AST_TX_CTS:
00459 GET_METRIC(INT32 ,get_ast_tx_cts);
00460 case AST_TX_SHORTPRE:
00461 GET_METRIC(INT32 ,get_ast_tx_shortpre);
00462 case AST_TX_ALTRATE:
00463 GET_METRIC(INT32 ,get_ast_tx_altrate);
00464 case AST_TX_PROTECT:
00465 GET_METRIC(INT32 ,get_ast_tx_protect);
00466 case AST_TX_CTSBURST:
00467 GET_METRIC(INT32 ,get_ast_tx_ctsburst);
00468 case AST_TX_CTSEXT:
00469 GET_METRIC(INT32 ,get_ast_tx_ctsext);
00470 case AST_RX_NOBUF:
00471 GET_METRIC(INT32 ,get_ast_rx_nobuf);
00472 case AST_RX_BUSDMA:
00473 GET_METRIC(INT32 ,get_ast_rx_busdma);
00474 case AST_RX_ORN:
00475 GET_METRIC(INT32 ,get_ast_rx_orn);
00476 case AST_RX_CRCERR:
00477 GET_METRIC(INT32 ,get_ast_rx_crcerr);
00478 case AST_RX_FIFOERR:
00479 GET_METRIC(INT32 ,get_ast_rx_fifoerr);
00480 case AST_RX_BADCRYPT:
00481 GET_METRIC(INT32 ,get_ast_rx_badcrypt);
00482 case AST_RX_BADMIC:
00483 GET_METRIC(INT32 ,get_ast_rx_badmic);
00484 case AST_RX_PHYERR:
00485 GET_METRIC(INT32 ,get_ast_rx_phyerr);
00486 case AST_RX_TOOSHORT:
00487 GET_METRIC(INT32 ,get_ast_rx_tooshort);
00488 case AST_RX_TOOBIG:
00489 GET_METRIC(INT32 ,get_ast_rx_toobig);
00490 case AST_RX_PACKETS:
00491 GET_METRIC(INT32 ,get_ast_rx_packets);
00492 case AST_RX_MGT:
00493 GET_METRIC(INT32 ,get_ast_rx_mgt);
00494 case AST_RX_CTL:
00495 GET_METRIC(INT32 ,get_ast_rx_ctl);
00496 case AST_TX_RSSI:
00497 GET_METRIC(INT8, get_ast_tx_rssi);
00498 case AST_RX_RSSI:
00499 GET_METRIC(INT8, get_ast_rx_rssi);
00500 case AST_BE_XMIT:
00501 GET_METRIC(INT32 ,get_ast_be_xmit);
00502 case AST_BE_NOBUF:
00503 GET_METRIC(INT32 ,get_ast_be_nobuf);
00504 case AST_PER_CAL:
00505 GET_METRIC(INT32 ,get_ast_per_cal);
00506 case AST_PER_CALFAIL:
00507 GET_METRIC(INT32 ,get_ast_per_calfail);
00508 case AST_PER_RFGAIN:
00509 GET_METRIC(INT32 ,get_ast_per_rfgain);
00510 case AST_RATE_CALLS:
00511 GET_METRIC(INT32 ,get_ast_rate_calls);
00512 case AST_RATE_RAISE:
00513 GET_METRIC(INT32 ,get_ast_rate_raise);
00514 case AST_RATE_DROP:
00515 GET_METRIC(INT32 ,get_ast_rate_drop);
00516 case AST_ANT_DEFSWITCH:
00517 GET_METRIC(INT32 ,get_ast_ant_defswitch);
00518 case AST_ANT_TXSWITCH:
00519 GET_METRIC(INT32 ,get_ast_ant_txswitch);
00520 default :
00521 {
00522 msg->id_error = UNKNOW_METRIC;
00523 printk("Unknown Specified Metric.\n");
00524 break;
00525 }
00526 }
00527 break;
00528 }
00529 case T_QOS_METRIC_NET80211_MSG :
00530 {
00531 struct qos_metric_net80211_msg * msg;
00532 msg = (struct qos_metric_net80211_msg *) buff;
00533 msg->id_error = NO_ERRORS;
00534
00535 switch (msg->metric_name)
00536 {
00537 case IS_RX_BADVERSION:
00538 GET_METRIC(INT32, get_is_rx_badversion);
00539 case IS_RX_TOOSHORT:
00540 GET_METRIC(INT32 ,get_is_rx_tooshort);
00541 case IS_RX_WRONGBSS:
00542 GET_METRIC(INT32 ,get_is_rx_wrongbss);
00543 case IS_RX_DUP:
00544 GET_METRIC(INT32 ,get_is_rx_dup);
00545 case IS_RX_WRONGDIR:
00546 GET_METRIC(INT32 ,get_is_rx_wrongdir);
00547 case IS_RX_MCASTECHO:
00548 GET_METRIC(INT32 ,get_is_rx_mcastecho);
00549 case IS_RX_NOTASSOC:
00550 GET_METRIC(INT32 ,get_is_rx_notassoc);
00551 case IS_RX_NOPRIVACY:
00552 GET_METRIC(INT32 ,get_is_rx_noprivacy);
00553 case IS_RX_UNENCRYPTED:
00554 GET_METRIC(INT32 ,get_is_rx_unencrypted);
00555 case IS_RX_WEPFAIL:
00556 GET_METRIC(INT32 ,get_is_rx_wepfail);
00557 case IS_RX_DECAP:
00558 GET_METRIC(INT32 ,get_is_rx_decap);
00559 case IS_RX_MGTDISCARD:
00560 GET_METRIC(INT32 ,get_is_rx_mgtdiscard);
00561 case IS_RX_CTL:
00562 GET_METRIC(INT32 ,get_is_rx_ctl);
00563 case IS_RX_BEACON:
00564 GET_METRIC(INT32 ,get_is_rx_beacon);
00565 case IS_RX_RSTOOBIG:
00566 GET_METRIC(INT32 ,get_is_rx_rstoobig);
00567 case IS_RX_ELEM_MISSING:
00568 GET_METRIC(INT32 ,get_is_rx_elem_missing);
00569 case IS_RX_ELEM_TOOBIG:
00570 GET_METRIC(INT32 ,get_is_rx_elem_toobig);
00571 case IS_RX_ELEM_TOOSMALL:
00572 GET_METRIC(INT32 ,get_is_rx_elem_toosmall);
00573 case IS_RX_ELEM_UNKNOWN:
00574 GET_METRIC(INT32 ,get_is_rx_elem_unknown);
00575 case IS_RX_BADCHAN:
00576 GET_METRIC(INT32 ,get_is_rx_badchan);
00577 case IS_RX_CHANMISMATCH:
00578 GET_METRIC(INT32 ,get_is_rx_chanmismatch);
00579 case IS_RX_NODEALLOC:
00580 GET_METRIC(INT32 ,get_is_rx_nodealloc);
00581 case IS_RX_SSIDMISMATCH:
00582 GET_METRIC(INT32, get_is_rx_ssidmismatch);
00583 case IS_RX_AUTH_UNSUPPORTED:
00584 GET_METRIC(INT32 ,get_is_rx_auth_unsupported);
00585 case IS_RX_AUTH_FAIL:
00586 GET_METRIC(INT32 ,get_is_rx_auth_fail);
00587 case IS_RX_AUTH_COUNTERMEASURES:
00588 GET_METRIC(INT32 ,get_is_rx_auth_countermeasures);
00589 case IS_RX_ASSOC_BSS:
00590 GET_METRIC(INT32 ,get_is_rx_assoc_bss);
00591 case IS_RX_ASSOC_NOTAUTH:
00592 GET_METRIC(INT32 ,get_is_rx_assoc_notauth);
00593 case IS_RX_ASSOC_CAPMISMATCH:
00594 GET_METRIC(INT32 ,get_is_rx_assoc_capmismatch);
00595 case IS_RX_ASSOC_NORATE:
00596 GET_METRIC(INT32 ,get_is_rx_assoc_norate);
00597 case IS_RX_ASSOC_BADWPAIE:
00598 GET_METRIC(INT32 ,get_is_rx_assoc_badwpaie);
00599 case IS_RX_DEAUTH:
00600 GET_METRIC(INT32 ,get_is_rx_deauth);
00601 case IS_RX_DISASSOC:
00602 GET_METRIC(INT32 ,get_is_rx_disassoc);
00603 case IS_RX_BADSUBTYPE:
00604 GET_METRIC(INT32 ,get_is_rx_badsubtype);
00605 case IS_RX_NOBUF:
00606 GET_METRIC(INT32 ,get_is_rx_nobuf)
00607 case IS_RX_DECRYPTCRC:
00608 GET_METRIC(INT32 ,get_is_rx_decryptcrc)
00609 case IS_RX_AHDEMO_MGT:
00610 GET_METRIC(INT32 ,get_is_rx_ahdemo_mgt)
00611 case IS_RX_BAD_AUTH:
00612 GET_METRIC(INT32 ,get_is_rx_bad_auth)
00613 case IS_RX_UNAUTH:
00614 GET_METRIC(INT32 ,get_is_rx_unauth)
00615 case IS_RX_BADKEYID:
00616 GET_METRIC(INT32 ,get_is_rx_badkeyid)
00617 case IS_RX_CCMPREPLAY:
00618 GET_METRIC(INT32 ,get_is_rx_ccmpreplay)
00619 case IS_RX_CCMPFORMAT:
00620 GET_METRIC(INT32 ,get_is_rx_ccmpformat)
00621 case IS_RX_CCMPMIC:
00622 GET_METRIC(INT32 ,get_is_rx_ccmpmic)
00623 case IS_RX_TKIPREPLAY:
00624 GET_METRIC(INT32 ,get_is_rx_tkipreplay)
00625 case IS_RX_TKIPFORMAT:
00626 GET_METRIC(INT32 ,get_is_rx_tkipformat)
00627 case IS_RX_TKIPMIC:
00628 GET_METRIC(INT32 ,get_is_rx_tkipmic)
00629 case IS_RX_TKIPICV:
00630 GET_METRIC(INT32 ,get_is_rx_tkipicv)
00631 case IS_RX_BADCIPHER:
00632 GET_METRIC(INT32 ,get_is_rx_badcipher)
00633 case IS_RX_NOCIPHERCTX:
00634 GET_METRIC(INT32 ,get_is_rx_nocipherctx)
00635 case IS_RX_ACL:
00636 GET_METRIC(INT32 ,get_is_rx_acl)
00637 case IS_TX_NOBUF:
00638 GET_METRIC(INT32 ,get_is_tx_nobuf)
00639 case IS_TX_NONODE:
00640 GET_METRIC(INT32 ,get_is_tx_nonode)
00641 case IS_TX_UNKNOWNMGT:
00642 GET_METRIC(INT32 ,get_is_tx_unknownmgt)
00643 case IS_TX_BADCIPHER:
00644 GET_METRIC(INT32 ,get_is_tx_badcipher)
00645 case IS_TX_NODEFKEY:
00646 GET_METRIC(INT32 ,get_is_tx_nodefkey)
00647 case IS_TX_NOHEADROOM:
00648 GET_METRIC(INT32 ,get_is_tx_noheadroom)
00649 case IS_SCAN_ACTIVE:
00650 GET_METRIC(INT32 ,get_is_scan_active)
00651 case IS_SCAN_PASSIVE:
00652 GET_METRIC(INT32 ,get_is_scan_passive)
00653 case IS_NODE_TIMEOUT:
00654 GET_METRIC(INT32 ,get_is_node_timeout)
00655 case IS_CRYPTO_NOMEM:
00656 GET_METRIC(INT32 ,get_is_crypto_nomem)
00657 case IS_CRYPTO_TKIP:
00658 GET_METRIC(INT32 ,get_is_crypto_tkip)
00659 case IS_CRYPTO_TKIPENMIC:
00660 GET_METRIC(INT32 ,get_is_crypto_tkipenmic)
00661 case IS_CRYPTO_TKIPDEMIC:
00662 GET_METRIC(INT32 ,get_is_crypto_tkipdemic)
00663 case IS_CRYPTO_TKIPCM:
00664 GET_METRIC(INT32 ,get_is_crypto_tkipcm)
00665 case IS_CRYPTO_CCMP:
00666 GET_METRIC(INT32 ,get_is_crypto_ccmp)
00667 case IS_CRYPTO_WEP:
00668 GET_METRIC(INT32 ,get_is_crypto_wep)
00669 case IS_CRYPTO_SETKEY_CIPHER:
00670 GET_METRIC(INT32 ,get_is_crypto_setkey_cipher)
00671 case IS_CRYPTO_SETKEY_NOKEY:
00672 GET_METRIC(INT32 ,get_is_crypto_setkey_nokey)
00673 case IS_CRYPTO_DELKEY:
00674 GET_METRIC(INT32 ,get_is_crypto_delkey)
00675 case IS_CRYPTO_BADCIPHER:
00676 GET_METRIC(INT32 ,get_is_crypto_badcipher)
00677 case IS_CRYPTO_NOCIPHER:
00678 GET_METRIC(INT32 ,get_is_crypto_nocipher)
00679 case IS_CRYPTO_ATTACHFAIL:
00680 GET_METRIC(INT32 ,get_is_crypto_attachfail)
00681 case IS_CRYPTO_SWFALLBACK:
00682 GET_METRIC(INT32 ,get_is_crypto_swfallback)
00683 case IS_CRYPTO_KEYFAIL:
00684 GET_METRIC(INT32 ,get_is_crypto_keyfail)
00685 case IS_CRYPTO_ENMICFAIL:
00686 GET_METRIC(INT32 ,get_is_crypto_enmicfail)
00687 case IS_IBSS_CAPMISMATCH:
00688 GET_METRIC(INT32 ,get_is_ibss_capmismatch)
00689 case IS_IBSS_NORATE:
00690 GET_METRIC(INT32 ,get_is_ibss_norate)
00691 case IS_PS_UNASSOC:
00692 GET_METRIC(INT32 ,get_is_ps_unassoc)
00693 case IS_PS_BADAID:
00694 GET_METRIC(INT32 ,get_is_ps_badaid)
00695 case IS_PS_QEMPTY:
00696 GET_METRIC(INT32 ,get_is_ps_qempty)
00697 default :
00698 {
00699 msg->id_error = UNKNOW_METRIC;
00700 printk("Unknown Specified Metric.\n");
00701 break;
00702 }
00703 }
00704 break;
00705 }
00706 case T_QOS_METRIC_STAT_MSG :
00707 {
00708 struct qos_metric_stat_msg * msg;
00709 struct xian_float value;
00710 msg = (struct qos_metric_stat_msg *) buff;
00711 msg->id_error = NO_ERRORS;
00712
00713 value = get_xian_stat(msg->macaddr, msg->dev_name, msg->id, &(msg->id_error));
00714
00715 printk("[ITM] id_conf=%d\n",msg->id);
00716 msg->metric.xian_float = value;
00717 break;
00718 }
00719 default :
00720 {
00721 msg->id_error = UNKNOW_QUERY;
00722 printk("Unknown Received Query!!!\n");
00723 break;
00724 }
00725 }
00726 if (msg->id_error == NO_ERRORS)
00727 msg->type_msg = T_RESPONSE_MSG;
00728 else
00729 msg->type_msg = T_ERROR_MSG;
00730 send_metric_for_read((char *) msg,sizeof(msg));
00731 return bytes_written;
00732 }
00733 if (msg->type_msg==T_SEND_MSG)
00734 {
00735 switch (msg->struct_id)
00736 {
00737 case T_QOS_METRIC_PROTO_MSG:
00738 {
00739 struct qos_metric_proto_msg *msg;
00740 struct qos_metric_proto_msg msg2;
00741 unsigned char mac_addr_converted[6];
00742 int i;
00743 msg = (struct qos_metric_proto_msg *) buff;
00744 msg->id_error = NO_ERRORS;
00745
00746 convert_mac_addr(msg->macaddr, mac_addr_converted, &(msg->id_error));
00747 if (msg->id_error == NO_ERRORS){
00748 strcpy(msg2.dev_name,msg->dev_name);
00749 msg2.nb=msg->nb;
00750 for(i=0; i<NB_METRICS; i++){
00751 msg2.metric_name[i]=msg->metric_name[i];
00752 msg2.id[i]=msg->id[i];
00753 msg2.metric[i].int64=msg->metric[i].int64;
00754 }
00755 xian_if_send(msg2.dev_name, mac_addr_converted, NULL, msg2);
00756 }
00757 break;
00758 }
00759 default:
00760 {
00761 msg->id_error = UNKNOW_QUERY;
00762 printk("Unknown Received Query!!!\n");
00763 break;
00764 }
00765 }
00766 return bytes_written;
00767 }
00768 msg->id_error = NOT_A_QUERY_MSG;
00769 msg->type_msg = T_ERROR_MSG;
00770 send_metric_for_read((char *) msg,sizeof(msg));
00771 return bytes_written;
00772
00773 #undef GET_NODE_METRIC
00774 #undef GET_METRIC
00775
00776 }
00777
00778 module_init (cross_layer_mod_init);
00779 module_exit (cross_layer_mod_unload);
00780
00781 MODULE_DESCRIPTION("XIAN - Information Transport Module - ITM");
00782 MODULE_LICENSE("GPL");