1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     rdt_Header.h
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  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   $Rev: 46347 $
14  *---------------------------------------------------------------------------*/
15 
16 #include "stdafx.h"
17 
18 #ifndef NN_LIBRARIES_RDT_RDT_HEADER_H_
19 #define NN_LIBRARIES_RDT_RDT_HEADER_H_
20 
21 
22 namespace nn { namespace rdt { namespace CTR {
23 
24 /* Please see man pages for details
25 
26 */
27 struct Header{
28 public:
29     static const u32 MAGIC_NUMBER = 'N' << 24 | 'N' << 16 | 'R' << 8 | 'P' << 0;
30 
31     // Control bit group.
32     static const u16 BIT_ACK = 0x0001;
33     static const u16 BIT_RST = 0x0002;
34     static const u16 BIT_SYN = 0x0008;
35     static const u16 BIT_FIN = 0x0010;
36     static const u16 BIT_SRV = 0x0100;
37     static const u16 BIT_CLI = 0x0200;
38 
39 /* Please see man pages for details
40 
41 */
42     Header(void);
43 
44 /* Please see man pages for details
45 
46 
47 */
48     void Clear(void);
49 
50 /* Please see man pages for details
51 
52 */
53     void PrintDebugInfo(void) const;
54 
55     u32 magicNum;    // Magic number (put at the start of the structure!)
56     u32 seqNum;      // Sequence number
57     u32 ackNum;      // ACK number
58     u8  dataOffset;  // Data offset. Where does the data portion start? (= header length)
59     u8  reserved;    // Unused (the padding may also have a role)
60     u16 controlBit;  // Control bit
61     u32 dataLength;  // Actual data size. Maybe will become unnecessary.
62     u16 windowSize;  // Window size. Used when sending notification from the receiving side to the sending side.
63     u16 checkSum;    // Checksum
64 };
65 
66 }}} // namespace nn::rdt::CTR
67 
68 #endif  // end of NN_LIBRARIES_RDT_RDT_HEADER_H_
69