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 }
00066 else if (t->hdr.type==AUTHORIZATION){
00067 tkn_data_ptr+=(sizeof(Token_Hdr)+sizeof(Authorization));
00068 }else if (t->hdr.type==MESSAGE){
00069 tkn_data_ptr+=(sizeof(Token_Hdr)+sizeof(Message)+t->msg.len);
00070 }else {
00071 WMP_MSG(stderr,"Unknown frame type in get_data_pointer, exiting\n");
00072 }
00073 return tkn_data_ptr;
00074 }
00075
00076 char * wmp_get_message_data_pointer(wmpFrame * t) {
00077 char * tkn_data_ptr = (char*) t;
00078 if (t->hdr.type != MESSAGE)
00079 return NULL;
00080 tkn_data_ptr += (sizeof(Token_Hdr) + sizeof(Message));
00081 return tkn_data_ptr;
00082 }
00083
00084 int wmp_get_frame_total_lenght(wmpFrame * t) {
00085 int size = sizeof(Token_Hdr);
00086 if (t->hdr.type == TOKEN) {
00087 size += sizeof(Token) + status.N_NODES * status.N_NODES;
00088 } else if (t->hdr.type == AUTHORIZATION) {
00089 size += sizeof(Authorization);
00090 } else if (t->hdr.type == MESSAGE) {
00091 if (mBitsIsSet(t->msg.type, AURA_MSG)) {
00092 size += sizeof(Message) + t->msg.len;
00093 } else {
00094 size += sizeof(Authorization);
00095 }
00096 } else if (t->hdr.type == DROP_TOKEN) {
00097 size += sizeof(Drop);
00098 }
00099 return size;
00100 }
00101
00102
00103
00104