1 /*********************************************************************
3 Copyright 2013 Karl Jones
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
9 1. Redistributions of source code must retain the above copyright notice, this
10 list of conditions and the following disclaimer.
11 2. Redistributions in binary form must reproduce the above copyright notice,
12 this list of conditions and the following disclaimer in the documentation
13 and/or other materials provided with the distribution.
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 For Further Information Please Contact me at
28 http://p.sf.net/kdis/UserGuide
29 *********************************************************************/
31 /********************************************************************
37 purpose: The information operations status of an entity shall be
38 conveyed using the Information Operations Report PDU.
39 This includes reporting the status of any entities
40 and their associated equipment that are susceptible to
42 Size: 320 bits / 40 octets - min size not including standard variables
43 *********************************************************************/
47 #include "KDIS/DataTypes/IOCommunicationsNode.hpp"
48 #include "KDIS/DataTypes/IOEffect.hpp"
49 #include "KDIS/PDU/Information_Operations/IO_Header.hpp"
54 class KDIS_EXPORT IO_Report_PDU
: public IO_Header
{
62 KDIS::DATA_TYPE::EntityIdentifier m_AtkEntityID
;
64 KDIS::DATA_TYPE::EntityIdentifier m_TgtEntityID
;
66 KUINT32 m_ui32Padding
; // 2 * KUINT16 padding in 1278.1-2012 standard.
68 KUINT16 m_ui16NumStdVarRec
;
70 std::vector
<KDIS::DATA_TYPE::StdVarPtr
> m_vStdVarRecs
;
73 static const KUINT16 IO_REPORT_PDU_SIZE
= 40;
77 IO_Report_PDU(KDataStream
& stream
);
79 IO_Report_PDU(const Header
& H
, KDataStream
& stream
);
81 IO_Report_PDU(const KDIS::DATA_TYPE::EntityIdentifier
& OrigID
, KUINT16 SimSrc
,
82 KDIS::DATA_TYPE::ENUMS::IOReportType RT
,
83 const KDIS::DATA_TYPE::EntityIdentifier
& AtkID
,
84 const KDIS::DATA_TYPE::EntityIdentifier
& TgtID
);
86 virtual ~IO_Report_PDU();
88 //************************************
89 // FullName: KDIS::PDU::IO_Report_PDU::SetSimulationSource
90 // KDIS::PDU::IO_Report_PDU::GetSimulationSource
91 // Description: Identifies the name of the simulation model issuing this PDU.
93 // 1-200 Reserved for future Io simulation sources.
94 // 201-255 Reserved for United States IO Simulation Sources -
95 // See applicable agreement or the organizers of the
96 // event (training, exercise, etc) in which information
97 // operations is included.
98 // Parameter: KUINT16 SS
99 //************************************
100 void SetSimulationSource(KUINT16 SS
);
101 KUINT16
GetSimulationSource() const;
103 //************************************
104 // FullName: KDIS::PDU::IO_Report_PDU::SetReportType
105 // KDIS::PDU::IO_Report_PDU::GetReportType
106 // Description: The type of report this PDU represents.
107 // Parameter: IOReportType RT
108 //************************************
109 void SetReportType(KDIS::DATA_TYPE::ENUMS::IOReportType RT
);
110 KDIS::DATA_TYPE::ENUMS::IOReportType
GetReportType() const;
112 //************************************
113 // FullName: KDIS::PDU::IO_Report_PDU::SetAttackerEntityID
114 // KDIS::PDU::IO_Report_PDU::GetAttackerEntityID
115 // Description: Identifies the IO Attacker Entity ID.
116 // Parameter: const EntityIdentifier & ID
117 //************************************
118 void SetAttackerEntityID(const KDIS::DATA_TYPE::EntityIdentifier
& ID
);
119 const KDIS::DATA_TYPE::EntityIdentifier
& GetAttackerEntityID() const;
120 KDIS::DATA_TYPE::EntityIdentifier
& GetAttackerEntityID();
122 //************************************
123 // FullName: KDIS::PDU::IO_Report_PDU::SetPrimaryTargetEntityID
124 // KDIS::PDU::IO_Report_PDU::GetPrimaryTargetEntityID
125 // Description: Identifies the IO Primary Target Entity ID.
126 // Parameter: const EntityIdentifier & ID
127 //************************************
128 void SetPrimaryTargetEntityID(const KDIS::DATA_TYPE::EntityIdentifier
& ID
);
129 const KDIS::DATA_TYPE::EntityIdentifier
& GetPrimaryTargetEntityID() const;
130 KDIS::DATA_TYPE::EntityIdentifier
& GetPrimaryTargetEntityID();
132 //************************************
133 // FullName: KDIS::PDU::IO_Report_PDU::GetNumberOfIORecords
134 // Description: Indicates the number of IO standard variable records included.
135 //************************************
136 KUINT16
GetNumberOfIORecords() const;
138 //************************************
139 // FullName: KDIS::PDU::IO_Report_PDU::AddStandardVariableRecord
140 // KDIS::PDU::IO_Report_PDU::SetStandardVariableRecords
141 // KDIS::PDU::IO_Report_PDU::GetStandardVariableRecords
142 // KDIS::PDU::IO_Report_PDU::ClearStandardVariableRecords
143 // Description: The following Standard Records currently exist:
144 // - IOCommunicationsNode
146 // Parameter: StdVarPtr SVR, const vector<StdVarPtr> & SVR
147 //************************************
148 void AddStandardVariableRecord(KDIS::DATA_TYPE::StdVarPtr SVR
);
149 void SetStandardVariableRecords(
150 const std::vector
<KDIS::DATA_TYPE::StdVarPtr
>& SVR
);
151 const std::vector
<KDIS::DATA_TYPE::StdVarPtr
>& GetStandardVariableRecords()
153 void ClearStandardVariableRecords();
155 //************************************
156 // FullName: KDIS::PDU::IO_Report_PDU::GetAsString
157 // Description: Returns a string representation of the PDU.
158 //************************************
159 virtual KString
GetAsString() const;
161 //************************************
162 // FullName: KDIS::PDU::IO_Report_PDU::Decode
163 // Description: Convert From Network Data.
164 // Parameter: KDataStream & stream
165 // Parameter: bool ignoreHeader = false - Decode the header from the stream?
166 //************************************
167 virtual void Decode(KDataStream
& stream
, bool ignoreHeader
= false);
169 //************************************
170 // FullName: KDIS::PDU::IO_Report_PDU::Encode
171 // Description: Convert To Network Data.
172 // Parameter: KDataStream & stream
173 //************************************
174 virtual KDataStream
Encode() const;
175 virtual void Encode(KDataStream
& stream
) const;
177 KBOOL
operator==(const IO_Report_PDU
& Value
) const;
178 KBOOL
operator!=(const IO_Report_PDU
& Value
) const;
181 } // END namespace PDU
182 } // END namespace KDIS