open-dis-cpp
Pdu.h
1 #pragma once
2 
3 #include <dis6/utils/DataStream.h>
4 #include <dis6/opendis6_export.h>
5 
6 
7 namespace DIS
8 {
9 // The superclass for all PDUs. This incorporates the PduHeader record, section 5.2.29.
10 
11 // Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved.
12 //
13 // @author DMcG, jkg
14 
15 class OPENDIS6_EXPORT Pdu
16 {
17 protected:
19  unsigned char _protocolVersion;
20 
22  unsigned char _exerciseID;
23 
25  unsigned char _pduType;
26 
28  unsigned char _protocolFamily;
29 
31  unsigned int _timestamp;
32 
34  unsigned short _length;
35 
37  short _padding;
38 
39 
40  public:
41  Pdu();
42  virtual ~Pdu();
43 
44  virtual void marshal(DataStream& dataStream) const;
45  virtual void unmarshal(DataStream& dataStream);
46 
47  unsigned char getProtocolVersion() const;
48  void setProtocolVersion(unsigned char pX);
49 
50  unsigned char getExerciseID() const;
51  void setExerciseID(unsigned char pX);
52 
53  unsigned char getPduType() const;
54  void setPduType(unsigned char pX);
55 
56  unsigned char getProtocolFamily() const;
57  void setProtocolFamily(unsigned char pX);
58 
59  unsigned int getTimestamp() const;
60  void setTimestamp(unsigned int pX);
61 
62  unsigned short getLength() const;
63  void setLength(unsigned short pX);
64 
65  short getPadding() const;
66  void setPadding(short pX);
67 
68 
69 virtual int getMarshalledSize() const;
70 
71  bool operator ==(const Pdu& rhs) const;
72 };
73 }
74 
75 // Copyright (c) 1995-2009 held by the author(s). All rights reserved.
76 // Redistribution and use in source and binary forms, with or without
77 // modification, are permitted provided that the following conditions
78 // are met:
79 //
80 // * Redistributions of source code must retain the above copyright
81 // notice, this list of conditions and the following disclaimer.
82 // * Redistributions in binary form must reproduce the above copyright
83 // notice, this list of conditions and the following disclaimer
84 // in the documentation and/or other materials provided with the
85 // distribution.
86 // * Neither the names of the Naval Postgraduate School (NPS)
87 // Modeling Virtual Environments and Simulation (MOVES) Institute
88 // (http://www.nps.edu and http://www.MovesInstitute.org)
89 // nor the names of its contributors may be used to endorse or
90 // promote products derived from this software without specific
91 // prior written permission.
92 //
93 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
94 // AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
95 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
96 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
97 // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
98 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
99 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
100 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
101 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
102 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
103 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
104 // POSSIBILITY OF SUCH DAMAGE.
unsigned char _protocolFamily
value that refers to the protocol family, eg SimulationManagement, et
Definition: Pdu.h:28
Symbolic names as defined in 5.1.4.
Definition: AcknowledgePdu.h:8
short _padding
zero-filled array of padding
Definition: Pdu.h:37
a class to support managing a network buffer.
Definition: DataStream.h:28
unsigned short _length
Length, in bytes, of the PDU.
Definition: Pdu.h:34
Definition: Pdu.h:15
unsigned char _exerciseID
Exercise ID.
Definition: Pdu.h:22
unsigned char _pduType
Type of pdu, unique for each PDU class.
Definition: Pdu.h:25
unsigned int _timestamp
Timestamp value.
Definition: Pdu.h:31
unsigned char _protocolVersion
The version of the protocol.
Definition: Pdu.h:19