KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
LE_Header.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: LE_Header
32  DIS: (6) 1278.1a - 1998
33  created: 29/06/2010
34  author: Karl Jones
35 
36  purpose: Header for all PDU's from the Live Entity (LE) Family.
37 
38  size: 128 bits / 16 octets
39 *********************************************************************/
40 
41 #pragma once
42 
43 #include "./../Header.h"
44 #include "./../../DataTypes/LE_EntityIdentifier.h"
45 
46 namespace KDIS {
47 namespace PDU {
48 
50 {
51 protected:
52 
54 
55 public:
56 
57  static const KUINT16 LE_HEADER_SIZE = 16;
58 
59  LE_Header();
60 
61  LE_Header( const Header & H );
62 
63  LE_Header( KDataStream & stream ) throw( KException );
64 
65  LE_Header( const Header & H, KDataStream & stream ) throw( KException );
66 
67  virtual ~LE_Header();
68 
69  //************************************
70  // FullName: KDIS::PDU::LE_Header::SetLiveEntityID
71  // KDIS::PDU::LE_Header::GetLiveEntityID
72  //!Description: Identifies the entity issuing the PDU.
73  // Parameter: const LE_EntityIdentifier & ID
74  //************************************
75  void SetLiveEntityID( const KDIS::DATA_TYPE::LE_EntityIdentifier & ID );
76  const KDIS::DATA_TYPE::LE_EntityIdentifier & GetLiveEntityID() const;
77  KDIS::DATA_TYPE::LE_EntityIdentifier & GetLiveEntityID();
78 
79  //************************************
80  // FullName: KDIS::PDU::LE_Header::SetSubprotocol
81  // KDIS::PDU::LE_Header::GetSubprotocol
82  //!Description: This field shall specify the sub protocol to be used to decode the PDU.
83  //! The value of zero is reserved for PDUs complying to the published standard.
84  // Parameter: KUINT8 S
85  //************************************
86  void SetSubprotocol( KUINT8 S );
87  KUINT8 GetSubprotocol() const;
88 
89  //************************************
90  // FullName: KDIS::PDU::LE_Header::GetAsString
91  //!Description: Returns a string representation of the PDU
92  //************************************
93  virtual KString GetAsString() const;
94 
95  //************************************
96  // FullName: KDIS::PDU::LE_Header::Decode
97  //!Description: Convert From Network Data.
98  // Parameter: KDataStream & stream
99  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
100  //************************************
101  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
102 
103  //************************************
104  // FullName: KDIS::PDU::LE_Header::Encode
105  //!Description: Convert To Network Data.
106  // Parameter: KDataStream & stream
107  //************************************
108  virtual KDataStream Encode() const;
109  virtual void Encode( KDataStream & stream ) const;
110 
111  KBOOL operator == ( const LE_Header & Value ) const;
112  KBOOL operator != ( const LE_Header & Value ) const;
113 };
114 
115 } // END namespace PDU
116 } // END namespace KDIS
unsigned short int KUINT16
Definition: KDefines.h:101
Definition: KDefines.h:182
Definition: KDataStream.h:48
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
KDIS::DATA_TYPE::LE_EntityIdentifier m_EntID
Definition: LE_Header.h:53
Definition: Header7.h:142
Definition: LE_Header.h:49
unsigned char KUINT8
Definition: KDefines.h:99
#define KDIS_EXPORT
Definition: KDefines.h:82
Definition: LE_EntityIdentifier.h:48