1 /*--------------------------------------------------------------------------
2   Project:  HorizonSDK
3   File:     rdt_Header.h
4 
5   Copyright 2009 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2010-04-30#$
14   $Rev: 15289 $
15   $Author: hiratsu_daisuke $
16  *-------------------------------------------------------------------------*/
17 
18 #include "stdafx.h"
19 
20 #ifndef NN_RDT_HEADER_H_
21 #define NN_RDT_HEADER_H_
22 
23 
24 namespace nn { namespace rdt { namespace CTR {
25 
26 /* Please see man pages for details
27 
28 */
29 struct Header{
30 public:
31     static const u32 MAGIC_NUMBER = 'N' << 24 | 'N' << 16 | 'R' << 8 | 'P' << 0;
32 
33     // Control bit group.
34     static const u16 BIT_ACK = 0x0001;
35     static const u16 BIT_RST = 0x0002;
36     static const u16 BIT_SYN = 0x0008;
37     static const u16 BIT_FIN = 0x0010;
38     static const u16 BIT_SRV = 0x0100;
39     static const u16 BIT_CLI = 0x0200;
40 
41 /* Please see man pages for details
42 
43 */
44     Header(void);
45 
46 /* Please see man pages for details
47 
48 
49 */
50     void Clear(void);
51 
52 /* Please see man pages for details
53 
54 */
55     void PrintDebugInfo(void) const;
56 
57     u32 magicNum;    // Magic number (place at start of structure!)
58     u32 seqNum;      // Sequence number
59     u32 ackNum;      // ACK number
60     u8  dataOffset;  // Data offset. Where the data portion begins from. (=header length)
61     u8  reserved;    // Unused (may also function as padding)
62     u16 controlBit;  // Control bit
63     u32 dataLength;  // Actual data size. Probably will be unnecessary.
64     u16 windowSize;  // Window size Used for notifications from receiving side to sending side.
65     u16 checkSum;    // Checksum
66 };
67 
68 }}} // namespace nn::rdt::CTR
69 
70 #endif  // end of NN_RDT_HEADER_H_
71