KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Minefield_Response_NACK_PDU.h
Go to the documentation of this file.
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
8 1. Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation
12  and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 
25 For Further Information Please Contact me at
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
29 
30 /********************************************************************
31  class: Minefield_Response_NACK_PDU
32  DIS: (6) 1278.1a - 1998
33  created: 25/06/2010
34  author: Karl Jones
35 
36  purpose: Provides the means by which a simulation shall request a minefield
37  simulation to retransmit Minefield Data PDUs not received in response
38  to a query when operating in QRP mode.
39  size: 208 bits / 26 octets - Min size
40 *********************************************************************/
41 
42 #pragma once
43 
44 #include "./Minefield_Header.h"
45 #include "./../../DataTypes/EntityType.h"
46 #include <vector>
47 
48 namespace KDIS {
49 namespace PDU {
50 
52 {
53 protected:
54 
56 
58 
60 
61  std::vector<KUINT8> m_vSeqNums;
62 
63 public:
64 
65  static const KUINT16 MINEFIELD_RESPONSE_NACK_SIZE = 26; // Min size
66 
68 
70 
71  Minefield_Response_NACK_PDU( const Header & H, KDataStream & stream ) throw( KException );
72 
73  Minefield_Response_NACK_PDU( const KDIS::DATA_TYPE::EntityIdentifier & MinefieldID, const KDIS::DATA_TYPE::EntityIdentifier & RequestingSimulationID,
74  KUINT8 ReqID );
75 
76  Minefield_Response_NACK_PDU( const KDIS::DATA_TYPE::EntityIdentifier & MinefieldID, const KDIS::DATA_TYPE::EntityIdentifier & RequestingSimulationID,
77  KUINT8 ReqID, const std::vector<KUINT8> & MissingSeqNums );
78 
79 
80  virtual ~Minefield_Response_NACK_PDU();
81 
82  //************************************
83  // FullName: KDIS::PDU::Minefield_Response_NACK_PDU::SetRequestingSimulationID
84  // KDIS::PDU::Minefield_Response_NACK_PDU::GetRequestingSimulationID
85  //!Description: Identifies the simulation that generated the query and is requesting
86  //! retransmission of information from the minefield simulation.
87  // Parameter: const EntityIdentifier & ID
88  //************************************
89  void SetRequestingSimulationID( const KDIS::DATA_TYPE::EntityIdentifier & ID );
90  const KDIS::DATA_TYPE::EntityIdentifier & GetRequestingSimulationID() const;
91  KDIS::DATA_TYPE::EntityIdentifier & GetRequestingSimulationID();
92 
93  //************************************
94  // FullName: KDIS::PDU::Minefield_Response_NACK_PDU::SetRequestID
95  // KDIS::PDU::Minefield_Response_NACK_PDU::GetRequestID
96  //!Description: Identifies the minefield query request.
97  // Parameter: KUINT8 ID
98  //************************************
99  void SetRequestID( KUINT8 ID );
100  KUINT8 GetRequestID() const;
101 
102  //************************************
103  // FullName: KDIS::PDU::Minefield_Response_NACK_PDU::GetNumberMissingPDUs
104  //!Description: Identifies the number of PDUs that were not received by
105  //! the requesting simulation in response to a minefield query request.
106  //! This value is derived from the Minefield Data PDUs that were
107  //! received in response to the minefield query request.
108  //************************************
109  KUINT8 GetNumberMissingPDUs() const;
110 
111  //************************************
112  // FullName: KDIS::PDU::Minefield_Response_NACK_PDU::GetNumberMissingPDUs
113  // KDIS::PDU::Minefield_Response_NACK_PDU::SetMissingPDUSequenceNumbers
114  // KDIS::PDU::Minefield_Response_NACK_PDU::GetMissingPDUSequenceNumbers
115  // KDIS::PDU::Minefield_Response_NACK_PDU::ClearMissingPDUSequenceNumbers
116  //!Description: The sequence number(s) of the missing PDU(s).
117  //! These values are derived from the Minefield Data PDUs that were
118  //! received in response to the minefield query request.
119  // Parameter: KUINT8 N, const vector<KUINT8> & N
120  //************************************
121  void AddMissingPDUSequenceNumber( KUINT8 N );
122  void SetMissingPDUSequenceNumbers( const std::vector<KUINT8> & N );
123  const std::vector<KUINT8> & GetMissingPDUSequenceNumbers() const;
124  void ClearMissingPDUSequenceNumbers();
125 
126  //************************************
127  // FullName: KDIS::PDU::Minefield_Response_NACK_PDU::GetAsString
128  //!Description: Returns a string representation of the PDU.
129  //************************************
130  virtual KString GetAsString() const;
131 
132  //************************************
133  // FullName: KDIS::PDU::Minefield_Response_NACK_PDU::Decode
134  //!Description: Convert From Network Data.
135  // Parameter: KDataStream & stream
136  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
137  //************************************
138  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
139 
140  //************************************
141  // FullName: KDIS::PDU::Minefield_Response_NACK_PDU::Encode
142  //!Description: Convert To Network Data.
143  // Parameter: KDataStream & stream
144  //************************************
145  virtual KDataStream Encode() const;
146  virtual void Encode( KDataStream & stream ) const;
147 
148  KBOOL operator == ( const Minefield_Response_NACK_PDU & Value ) const;
149  KBOOL operator != ( const Minefield_Response_NACK_PDU & Value ) const;
150 };
151 
152 } // END namespace PDU
153 } // END namespace KDIS
KUINT8 m_ui8NumMisPdus
Definition: Minefield_Response_NACK_PDU.h:59
KUINT8 m_ui8ReqID
Definition: Minefield_Response_NACK_PDU.h:57
unsigned short int KUINT16
Definition: KDefines.h:101
KDIS::DATA_TYPE::EntityIdentifier m_ReqID
Definition: Minefield_Response_NACK_PDU.h:55
Definition: KDefines.h:182
Definition: KDataStream.h:48
bool KBOOL
Definition: KDefines.h:119
Definition: Minefield_Header.h:49
std::vector< KUINT8 > m_vSeqNums
Definition: Minefield_Response_NACK_PDU.h:61
std::string KString
Definition: KDefines.h:116
Definition: EntityIdentifier.h:49
Definition: Header7.h:142
unsigned char KUINT8
Definition: KDefines.h:99
#define KDIS_EXPORT
Definition: KDefines.h:82
Definition: Minefield_Response_NACK_PDU.h:51