Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include "core/include/global.h"
00038 #include "core/include/frames.h"
00039 #include "config/compiler.h"
00040
00041 #define TOKEN_ROUTING_INFO_SIZE status.N_NODES*status.N_NODES
00042 #define AUTH_ROUTING_INFO_SIZE 0
00043 #define MSG_ROUTING_INFO_SIZE 0
00044
00045 char * wmp_get_frame_tail_pointer(wmpFrame * t){
00046
00047 char * tkn_data_ptr =(char*)t;
00048 if (t->hdr.type==TOKEN){
00049 tkn_data_ptr+=(sizeof(Token_Hdr)+sizeof(Token)+status.N_NODES*status.N_NODES);
00050 }
00051 else if (t->hdr.type==AUTHORIZATION){
00052 tkn_data_ptr+=(sizeof(Token_Hdr)+sizeof(Authorization));
00053 }else if (t->hdr.type==MESSAGE){
00054 tkn_data_ptr+=(sizeof(Token_Hdr)+sizeof(Message)+t->msg.len);
00055 }else {
00056 WMP_MSG(stderr,"Unknown frame type in get_data_pointer, exiting\n");
00057 }
00058 return tkn_data_ptr;
00059 }
00060
00061 char * wmp_get_frame_routing_pointer(wmpFrame * t){
00062 char * tkn_data_ptr =(char*)t;
00063 if (t->hdr.type==TOKEN){
00064 tkn_data_ptr+=(sizeof(Token_Hdr)+sizeof(Token));
00065 } else if (t->hdr.type==AUTHORIZATION){
00066 tkn_data_ptr+=(sizeof(Token_Hdr)+sizeof(Authorization));
00067 }else if (t->hdr.type==MESSAGE){
00068 tkn_data_ptr+=(sizeof(Token_Hdr)+sizeof(Message));
00069 }else {
00070 WMP_MSG(stderr,"Unknown frame type in get_data_pointer, exiting\n");
00071 }
00072 return tkn_data_ptr;
00073 }
00074
00075 char * wmp_get_frame_routing_pointer_new_tree(wmpFrame * t){
00076 char * tkn_data_ptr =(char*)t;
00077 tkn_data_ptr+=(sizeof(Token_Hdr)+sizeof(Token)+2*status.N_NODES);
00078 return tkn_data_ptr;
00079 }
00080
00081 char * wmp_get_frame_routing_pointer_status(wmpFrame * t){
00082 char * tkn_data_ptr =(char*)t;
00083 tkn_data_ptr+=(sizeof(Token_Hdr)+sizeof(Token)+status.N_NODES);
00084 return tkn_data_ptr;
00085 }
00086
00087 char * wmp_get_message_data_pointer(wmpFrame * t){
00088 char * tkn_data_ptr =(char*)t;
00089 if (t->hdr.type!=MESSAGE) return NULL;
00090 tkn_data_ptr+=(sizeof(Token_Hdr)+sizeof(Message)+status.N_NODES);
00091 return tkn_data_ptr;
00092 }
00093
00094 int wmp_get_frame_total_lenght(wmpFrame * t){
00095 int size=sizeof(Token_Hdr);
00096 if (t->hdr.type==TOKEN){
00097 size+=sizeof(Token) + 3*status.N_NODES;
00098 } else if (t->hdr.type==AUTHORIZATION){
00099 size+=sizeof(Authorization) + status.N_NODES;
00100 } else if (t->hdr.type==MESSAGE){
00101 size+=sizeof(Message) + status.N_NODES + t->msg.len;
00102 } else if (t->hdr.type==DROP_TOKEN){
00103 size+=sizeof(Drop);
00104 } else {
00105 size+=0;
00106 }
00107 #ifdef ENABLE_BC_SUPPORT
00108 if (t->hdr.bc_type!=0){
00109 size+=t->hdr.bc_len;
00110 }
00111 #endif
00112 return size;
00113 }
00114
00115
00116
00117