srm-headers.h
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:3k
源码类别:

通讯编程

开发平台:

Visual C++

  1. /*
  2.  * srm-headers.h
  3.  * Copyright (C) 1997 by the University of Southern California
  4.  * $Id: srm-headers.h,v 1.11 2005/08/25 18:58:08 johnh Exp $
  5.  *
  6.  * This program is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU General Public License,
  8.  * version 2, as published by the Free Software Foundation.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License along
  16.  * with this program; if not, write to the Free Software Foundation, Inc.,
  17.  * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
  18.  *
  19.  *
  20.  * The copyright of this module includes the following
  21.  * linking-with-specific-other-licenses addition:
  22.  *
  23.  * In addition, as a special exception, the copyright holders of
  24.  * this module give you permission to combine (via static or
  25.  * dynamic linking) this module with free software programs or
  26.  * libraries that are released under the GNU LGPL and with code
  27.  * included in the standard release of ns-2 under the Apache 2.0
  28.  * license or under otherwise-compatible licenses with advertising
  29.  * requirements (or modified versions of such code, with unchanged
  30.  * license).  You may copy and distribute such a system following the
  31.  * terms of the GNU GPL for this module and the licenses of the
  32.  * other code concerned, provided that you include the source code of
  33.  * that other code when and as the GNU GPL requires distribution of
  34.  * source code.
  35.  *
  36.  * Note that people who make modified versions of this module
  37.  * are not obligated to grant this special exception for their
  38.  * modified versions; it is their choice whether to do so.  The GNU
  39.  * General Public License gives permission to release a modified
  40.  * version without this exception; this exception also makes it
  41.  * possible to release a modified version which carries forward this
  42.  * exception.
  43.  *
  44.  */
  45. //
  46. // Author: Kannan Varadhan <kannan@isi.edu>
  47. // Version Date: Mon Jun 30 15:51:33 PDT 1997
  48. //
  49. // @(#) $Header: /cvsroot/nsnam/ns-2/mcast/srm-headers.h,v 1.11 2005/08/25 18:58:08 johnh Exp $ (USC/ISI)
  50. //
  51. #ifndef ns_srm_headers_h
  52. #define ns_srm_headers_h
  53. struct hdr_srm {
  54. #define SRM_DATA 1
  55. #define SRM_SESS 2
  56. #define SRM_RQST 3
  57. #define SRM_REPR 4
  58. int type_;
  59. int sender_;
  60. int seqnum_;
  61. int round_;
  62. static int offset_;
  63. inline static int& offset() { return offset_; }
  64. inline static hdr_srm* access(const Packet* p) {
  65. return (hdr_srm*) p->access(offset_);
  66. }
  67. // per field member functions
  68. int& type() { return type_; }
  69. int& sender() { return sender_; }
  70. int& seqnum() { return seqnum_; }
  71. int& round() { return round_; }
  72. };
  73. #define SRM_NAMES "NULL", "SRM_DATA", "SRM_SESS", "SRM_RQST", "SRM_REPR"
  74. struct hdr_asrm {
  75. double distance_;
  76. static int offset_;
  77. inline static int& offset() { return offset_; }
  78. inline static hdr_asrm* access(const Packet* p) {
  79. return (hdr_asrm*) p->access(offset_);
  80. }
  81. // per field member functions
  82. double& distance() { return distance_; }
  83. };
  84. #endif /* ns_srm_headers_.h */