/*---------------------------------------------------------------------------* Copyright (C)2009-2013 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 __NETTEST_H__ #define __NETTEST_H__ #include #ifndef IOP_BUILD #include #endif #ifdef __cplusplus extern "C" { #endif /*---------------------------------------------------------------------------* * * Constants defined for this file * -- #Defines's -- * *---------------------------------------------------------------------------*/ #define NETTEST_ROUNDUP( value, alignment ) \ ((((u32)(value)) + ((alignment)-1)) & ~((alignment)-1)) #define NETTEST_IPCBUF_SIZE 512 #define URL_STRING_LEN 192 #if defined(IOP_BUILD) #define NETTEST_PADDING_DECLARATION(dataType, padName) #else #define NETTEST_PADDING_DECLARATION(dataType, padName) \ IPC_USER_DATA_STRUCTURE_PADDING_DECLARATION(dataType, padName) #endif /*---------------------------------------------------------------------------* * * Data types defined for this file * -- Struct's, Typedef's, Enum's -- * *---------------------------------------------------------------------------*/ typedef enum { NETTEST_ERROR_OK = 0, NETTEST_ERROR_NG = -1, NETTEST_ERROR_NEED_INT = -2, NETTEST_ERROR_RETRY = -3, NETTEST_ERROR_NOMEM = -4, } NETTEST_ERROR; typedef enum { NETTEST_TEST_TYPE_HTTP_DOWNLOAD = 1, NETTEST_TEST_TYPE_SOCKET_DOWNLOAD, NETTEST_TEST_TYPE_SOCKET_CLOSE_ALL, NETTEST_TEST_TYPE_MAX, } NETTEST_TEST_TYPE; /*---------------------------------------------------------------------------* structure *---------------------------------------------------------------------------*/ typedef struct nettest_http_download_ { u8 url[URL_STRING_LEN]; u32 so_rcvbuf_size; u32 so_winscale; } PACKED_STRUCT_ATTRIBUTE ATTRIB_STRUCT_ALIGN(4) nettest_http_download_t; typedef struct nettest_http_download_reply_ { u32 curl_status_code; u32 http_status_code; u32 download_size; u32 elapsed_time; } PACKED_STRUCT_ATTRIBUTE ATTRIB_STRUCT_ALIGN(4) nettest_http_download_reply_t; typedef struct nettest_socket_download_ { u32 port; char address[16]; u32 max_recv_size; } PACKED_STRUCT_ATTRIBUTE ATTRIB_STRUCT_ALIGN(4) nettest_socket_download_t; typedef struct http_download_ctx_ { IOSIoVector iov[2]; NETTEST_PADDING_DECLARATION(IOSIoVector[4], iovPad); nettest_http_download_t args; } PACKED_STRUCT_ATTRIBUTE http_download_ctx_t; /*---------------------------------------------------------------------------* * * -- Interface Function Prototypes -- * *---------------------------------------------------------------------------*/ extern NETTEST_ERROR NETTESTInit (void); extern NETTEST_ERROR NETTESTClose (void); extern NETTEST_ERROR NETTESTHttpDownload (nettest_http_download_t* args, nettest_http_download_reply_t* reply); extern NETTEST_ERROR NETTESTSocketDownload (nettest_socket_download_t* args, nettest_http_download_reply_t* reply); extern NETTEST_ERROR NETTESTSocketCloseAll (void); extern BOOL NATF_speed_test(const char* pUrl, unsigned nTimesToDownload, unsigned nNumConnections, unsigned nMinBandwidthMbits); #ifdef __cplusplus } #endif #endif // __NETTEST_H__