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 "wmp_config.h" 00038 00039 #ifndef FRAMES_H_ 00040 #define FRAMES_H_ 00041 /* STATES TYPES */ 00042 #define FRESH_TOKEN 1 00043 #define TOKEN 2 00044 #define AUTHORIZATION 3 00045 #define MESSAGE 4 00046 #define DROP_TOKEN 5 00047 #define ACK 6 00048 00049 #define BURST 1 00050 #define RESCHEDULED 2 00051 #define AURA_MSG 4 00052 00053 typedef struct { 00054 char rssi; 00055 char noise; 00056 unsigned long serial; 00057 unsigned char net_id; 00058 char type; 00059 signed char from; 00060 signed char to; 00061 char retries; 00062 unsigned int ack; 00063 unsigned short loop_id; 00064 unsigned short burst; 00065 int sleep; 00066 unsigned char waiting; 00067 unsigned int fc; 00068 } __attribute__ ((__packed__)) Token_Hdr; 00069 00070 typedef struct { 00071 unsigned char beginner; 00072 signed char maxPri; 00073 signed char idMaxPri; 00074 unsigned int age; 00075 unsigned short ack_hash; 00076 short ack_part; 00077 } __attribute__ ((__packed__)) Token; 00078 00079 typedef struct { 00080 unsigned char type; 00081 unsigned char src; 00082 unsigned int dest; 00083 unsigned int reached; 00084 unsigned int age; 00085 unsigned short msg_hash; 00086 unsigned short msg_part_size; 00087 short part_id; 00088 unsigned short len; 00089 unsigned char port; 00090 signed char priority; 00091 } __attribute__ ((__packed__)) Message; 00092 00093 typedef struct { 00094 unsigned char type; 00095 unsigned char src; 00096 unsigned int dest; 00097 unsigned int reached; 00098 unsigned int age; 00099 unsigned short ack_hash; 00100 short ack_part; 00101 } __attribute__ ((__packed__)) Authorization; 00102 00103 typedef struct { 00104 unsigned long drop_serial; 00105 } __attribute__ ((__packed__)) Drop; 00106 00107 typedef struct { 00108 unsigned short ack_hash; 00109 short ack_part; 00110 } __attribute__ ((__packed__)) Ack; 00111 00112 typedef struct { 00113 Token_Hdr hdr; 00114 union { 00115 Token tkn; 00116 Message msg; 00117 Authorization aut; 00118 Drop drop; 00119 Ack ack; 00120 }; 00121 } __attribute__ ((__packed__)) wmpFrame; 00122 00123 char * wmp_get_frame_tail_pointer(wmpFrame * t); 00124 char * wmp_get_frame_routing_pointer(wmpFrame * t); 00125 char * wmp_get_message_data_pointer(wmpFrame * t); 00126 int wmp_get_frame_total_lenght(wmpFrame * t); 00127 char * wmp_get_frame_routing_pointer_new_tree(wmpFrame * t); 00128 char * wmp_get_frame_routing_pointer_status(wmpFrame * t); 00129 #endif /*FRAMES_H_*/ 00130