1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     http_ConnectionIpc.h
4 
5   Copyright (C)2009 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 28664 $
14  *---------------------------------------------------------------------------*/
15 
16 //
17 // このファイルを編集しないでください。
18 // このファイルは自動生成されます。
19 //
20 
21 #ifndef NN_HTTP___HTTP_CONNECTIONIPC_H_
22 #define NN_HTTP___HTTP_CONNECTIONIPC_H_
23 
24 #include <nn/Handle.h>
25 #include <nn/Result.h>
26 #include <nn/types.h>
27 #include <nn/http/http_Types.h>
28 #include <nn/http/http_Const.h>
29 #include <nn/http/http_Result.h>
30 
31 
32 
33 namespace nn {
34 namespace http {
35 
36     class ConnectionIpc
37     {
38     public:
39         enum Tag
40         {
41             TAG_IPC_ERROR,
42             TAG_INITIALIZE_GENERAL_SESSION                       = 0x0001,
43             TAG_CREATE_CONNECTION                                = 0x0002,
44             TAG_DESTROY_CONNECTION                               = 0x0003,
45             TAG_CANCEL_CONNECTION                                = 0x0004,
46             TAG_GET_CONNECTION_STATUS                            = 0x0005,
47             TAG_GET_CONNECTION_PROGRESS                          = 0x0006,
48             TAG_GET_CONNECTION_ERROR                             = 0x0007,
49             TAG_INITIALIZE_CONNECTION_SESSION                    = 0x0008,
50             TAG_START_CONNECTION                                 = 0x0009,
51             TAG_START_CONNECTION_ASYNC                           = 0x000a,
52             TAG_READ_BODY                                        = 0x000b,
53             TAG_READ_BODY_WITH_TIMEOUT                           = 0x000c,
54             TAG_SET_PROXY                                        = 0x000d,
55             TAG_SET_PROXY_DEFAULT                                = 0x000e,
56             TAG_SET_BASIC_AUTHORIZATION                          = 0x000f,
57             TAG_SET_SOCKET_BUFFER_SIZE                           = 0x0010,
58             TAG_ADD_HEADER_FIELD                                 = 0x0011,
59             TAG_ADD_POST_DATA_ASCII                              = 0x0012,
60             TAG_ADD_POST_DATA_BINARY                             = 0x0013,
61             TAG_ADD_POST_DATA_RAW                                = 0x0014,
62             TAG_SET_LAZY_POST_DATA_SETTING                       = 0x0015,
63             TAG_SEND_POST_DATA_ASCII                             = 0x0016,
64             TAG_SEND_POST_DATA_ASCII_WITH_TIMEOUT                = 0x0017,
65             TAG_SEND_POST_DATA_BINARY                            = 0x0018,
66             TAG_SEND_POST_DATA_BINARY_WITH_TIMEOUT               = 0x0019,
67             TAG_SEND_POST_DATA_RAW                               = 0x001a,
68             TAG_SEND_POST_DATA_RAW_WITH_TIMEOUT                  = 0x001b,
69             TAG_SET_POST_DATA_ENCODING                           = 0x001c,
70             TAG_NOFITY_FINISH_SEND_POST_DATA                     = 0x001d,
71             TAG_GET_HEADER_FIELD                                 = 0x001e,
72             TAG_GET_HEADER_FIELD_WITH_TIMEOUT                    = 0x001f,
73             TAG_GET_HEADER_ALL                                   = 0x0020,
74             TAG_GET_HEADER_ALL_WITH_TIMEOUT                      = 0x0021,
75             TAG_GET_RESULT_CODE                                  = 0x0022,
76             TAG_GET_RESULT_CODE_WITH_TIMEOUT                     = 0x0023,
77             TAG_SET_ROOT_CA                                      = 0x0024,
78             TAG_SET_INTERNAL_ROOT_CA                             = 0x0025,
79             TAG_SET_ROOT_CA_STORE                                = 0x0026,
80             TAG_SET_CLIENT_CERT                                  = 0x0027,
81             TAG_SET_INTERNAL_CLIENT_CERT                         = 0x0028,
82             TAG_SET_CLIENT_CERT_ID                               = 0x0029,
83             TAG_GET_CONNECTION_SSL_ERROR                         = 0x002a,
84             TAG_SET_VERIFY_OPTION                                = 0x002b,
85             TAG_DISABLE_VERIFY_OPTION_FOR_DEBUG                  = 0x002c,
86             TAG_CREATE_CERT_STORE                                = 0x002d,
87             TAG_DESTROY_CERT_STORE                               = 0x002e,
88             TAG_ADD_CERT_TO_CERT_STORE                           = 0x002f,
89             TAG_ADD_INTERNAL_CERT_TO_CERT_STORE                  = 0x0030,
90             TAG_REMOVE_CERT_FROM_CERT_STORE                      = 0x0031,
91             TAG_CREATE_CLIENT_CERT                               = 0x0032,
92             TAG_CREATE_INTERNAL_CLIENT_CERT                      = 0x0033,
93             TAG_DESTROY_CLIENT_CERT                              = 0x0034,
94             TAG_SET_DEFAULT_PROXY                                = 0x0035,
95             TAG_CLEAR_DNS_CACHES                                 = 0x0036,
96             TAG_IPC_END
97         };
98 
99     private:
100         Handle m_Session;
101 
102     public:
ConnectionIpc(Handle session)103         ConnectionIpc(Handle session) : m_Session(session) {}
104 
105     public:
106         nn::Result InitializeGeneralSession( nn::Handle hSharedMemory, size_t size );
107         nn::Result CreateConnection( const char8 url[], size_t urlLen, RequestMethod reqMethod, ConnectionHandle* handleCourier );
108         nn::Result DestroyConnection( ConnectionHandle handle );
109         nn::Result CancelConnection( ConnectionHandle handle );
110         nn::Result GetConnectionStatus( ConnectionHandle handle, Status* statusCourier );
111         nn::Result GetConnectionProgress( ConnectionHandle handle, size_t* receivedSizeCourier, size_t* contentSizeCourier );
112         nn::Result GetConnectionError( ConnectionHandle handle, ResultCode* resultCodeCourier );
113         nn::Result InitializeConnectionSession( ConnectionHandle handle );
114         nn::Result StartConnection( ConnectionHandle handle );
115         nn::Result StartConnectionAsync( ConnectionHandle handle );
116         nn::Result ReadBody( ConnectionHandle handle, u8 bodyCourier[], size_t bodyCourierLen );
117         nn::Result ReadBodyWithTimeout( ConnectionHandle handle, u8 bodyCourier[], size_t bodyCourierLen, s64 timeout );
118         nn::Result SetProxy( ConnectionHandle handle, const char8 proxyName[], size_t proxyNameLen, u16 port, const char8 userName[], size_t userNameLen, const char8 password[], size_t passwordLen );
119         nn::Result SetProxyDefault( ConnectionHandle handle );
120         nn::Result SetBasicAuthorization( ConnectionHandle handle, const char8 userName[], size_t userNameLen, const char8 password[], size_t passwordLen );
121         nn::Result SetSocketBufferSize( ConnectionHandle handle, u32 bufSize );
122         nn::Result AddHeaderField( ConnectionHandle handle, const char8 label[], size_t labelLen, const char8 value[], size_t valueLen );
123         nn::Result AddPostDataAscii( ConnectionHandle handle, const char8 label[], size_t labelLen, const char8 value[], size_t valueLen );
124         nn::Result AddPostDataBinary( ConnectionHandle handle, const char8 label[], size_t labelLen, const u8 value[], size_t valueLen );
125         nn::Result AddPostDataRaw( ConnectionHandle handle, const u8 value[], size_t valueLen );
126         nn::Result SetLazyPostDataSetting( ConnectionHandle handle, PostDataType dataType );
127         nn::Result SendPostDataAscii( ConnectionHandle handle, const char8 label[], size_t labelLen, const char8 value[], size_t valueLen );
128         nn::Result SendPostDataAsciiWithTimeout( ConnectionHandle handle, const char8 label[], size_t labelLen, const char8 value[], size_t valueLen, s64 timeout );
129         nn::Result SendPostDataBinary( ConnectionHandle handle, const char8 label[], size_t labelLen, const u8 value[], size_t valueLen );
130         nn::Result SendPostDataBinaryWithTimeout( ConnectionHandle handle, const char8 label[], size_t labelLen, const u8 value[], size_t valueLen, s64 timeout );
131         nn::Result SendPostDataRaw( ConnectionHandle handle, const u8 value[], size_t valueLen );
132         nn::Result SendPostDataRawWithTimeout( ConnectionHandle handle, const u8 value[], size_t valueLen, s64 timeout );
133         nn::Result SetPostDataEncoding( ConnectionHandle handle, EncodingType encodeType );
134         nn::Result NofityFinishSendPostData( ConnectionHandle handle );
135         nn::Result GetHeaderField( ConnectionHandle handle, const char8 label[], size_t labelLen, char8 valueCourier[], size_t valueCourierLen, u32* fieldLenCourier );
136         nn::Result GetHeaderFieldWithTimeout( ConnectionHandle handle, const char8 label[], size_t labelLen, char8 valueCourier[], size_t valueCourierLen, u32* fieldLenCourier, s64 timeout );
137         nn::Result GetHeaderAll( ConnectionHandle handle, char8 headerCourier[], size_t headerCourierLen, u32* allHeaderLenCourier );
138         nn::Result GetHeaderAllWithTimeout( ConnectionHandle handle, char8 headerCourier[], size_t headerCourierLen, u32* allHeaderLenCourier, s64 timeout );
139         nn::Result GetResultCode( ConnectionHandle handle, s32* resultCodeCourier );
140         nn::Result GetResultCodeWithTimeout( ConnectionHandle handle, s32* resultCodeCourier, s64 timeout );
141         nn::Result SetRootCA( ConnectionHandle handle, const u8 rootCaData[], size_t rootCaDataLen );
142         nn::Result SetInternalRootCA( ConnectionHandle handle, InternalCaCertId inCaCertName );
143         nn::Result SetRootCaStore( ConnectionHandle handle, CertStoreId certStoreId );
144         nn::Result SetClientCert( ConnectionHandle handle, const u8 clientCertData[], size_t clientCertDataLen, const u8 privateKeyData[], size_t privateKeyDataLen );
145         nn::Result SetInternalClientCert( ConnectionHandle handle, InternalClientCertId inClientCertName );
146         nn::Result SetClientCertId( ConnectionHandle handle, CertId clientCertId );
147         nn::Result GetConnectionSslError( ConnectionHandle handle, s32* resultCodeCourier );
148         nn::Result SetVerifyOption( ConnectionHandle handle, u32 verifyOption );
149         nn::Result DisableVerifyOptionForDebug( ConnectionHandle handle, u32 verifyOption );
150         nn::Result CreateCertStore( CertStoreId* pCertId );
151         nn::Result DestroyCertStore( CertStoreId certId );
152         nn::Result AddCertToCertStore( CertStoreId certStoreId, const u8 pCertData[], size_t certDataSize, CertId* pCertId );
153         nn::Result AddInternalCertToCertStore( CertStoreId certStoreId, InternalCaCertId inCaCertName, CertId* pCertId );
154         nn::Result RemoveCertFromCertStore( CertStoreId certStoreId, CertId certId );
155         nn::Result CreateClientCert( const u8 pCertData[], size_t certDataSize, const u8 pPrivateKeyData[], size_t privateKeyDataSize, CertId* pCertId );
156         nn::Result CreateInternalClientCert( InternalClientCertId inClientCertName, CertId* pCertId );
157         nn::Result DestroyClientCert( CertId ClientCert );
158         nn::Result SetDefaultProxy( bool isEnableProxy, ProxyAuthType authType, u16 port, const char8 hostName[], size_t hostNameLen, const char8 username[], size_t usernameLen, const char8 password[], size_t passwordLen );
159         nn::Result ClearDnsCaches();
160     };
161 
162 } // end of namespace http
163 } // end of namespace nn
164 
165 
166 
167 #endif  // ifndef NN_HTTP___HTTP_CONNECTIONIPC_H_
168