/*--------------------------------------------------------------------------* 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. *---------------------------------------------------------------------------*/ #ifndef NN_BOSS_BOSS_RAWULTASKSETTING_H_ #define NN_BOSS_BOSS_RAWULTASKSETTING_H_ #include #include #include #include #ifdef __cplusplus namespace nn { namespace boss { /*! @addtogroup nn_boss_api @{ */ /*! @brief Represents settings for a RawUL task. Used when registering tasks (passed as an argument to @ref Task::Register). */ class RawUlTaskSetting : public NetTaskSetting { public: /*! @brief Instantiates an object. */ explicit RawUlTaskSetting(void); /*! @brief Destroys the object. */ virtual ~RawUlTaskSetting(void); /*! @brief Initializes the settings of a RawUL task. If initialization succeeds, you can register the information using the @ref Task::Register function. @param[in] url Specifies the connection URL. @param[in] pUploadData Specifies a pointer to the beginning of the data to upload. Do not free this data until the @ref Task::Register function completes. @param[in] uploadDataSize Specifies the size of the data to upload. @return Returns the result of execution. Returns one of the following Result values. @retval Result::IsSuccess Indicates successful retrieval. @retval ResultInvalidParameter Indicates an invalid parameter. */ nn::Result Initialize(const char* url, const u8* pUploadData, s64 uploadDataSize); /*! @brief Initializes the settings of a RawUL task. If initialization succeeds, you can register the information using the @ref Task::Register function. @param[in] url Specifies the connection URL. @param[in] uploadFilePath Specifies the file path to the data to upload. Do not delete this file until the @ref Task::Register function completes. @param[in] pUploadWorkBuffer Specifies a pointer to the start of memory to use as a working buffer during upload. It is used to copy the data uploaded using @ref Task::Register. It is also used as the dest argument to the FSReadFile function, so the buffer alignment must be compatible with this function. The larger the size of the buffer that you provide, the faster the @ref Task::Register function completes. Do not free this memory until the @ref Task::Register function completes. @param[in] uploadWorkBufferSize Specifies the size of pUploadWorkBuffer. @return Returns the result of execution. Returns one of the following Result values. @retval Result::IsSuccess Indicates successful retrieval. @retval ResultInvalidParameter Indicates an invalid parameter. */ nn::Result Initialize(const char* url, const char* uploadFilePath, u8* pUploadWorkBuffer, s64 uploadWorkBufferSize); /*! @brief [Deprecated] Do not use. This functionality is now implemented by the Initialize(const char* url, const char* uploadFilePath, u8* pUploadWorkBuffer, s64 uploadWorkBufferSize) function. Use that function instead. @deprecated */ nn::Result Initialize(const char* url, const char* uploadFilePath); /*! @brief Specifies processing options. @param[in] option Specifies the option to set. Please contact Nintendo about the available options. @return Returns the result of execution. Returns one of the following Result values. @retval Result::IsSuccess Indicates successful retrieval. @retval ResultInvalidParameter Indicates an invalid parameter. */ nn::Result SetOption(u32 option); /*! @brief Adds the RawUL custom header to the request for sending by HTTP. This function can add headers to an HTTP request that are larger than the maximum value allowed by the AddHttpHeader function for ordinary custom headers (512 bytes). The maximum number that can be added is 1. @param[in] label Specifies the label string for the RawUL custom header being added. @param[in] value Specifies the value string for the RawUL custom header being added. @return Returns the result of execution. Returns one of the following Result values. @retval Result::IsSuccess Indicates successful retrieval. @retval ResultInvalidParameter Indicates an invalid parameter. @retval ResultAlreadyExist Indicates that a custom header has already been added. */ nn::Result AddLargeHttpHeader(const char* label, const char* value); /*! @brief Clears the RawUL custom header previously added to the HTTP request headers. */ void ClearLargeHttpHeader(void); protected: const u8* m_pUploadData; s64 m_uploadDataSize; char m_uploadFilePath[FILEFULLPATH_MAX_LENGTH_WITH_NULL]; virtual nn::Result RegisterPreprocess( nn::boss::AccountID accountId, nn::boss::TitleID titleId, const char* taskId ); private: nn::Result CopyUploadFileToBossStorage( nn::boss::AccountID accountId, nn::boss::TitleID titleId, const char* taskId ) const; void SetRawUlTaskSettingToRecord( const char* url ); virtual void RegisterPostprocess( nn::boss::AccountID accountId, nn::boss::TitleID titleId, const char* taskId, nn::Result registerResult); }; //! @} } // end of namespace boss } // end of namespace nn #endif // __cplusplus #endif /* NN_BOSS_BOSS_RAWULTASKSETTING_H_ */