NDEVR
API Documentation
NDEVRDataPacket.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2020, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: NDEVRDataPacket
28File: NDEVRServerClientModule
29Included in API: True
30Author(s): tyler.parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/Buffer.h>
35#include <NDEVR/BinaryFile.h>
36namespace NDEVR
37{
38 class ProgressInfo;
43 {
44 static constexpr uint04 valid_start_check = 0xA5A5A5A5U;
46 uint04 checksum = Constant<uint04>::Invalid;
47 uint08 size = 0U;
49 };
50
53 struct NDEVRSERVERCLIENT_API NDEVRDataPacket
54 {
56 NDEVRDataPacket() {};
59 NDEVRDataPacket(NDEVRDataPacket&& other);
63 NDEVRDataPacket& operator=(NDEVRDataPacket&& other) noexcept;
67 NDEVRDataPacket(const Buffer<uint01>& other, bool generate_checksum);
71 NDEVRDataPacket(const HighCapacityBuffer<uint01>& other, bool generate_checksum);
75 NDEVRDataPacket(HighCapacityBuffer<uint01>&& other, bool generate_checksum);
79 NDEVRDataPacket(BinaryFile&& bf, bool generate_checksum);
81 void clear();
84 BinaryFile& binaryFile();
89 uint08 addData(uint01* buffer, uint08 size);
94 uint08 pullData(uint01* buffer, uint08 max_size);
97 uint08 dataSize() const;
100 void updatePointer(uint08 forward);
104 void getProgress(ProgressInfo& info, uint08 extra_size) const;
108 bool isComplete(uint08 extra_size) const;
111 bool isComplete() const;
114 bool hasStarted() const;
117 bool isValid() const;
120 void setupPacketHeader(bool generate_checksum);
123 uint04 checksum() const;
124 NDEVRPacketHeader packet_header;
125 uint08 handled_size = sizeof(NDEVRPacketHeader);
126 protected:
127 BinaryFile m_file;
128 };
129}
Used with InfoPipe to signal that the system will be using progress.
The primary namespace for the NDEVR SDK.
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Fixed-size header prepended to every NDEVR data packet for framing and integrity checking.
uint04 start_check
Start marker used to detect packet boundaries.
bool cache_to_disk
Whether this packet should be cached to disk.
static constexpr uint04 valid_start_check
Magic number marking the start of a valid packet.
uint08 size
Total size of the packet payload in bytes.
uint04 checksum
CRC or hash checksum for data integrity.