1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: uds_NetworkDescription.h 4 Copyright (C)2009 Nintendo Co., Ltd. All rights reserved. 5 These coded instructions, statements, and computer programs contain 6 proprietary information of Nintendo of America Inc. and/or Nintendo 7 Company Ltd., and are protected by Federal copyright law. They may 8 not be disclosed to third parties or copied or duplicated in any form, 9 in whole or in part, without the prior written consent of Nintendo. 10 $Rev: 35540 $ 11 *--------------------------------------------------------------------------- 12 13 14 */ 15 16 /* Please see man pages for details 17 18 */ 19 20 #ifndef LIBRARIES_UDS_CTR_UDS_NETWORK_DESCRIPTION_H_ 21 #define LIBRARIES_UDS_CTR_UDS_NETWORK_DESCRIPTION_H_ 22 23 #include <nn.h> 24 25 #include <nn/uds/CTR/uds_Type.h> 26 #include <nn/uds/CTR/uds_Result.h> 27 #include <nn/uds/CTR/uds_InfoElement.h> 28 29 namespace nn { 30 namespace uds { 31 namespace CTR { 32 33 /* Please see man pages for details 34 35 36 37 */ 38 class NetworkDescription 39 { 40 41 public: 42 43 /* Please see man pages for details 44 45 46 47 48 49 50 51 52 53 54 */ 55 void Initialize( u32 localId, u8 subId, u8 maxEntry, u8 channel ); 56 57 /* Please see man pages for details 58 59 60 61 62 63 64 65 66 67 */ 68 void Initialize( const detail::NetworkDescriptionElement* element, u8 channel, const bit8 bssid[MAC_ADDRESS_SIZE]); 69 70 /* Please see man pages for details 71 72 73 74 75 */ Finalize()76 void Finalize() { m_IsInitialized = false; std::memset(m_Bssid, 0x00, MAC_ADDRESS_SIZE); } 77 /* Please see man pages for details 78 79 80 */ GetBssid()81 const bit8* GetBssid() const{ return m_Bssid; } 82 /* Please see man pages for details 83 84 85 */ GetGameId()86 u32 GetGameId() const {return this->GetLocalCommunicationId(); } 87 /* Please see man pages for details 88 89 90 */ GetLocalCommunicationId()91 u32 GetLocalCommunicationId() const {return m_IsInitialized? detail::UDS_BE2LE32(m_Element.gameId):0; } 92 /* Please see man pages for details 93 94 95 */ GetSubId()96 u8 GetSubId() const {return m_IsInitialized? m_Element.subId:0; } 97 /* Please see man pages for details 98 99 100 */ GetTemporaryId()101 u32 GetTemporaryId() const {return m_IsInitialized? detail::UDS_BE2LE32(m_Element.temporaryId):0; } 102 /* Please see man pages for details 103 104 105 */ GetChannel()106 u16 GetChannel() const { return m_IsInitialized? m_Channel:0; } 107 /* Please see man pages for details 108 109 110 */ GetNowEntry()111 u8 GetNowEntry() const { return m_IsInitialized? m_Element.nowEntry:0 ; } 112 /* Please see man pages for details 113 114 115 */ GetMaxEntry()116 u8 GetMaxEntry() const { return m_IsInitialized? m_Element.maxEntry:0 ; } 117 /* Please see man pages for details 118 119 120 121 122 123 */ 124 size_t GetApplicationData(bit8* buffer, const size_t bufferSize) const; 125 /* Please see man pages for details 126 127 128 129 130 */ CanConnectAsSpectator()131 bool CanConnectAsSpectator() const { return ( m_IsInitialized && !(detail::UDS_BE2LE16(m_Element.attribute) & detail::EJECT_SPECTAOTR_FLAG)); } 132 /* Please see man pages for details 133 134 135 136 137 */ CanConnectAsClient()138 bool CanConnectAsClient() const { return ( m_IsInitialized && !(detail::UDS_BE2LE16(m_Element.attribute) & detail::DISALLOW_CONNECT_FLAG)); } 139 /* Please see man pages for details 140 141 142 143 144 */ CanReconnectAsClient()145 bool CanReconnectAsClient() const { return ( m_IsInitialized && !this->CanConnectAsClient() && !(detail::UDS_BE2LE16(m_Element.attribute) & detail::DISALLOW_RECONNECT_FLAG)); }//!reconnection as Client is allowed. Whether reconnection is allowed is determined when the Master actually connects. Therefore, the ability to reconnect is not guaranteed, even if this value is "true". 146 147 /* Please see man pages for details 148 149 150 151 152 153 154 */ 155 bool operator==(NetworkDescription &networkDescription); 156 /* Please see man pages for details 157 158 159 160 161 162 163 */ 164 bool operator!=(NetworkDescription &networkDescription); 165 166 private: 167 bit8 m_Bssid[MAC_ADDRESS_SIZE]; // 168 u16 m_Channel; // 169 bool m_IsInitialized; 170 NN_PADDING3; 171 detail::NetworkDescriptionElement m_Element; // 172 173 }; 174 175 } // end of namespace CTR 176 } // end of namespace uds 177 } // end of namespace nn 178 179 #endif /* LIBRARIES_UDS_CTR_UDS_NETWORK_DESCRIPTION_H_ */ 180