/*-------------------------------------------------------------------------- Project: HorizonSDK File: rdt_Transceiver.h Copyright 2009 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Date:: 2010-07-21#$ $Rev: 21558 $ $Author: hiratsu_daisuke $ *-------------------------------------------------------------------------*/ #include "stdafx.h" #ifndef NN_RDT_TRANSCEIVER_H_ #define NN_RDT_TRANSCEIVER_H_ #include "rdt_Segment.h" namespace nn { namespace rdt { namespace CTR { /*! @brief これはセグメントの送受信に特化したクラスです。 */ class Transceiver{ public: /*! @brief コンストラクタです。 */ Transceiver(void); /*! @brief 解放します。 */ ~Transceiver(void); /*! @brief 初期化します。 */ #ifdef _WIN32 nn::Result Initialize(SOCKET sock); #elif defined(NN_PLATFORM_CTR) nn::Result Initialize(u16 nodeId, u8 port); // 送信先のノードIDとポート番号 #else #error no platform selected #endif /*! @brief 解放します。 */ void Finalize(void); /*! @brief セグメントの送信を行います 返値がvoidなのは、「この関数の動作は絶対に成功する」 という意味ではない。そもそもパケロスがが起こりうる環境であれば、 いずれにせよ後でACKによるケアをしなければならないので、 ここで成功/失敗を気にかけることはあまり意味がないように思えたため。 ↑方針転換。UDSのエラーコードをケアしたくなったので、返値を取れるようにする。 */ nn::Result Put(const Segment &seg); /*! @brief セグメントを受信します。 */ nn::Result Pull(Segment *pSeg); /*! @brief CUnitを用いた単体テストです。 */ static void Test(void); private: /*! @brief コピーコンストラクタは封印します。 */ Transceiver (const Transceiver&); /*! @brief 代入演算子は封印します。 */ Transceiver& operator=(const Transceiver&); bool m_initialized; u8 m_padding1[3]; #ifdef _WIN32 SOCKET m_sock; #elif defined(NN_PLATFORM_CTR) nn::uds::EndpointDescriptor m_sendEp; nn::uds::EndpointDescriptor m_recvEp; u16 m_remoteNodeId; // 通信相手のノードID u8 m_port; u8 m_padding2[1]; #else #error no platform selected #endif }; }}} // namespace nn::rdt::CTR #endif // end of NN_RDT_TRANSCEIVER_H_