00001 /*------------------------------------------------------------------------ 00002 *--------------------- RT-WMP -------------------- 00003 *------------------------------------------------------------------------ 00004 * V7.0B 11/05/10 00005 * 00006 * 00007 * File: ./src/core/include/frames.h 00008 * Authors: Danilo Tardioli 00009 * ---------------------------------------------------------------------- 00010 * Copyright (C) 2000-2010, Universidad de Zaragoza, SPAIN 00011 * 00012 * Contact Addresses: Danilo Tardioli dantard@unizar.es 00013 * 00014 * RT-WMP is free software; you can redistribute it and/or modify it 00015 * under the terms of the GNU General Public License as published by the 00016 * Free Software Foundation; either version 2, or (at your option) any 00017 * later version. 00018 * 00019 * RT-WMP is distributed in the hope that it will be useful, but 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00022 * General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU General Public License 00025 * distributed with RT-WMP; see file COPYING. If not, write to the 00026 * Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 00027 * 02111-1307, USA. 00028 * 00029 * As a special exception, if you link this unit with other files to 00030 * produce an executable, this unit does not by itself cause the 00031 * resulting executable to be covered by the GNU General Public License. 00032 * This exception does not however invalidate any other reasons why the 00033 * executable file might be covered by the GNU Public License. 00034 * 00035 *----------------------------------------------------------------------*/ 00036 00037 #include <linux/types.h> 00038 #include <asm/types.h> 00039 00040 #ifndef FRAMES_H_ 00041 #define FRAMES_H_ 00042 /* STATES TYPES */ 00043 #define FRESH_TOKEN 1 00044 #define TOKEN 2 00045 #define AUTHORIZATION 3 00046 #define MESSAGE 4 00047 #define DROP_TOKEN 5 00048 #define ACK 6 00049 00050 #define BURST 1 00051 #define RESCHEDULED 2 00052 #define AURA_MSG 4 00053 00054 typedef struct { 00055 __s8 rssi; 00056 __s8 noise; 00057 __u32 serial; 00058 __u8 net_id; 00059 __s8 type; 00060 __s8 from; 00061 __s8 to; 00062 __s8 retries; 00063 __u32 ack; 00064 __u16 loop_id; 00065 __u16 burst; 00066 __s32 sleep; 00067 __u8 waiting; 00068 __u32 fc; 00069 } __attribute__ ((__packed__)) Token_Hdr; 00070 00071 typedef struct { 00072 __u8 beginner; 00073 __s8 maxPri; 00074 __s8 idMaxPri; 00075 __u32 age; 00076 __u16 ack_hash; 00077 __s16 ack_part; 00078 } __attribute__ ((__packed__)) Token; 00079 00080 typedef struct { 00081 __u8 type; 00082 __u8 src; 00083 __u32 dest; 00084 __u32 reached; 00085 __u32 age; 00086 __u16 msg_hash; 00087 __u16 msg_part_size; 00088 __s16 part_id; 00089 __u16 len; 00090 __u8 port; 00091 __s8 priority; 00092 } __attribute__ ((__packed__)) Message; 00093 00094 typedef struct { 00095 __u8 type; 00096 __u8 src; 00097 __u32 dest; 00098 __u32 reached; 00099 __u32 age; 00100 __u16 ack_hash; 00101 __s16 ack_part; 00102 } __attribute__ ((__packed__)) Authorization; 00103 00104 typedef struct { 00105 __u32 drop_serial; 00106 } __attribute__ ((__packed__)) Drop; 00107 00108 typedef struct { 00109 __u16 ack_hash; 00110 __s16 ack_part; 00111 } __attribute__ ((__packed__)) Ack; 00112 00113 typedef struct { 00114 Token_Hdr hdr; 00115 union { 00116 Token tkn; 00117 Message msg; 00118 Authorization aut; 00119 Drop drop; 00120 Ack ack; 00121 }; 00122 } __attribute__ ((__packed__)) wmpFrame; 00123 00124 char * wmp_get_frame_tail_pointer(wmpFrame * t); 00125 char * wmp_get_frame_routing_pointer(wmpFrame * t); 00126 char * wmp_get_message_data_pointer(wmpFrame * t); 00127 int wmp_get_frame_total_lenght(wmpFrame * t); 00128 char * wmp_get_frame_routing_pointer_new_tree(wmpFrame * t); 00129 char * wmp_get_frame_routing_pointer_status(wmpFrame * t); 00130 #endif /*FRAMES_H_*/ 00131