1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     uds_InfoElement.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 /* Please see man pages for details
17 
18 */
19 
20 #ifndef NN_UDS_CTR_UDS_INFO_ELEMENT_H_
21 #define NN_UDS_CTR_UDS_INFO_ELEMENT_H_
22 
23 #include <nn/types.h>
24 
25 namespace nn {
26 namespace uds {
27 namespace CTR {
28 namespace detail {
29 
30 const bit8 VSIE_OUI[ OUI_SIZE ]      = {0x00, 0x1f, 0x32};  //
31 
32 const size_t VSIE_SIZE_MAX   = 250;
33 
34 //Connection information included in NetworkDescription
35 const bit16 EJECT_SPECTAOTR_FLAG     = 0x0001; //!< Flag to disconnect connected spectators, with new connections prohibited
36 const bit16 DISALLOW_CONNECT_FLAG    = 0x0002; //!< Prohibit new client connections
37 const bit16 DISALLOW_RECONNECT_FLAG  = 0x0004; //!< Prohibit client re-connections @ref Only referenced when DISALLOW_CONNECT_FLAG is enabled
38 const bit16 DIRECT_BROADCAST_FLAG    = 0x8000; //!< Flag for whether to use DirectBroadcast; be sure to set this flag
39 
40 
41 /*
42 
43  */
44 enum SubType
45 {
46     NETWORK_DESCRIPTION_IE  = 21,   //
47     SPECTATOR_PACKET_IE     = 22,   //
48     SPECTATOR_ACK_IE        = 23,   //
49     NODE_INFORMATION_IE_1   = 24,   //
50     NODE_INFORMATION_IE_2   = 25,   //
51     SCAN_ON_CONNECTION_IE_1 = 26    //
52 };
53 
54 /*
55 
56  */
57 struct NetworkDescriptionElement
58 {
59     //Common header
60     bit8  oui[3];           //
61     u8    subType;          //
62     u32   gameId;           //
63     u8    subId;            //
64     u8    sequenceNumber;   //
65     bit16 attribute;        //
66     u32   temporaryId;      //
67     u8    nowEntry;         //
68     u8    maxEntry;         //
69     u8    tmpEntry;         //
70     bit8  platform;         //
71     u8    securityType;     //
72     u8    reserved[10];     //
73     u8    digest[20];         //
74     u8    appDataLength;    //
75     bit8  appData[NET_DESC_APPDATA_SIZE_MAX];   //
76 };
77 
78 /*
79 
80  */
81 struct NodeInformationElement
82 {
83     //Common header
84     bit8  oui[3];           //
85     u8    subType;          //
86     bit8  payload[VSIE_SIZE_MAX];
87 };
88 
89 /*
90 
91  */
92 struct ScanOnConnectionElement
93 {
94     //Common header
95     bit8  oui[3];           //
96     u8    subType;          //
97     u32   gameId;           //
98     u8    subId;            //
99     u8    reserved[3];
100 };
101 
102 } // end of namespace detail
103 } // end of namespace CTR
104 } // end of namespace uds
105 } // end of namespace nn
106 
107 #endif /* NN_UDS_CTR_UDS_INFO_ELEMENT_H_ */
108