/*---------------------------------------------------------------------------* Project: Horizon File: rdt_Result.h Copyright (C) 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. $Rev: 56250 $ *---------------------------------------------------------------------------*/ ////#include #ifndef NN_RDT_RESULT_H_ #define NN_RDT_RESULT_H_ #include namespace nn { namespace rdt { /*! @ingroup nn_rdt @defgroup nn_rdt_result Reliable Local Communication (RDT) Results @brief A list of Results used in the Reliable Local Communication (RDT) library. @{ */ /*! @private @brief Result code details. */ enum Description { DESCRIPTION_RESET_RECEIVED = 1, //!< These results transition to a CLOSED state because a reset signal was received from the partner. DESCRIPTION_UNTIMELY_CALL = 2, //!< Do not call the function in this state. DESCRIPTION_INVALID_VALUE = 3 //!< Invalid parameter value. }; /*! @class nn::rdt::ResultAlreadyInitialized @brief Indicates that a function exited without doing anything because initialization had already finished. (This is not an error.) This result code may be returned when an initialization function is called more than once. */ NN_DEFINE_RESULT_CONST( ResultAlreadyInitialized, Result::LEVEL_INFO, Result::SUMMARY_NOTHING_HAPPENED, Result::MODULE_NN_RDT, Result::DESCRIPTION_ALREADY_INITIALIZED); /*! @class nn::rdt::ResultDoNothing @brief Indicates that a function exited without doing anything. (This is not an error.) One example of when this result may be returned is when you try to send zero bytes of data. */ NN_DEFINE_RESULT_CONST( ResultDoNothing, Result::LEVEL_INFO, Result::SUMMARY_NOTHING_HAPPENED, Result::MODULE_NN_RDT, Result::DESCRIPTION_SUCCESS); /*! @class nn::rdt::ResultNotInitialized @brief Indicates an uninitialized instance. Most functions in the RDT API require an instance to be initialized before they can be used. Initialize an object instance with an initialization function before you call a function in the RDT library. */ NN_DEFINE_RESULT_CONST( ResultNotInitialized, Result::LEVEL_USAGE, Result::SUMMARY_INVALID_STATE, Result::MODULE_NN_RDT, Result::DESCRIPTION_NOT_INITIALIZED); /*! @class nn::rdt::ResultSendBufferIsNotAvailable @brief Indicates that the Sender::Send function attempted to write data to the send buffer, but the send buffer did not have enough free space. Call Sender::Process to make free space in the send buffer. Because @ref Sender::Process actually sends the data, data copied to the send buffer is eventually used up. (Of course, this assumes the data was successfully received by the receiver.) If you encounter this result code, you might succeed by calling @ref Sender::Process followed by @ref Sender::Send several times. */ NN_DEFINE_RESULT_CONST( ResultSendBufferIsNotAvailable, Result::LEVEL_TEMPORARY, Result::SUMMARY_OUT_OF_RESOURCE, Result::MODULE_NN_RDT, Result::DESCRIPTION_OUT_OF_MEMORY); /*! @class nn::rdt::ResultInvalidSize @brief Indicates that an invalid size was specified as an argument. This result code is returned if, for example, you specify a buffer size of zero. */ NN_DEFINE_RESULT_CONST( ResultInvalidSize, Result::LEVEL_USAGE, Result::SUMMARY_INVALID_ARGUMENT, Result::MODULE_NN_RDT, Result::DESCRIPTION_INVALID_SIZE); /*! @class nn::rdt::ResultMisalignedAddress @brief Indicates that a memory address with an invalid alignment was passed as an argument. Some parts of the RDT library require 8-byte alignment. In cases like this, you must pass a correctly aligned memory address. */ NN_DEFINE_RESULT_CONST( ResultMisalignedAddress, Result::LEVEL_USAGE, Result::SUMMARY_INVALID_ARGUMENT, Result::MODULE_NN_RDT, Result::DESCRIPTION_MISALIGNED_ADDRESS); /*! @class nn::rdt::ResultNullPointer @brief Indicates an error caused by specifying a null pointer as an argument. For example, you cannot use a null pointer in places where you are passing a memory address for use as working memory or as the memory address to start writing data. */ NN_DEFINE_RESULT_CONST( ResultNullPointer, Result::LEVEL_USAGE, Result::SUMMARY_INVALID_ARGUMENT, Result::MODULE_NN_RDT, Result::DESCRIPTION_INVALID_POINTER); /*! @class nn::rdt::ResultResetReceived @brief Indicates that a reset signal was received from a peer, and there was a state transition to CLOSED. The reset signal is sent in response to mistaken connection requests and when @ref Sender::Cancel or @ref Receiver::Cancel is executed. When this reset signal is received, the instance changes state to CLOSED. Depending on the situation, you may want to handle this by trying to reconnect again or by disconnecting altogether. */ NN_DEFINE_RESULT_CONST( ResultResetReceived, Result::LEVEL_STATUS, Result::SUMMARY_STATUS_CHANGED, Result::MODULE_NN_RDT, DESCRIPTION_RESET_RECEIVED); /*! @class nn::rdt::ResultResendQueueIsFull @brief Indicates that the internal resend queue for the RDT library was full. This is an internal error. If you encounter it, there is a good chance that it is caused by a bug in the RDT library. Please contact Nintendo (support@noa.com) if you come across this error during development. */ NN_DEFINE_RESULT_CONST( ResultResendQueueIsFull, Result::LEVEL_RESET, Result::SUMMARY_OUT_OF_RESOURCE, Result::MODULE_NN_RDT, Result::DESCRIPTION_OUT_OF_MEMORY); /*! @class nn::rdt::ResultUntimelyFunctionCall @brief Indicates that a function was called at the wrong time. Call some functions, such as @ref Sender::Open and @ref Receiver::Wait, only at particular times or instance states. For example, do not call @ref Sender::Open when the instance is already in the SENDER_STATE_OPENED state. This result code is returned in such situations. */ NN_DEFINE_RESULT_CONST( ResultUntimelyFunctionCall, Result::LEVEL_STATUS, Result::SUMMARY_INVALID_STATE, Result::MODULE_NN_RDT, DESCRIPTION_UNTIMELY_CALL); /*! @class nn::rdt::ResultNoData @brief A result code that is used only within the library. Indicates that no segments have been received. Application developers do not need to worry about this result code. It is only used internally by the RDT library. */ NN_DEFINE_RESULT_CONST( ResultNoData, Result::LEVEL_TEMPORARY, Result::SUMMARY_NOT_FOUND, Result::MODULE_NN_RDT, Result::DESCRIPTION_NO_DATA); /*! @class nn::rdt::ResultInvalidValue @brief A result code that indicates that an argument value was invalid. Returned when an RDT function receives an unexpected value. */ NN_DEFINE_RESULT_CONST( ResultInvalidValue, Result::LEVEL_USAGE, Result::SUMMARY_INVALID_ARGUMENT, Result::MODULE_NN_RDT, DESCRIPTION_INVALID_VALUE); //! @} }} // namespace nn::rdt #endif // end of NN_RDT_RESULT_H_