00001 // Copyright (c) 2000 by the University of Southern California 00002 // All rights reserved. 00003 // 00004 // Permission to use, copy, modify, and distribute this software and its 00005 // documentation in source and binary forms for non-commercial purposes 00006 // and without fee is hereby granted, provided that the above copyright 00007 // notice appear in all copies and that both the copyright notice and 00008 // this permission notice appear in supporting documentation. and that 00009 // any documentation, advertising materials, and other materials related 00010 // to such distribution and use acknowledge that the software was 00011 // developed by the University of Southern California, Information 00012 // Sciences Institute. The name of the University may not be used to 00013 // endorse or promote products derived from this software without 00014 // specific prior written permission. 00015 // 00016 // THE UNIVERSITY OF SOUTHERN CALIFORNIA makes no representations about 00017 // the suitability of this software for any purpose. THIS SOFTWARE IS 00018 // PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, 00019 // INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 00020 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00021 // 00022 // Other copyrights might apply to parts of this software and are so 00023 // noted when applicable. 00024 // 00025 // Copyright (C) 1998 by Mingzhou Sun. All rights reserved. 00026 // This software is developed at Rensselaer Polytechnic Institute under 00027 // DARPA grant No. F30602-97-C-0274 00028 // Redistribution and use in source and binary forms are permitted 00029 // provided that the above copyright notice and this paragraph are 00030 // duplicated in all such forms and that any documentation, advertising 00031 // materials, and other materials related to such distribution and use 00032 // acknowledge that the software was developed by Mingzhou Sun at the 00033 // Rensselaer Polytechnic Institute. The name of the University may not 00034 // be used to endorse or promote products derived from this software 00035 // without specific prior written permission. 00036 // 00037 // $Header: /nfs/jade/vint/CVSROOT/ns-2/diffusion/diff_header.h,v 1.3 2001/11/08 18:16:32 haldar Exp $ 00038 00039 /******************************************************/ 00040 /* diff_header.h : Chalermek Intanagonwiwat 08/16/99 */ 00041 /******************************************************/ 00042 00043 #ifndef ns_diff_header_h 00044 #define ns_diff_header_h 00045 00046 #include "ip.h" 00047 00048 #define INTEREST 1 00049 #define DATA 2 00050 #define DATA_READY 3 00051 #define DATA_REQUEST 4 00052 #define POS_REINFORCE 5 00053 #define NEG_REINFORCE 6 00054 #define INHIBIT 7 00055 #define TX_FAILED 8 00056 #define DATA_STOP 9 00057 00058 #define MAX_ATTRIBUTE 3 00059 #define MAX_NEIGHBORS 30 00060 #define MAX_DATA_TYPE 30 00061 00062 #define ROUTING_PORT 255 00063 00064 #define ORIGINAL 100 00065 #define SUB_SAMPLED 1 00066 00067 // For positive reinforcement in simple mode. 00068 // And for TX_FAILED of backtracking mode. 00069 00070 struct extra_info { 00071 ns_addr_t sender; // For POS_REINFORCE and TX_FAILED 00072 unsigned int seq; // FOR POS_REINFORCE and TX_FAILED 00073 int size; // For TX_FAILED only. 00074 }; 00075 00076 00077 struct hdr_cdiff { 00078 unsigned char mess_type; 00079 unsigned int pk_num; 00080 ns_addr_t sender_id; 00081 nsaddr_t next_nodes[MAX_NEIGHBORS]; 00082 int num_next; 00083 unsigned int data_type; 00084 ns_addr_t forward_agent_id; 00085 00086 struct extra_info info; 00087 00088 double ts_; // Timestamp when pkt is generated. 00089 int report_rate; // For simple diffusion only. 00090 int attr[MAX_ATTRIBUTE]; 00091 00092 static int offset_; 00093 inline static int& offset() { return offset_; } 00094 inline static hdr_cdiff* access(const Packet* p) { 00095 return (hdr_cdiff*) p->access(offset_); 00096 } 00097 }; 00098 00099 00100 00101 #endif
1.3.3