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