From: Jinkun Jang Date: Fri, 15 Mar 2013 16:17:05 +0000 (+0900) Subject: merge with master X-Git-Tag: accepted/tizen_2.1/20130425.034729~50 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5edcc5b9260929c324077c35acceb5e47bc4c74d;p=framework%2Fosp%2Fnet.git merge with master --- diff --git a/inc/FNetDns.h b/inc/FNetDns.h index ab68924..b78a524 100755 --- a/inc/FNetDns.h +++ b/inc/FNetDns.h @@ -105,7 +105,9 @@ public: * This method is asynchronous. * * @since 2.0 - * @privilege %http://tizen.org/privilege/dns + * + * @privlevel public + * @privilege http://tizen.org/privilege/dns * * @return An error code * @param[in] hostName The DNS name of the host @@ -129,7 +131,9 @@ public: * This method is asynchronous. * * @since 2.0 - * @privilege %http://tizen.org/privilege/dns + * + * @privlevel public + * @privilege http://tizen.org/privilege/dns * * @return An error code * @param[in] ipAddress An IP address diff --git a/inc/FNetHttpHttpAuthentication.h b/inc/FNetHttpHttpAuthentication.h index 23b2d54..db1d57b 100755 --- a/inc/FNetHttpHttpAuthentication.h +++ b/inc/FNetHttpHttpAuthentication.h @@ -90,7 +90,8 @@ public: * Gets the realm value received. * * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return The realm value * @exception E_SUCCESS The method is successful. @@ -105,13 +106,14 @@ public: * Gets the authentication scheme received. * * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return The authentication scheme, @n * else @c -1 if an error occurs - * @exception E_SUCCESS The method is successful. + * @exception E_SUCCESS The method is successful. * @exception E_OUT_OF_MEMORY The memory is insufficient. - * @exception E_SYSTEM A system error has occurred. + * @exception E_SYSTEM A system error has occurred. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @remarks The specific error code can be accessed using the GetLastResult() method. */ @@ -121,7 +123,8 @@ public: * Sets the credentials required for setting the "WWW-Authenticate" header in the HttpRequest class. * * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return The new transaction pointer * @param[in] credentials The credentials diff --git a/inc/FNetHttpHttpCookieStorageManager.h b/inc/FNetHttpHttpCookieStorageManager.h index ac33e37..4349ef6 100755 --- a/inc/FNetHttpHttpCookieStorageManager.h +++ b/inc/FNetHttpHttpCookieStorageManager.h @@ -65,8 +65,9 @@ public: /** * Removes all the cookies corresponding to the requested URL from the cookie storage. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return An error code * @param[in] url The requested URL @@ -82,15 +83,16 @@ public: /** * Removes all the cookies from the cookie storage. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return An error code * @exception E_SUCCESS The method is successful. - * @exception E_INVALID_STATE The method invoked is invalid. - * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_INVALID_STATE The method invoked is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. * @exception E_SYSTEM A system error has occurred. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. */ result RemoveAllCookies(); diff --git a/inc/FNetHttpHttpCredentials.h b/inc/FNetHttpHttpCredentials.h index f00e517..90bd0f2 100755 --- a/inc/FNetHttpHttpCredentials.h +++ b/inc/FNetHttpHttpCredentials.h @@ -92,8 +92,9 @@ public: /** * Sets the user name for the current instance of %HttpCredentials. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @param[in] name The user name string * @exception E_SUCCESS The method is successful. @@ -107,8 +108,9 @@ public: /** * Sets the password for the current instance of %HttpCredentials. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @param[in] password The password string * @exception E_SUCCESS The method is successful. @@ -122,8 +124,9 @@ public: /** * Gets the user name of the current instance of %HttpCredentials. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return The user name * @exception E_SUCCESS The method is successful. @@ -137,13 +140,14 @@ public: /** * Gets the password of the current instance of %HttpCredentials. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return The password - * @exception E_SUCCESS The method is successful. + * @exception E_SUCCESS The method is successful. * @exception E_OUT_OF_MEMORY The memory is insufficient. - * @exception E_SYSTEM A system error has occurred. + * @exception E_SYSTEM A system error has occurred. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @remarks The specific error code can be accessed using the GetLastResult() method. */ diff --git a/inc/FNetHttpHttpSession.h b/inc/FNetHttpHttpSession.h index b03922c..b0a7963 100755 --- a/inc/FNetHttpHttpSession.h +++ b/inc/FNetHttpHttpSession.h @@ -100,7 +100,7 @@ public: * @since 2.0 * * @return An error code - * @param[in] sessionMode The session mode to open the session + * @param[in] sessionMode The session mode to open the session * @param[in] pProxyAddr A proxy address @n * The specified @c pProxyAddr must be a valid URL. If @c pProxyAddr is @c null, %HttpSession uses the system * default proxy address. @@ -109,14 +109,14 @@ public: * @c hostAddr is ignored (In case of multiple host mode, @c hostAddr is set to HttpRequest::SetUri()). * @param[in] pCommonHeader An instance of HttpHeader @n * This is a common header used in all the transactions included in this session. - * @param[in] flag Set to @c true if the cookies must be handled automatically, @n - * else @c false if the cookies must be handled manually + * @param[in] flag Set to @c NET_HTTP_COOKIE_FLAG_ALWAYS_AUTOMATIC if the cookies must be handled automatically, @n + * else @c NET_HTTP_COOKIE_FLAG_ALWAYS_MANUAL if the cookies must be handled manually * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG A specified input parameter is invalid. - * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_OUT_OF_MEMORY The memory is insufficient. * @exception E_INVALID_CONNECTION The net connection is invalid. - * @exception E_MAX_EXCEEDED The number of currently opened sessions has exceeded the maximum limit. - * @exception E_INVALID_PROXY The specified proxy address is invalid. + * @exception E_MAX_EXCEEDED The number of currently opened sessions has exceeded the maximum limit. + * @exception E_INVALID_PROXY The specified proxy address is invalid. * @exception E_UNKNOWN An unknown error has occurred. * @exception E_SYSTEM An internal error has occurred. * @exception E_INVALID_ADDRESS The host address is invalid. @@ -142,8 +142,8 @@ public: * The specified @c hostAddr must be a valid URL. * @param[in] pCommonHeader An instance of HttpHeader @n * This is a common header used in all the transactions included in this session. - * @param[in] flag Set to @c true if the cookies must be handled automatically, @n - * else @c false if the cookies must be handled manually + * @param[in] flag Set to @c NET_HTTP_COOKIE_FLAG_ALWAYS_AUTOMATIC if the cookies must be handled automatically, @n + * else @c NET_HTTP_COOKIE_FLAG_ALWAYS_MANUAL if the cookies must be handled manually * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG A specified input parameter is invalid. * @exception E_OUT_OF_MEMORY The memory is insufficient. @@ -170,8 +170,9 @@ public: /** * Opens a transaction. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return A pointer to a new HttpTransaction, @n * else @c null if an error occurs @@ -189,8 +190,9 @@ public: /** * Opens a transaction with authentication information. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return The pointer to a new HttpTransaction, @n * else @c null if an error occurs @@ -210,8 +212,9 @@ public: * Cancels the specified transaction. @n * This method is followed by the CloseTransaction() method. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return An error code * @param[in] httpTransaction The HttpTransaction to cancel @@ -230,8 +233,9 @@ public: /** * Closes the specified transaction. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return An error code * @param[in] httpTransaction The HttpTransaction to close @@ -250,8 +254,9 @@ public: /** * Closes all the transactions. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return An error code * @exception E_SUCCESS The method is successful. @@ -294,8 +299,9 @@ public: /** * Gets the number of active transactions in the current instance of %HttpSession. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return An integer value indicating the number of currently active transactions, @n * else @c -1 if an error occurs @@ -311,8 +317,9 @@ public: /** * Gets the maximum number of transactions, the current instance of %HttpSession can have. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return An integer value indicating the maximum number of transactions allowed @n * In NET_HTTP_SESSION_MODE_MULTIPLE_HOST mode, the return value is zero. diff --git a/inc/FNetHttpHttpTransaction.h b/inc/FNetHttpHttpTransaction.h index 108d004..4f6c4b6 100755 --- a/inc/FNetHttpHttpTransaction.h +++ b/inc/FNetHttpHttpTransaction.h @@ -102,26 +102,27 @@ public: /** * Submits the HTTP request. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return An error code - * @exception E_SUCCESS The method is successful. + * @exception E_SUCCESS The method is successful. * @exception E_OUT_OF_MEMORY The memory is insufficient. - * @exception E_INVALID_ARG A specified input parameter is invalid. @n - * At least one of Uri, Method, Header, and Body is invalid. - * @exception E_INVALID_HEADER The header is @c null. - * @exception E_INVALID_STATE The method invoked is invalid. + * @exception E_INVALID_ARG A specified input parameter is invalid. @n + * At least one of Uri, Method, Header, and Body is invalid. + * @exception E_INVALID_HEADER The header is @c null. + * @exception E_INVALID_STATE The method invoked is invalid. * @exception E_OUT_OF_RANGE The submitted data is out of range. * @exception E_MAX_EXCEEDED The number of active transactions has exceeded the maximum limit. * @exception E_INVALID_PROXY The proxy server address is invalid. - * @exception E_DNS The DNS query has failed. + * @exception E_DNS The DNS query has failed. * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. - * @exception E_EMPTY_BODY The body is empty in a POST method case. - * @exception E_INVALID_SESSION The session is invalid. - * @exception E_AUTHENTICATION The authentication has failed. - * @exception E_UNKNOWN An unknown error has occurred. - * @exception E_SYSTEM A system error has occurred. + * @exception E_EMPTY_BODY The body is empty in a POST method case. + * @exception E_INVALID_SESSION The session is invalid. + * @exception E_AUTHENTICATION The authentication has failed. + * @exception E_UNKNOWN An unknown error has occurred. + * @exception E_SYSTEM A system error has occurred. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @remarks The appropriate request header and body must be set using HttpRequest before using this method. * If the session is in a non-pipeline mode, be sure not to submit a transaction before the previous transaction is completed. @@ -132,8 +133,9 @@ public: /** * Gets the authentication information. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/http + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/http * * @return A pointer to HttpAuthentication * @exception E_SUCCESS The method is successful. @@ -306,6 +308,19 @@ public: */ result SetTimeout(int timeout); + /** + * Sets the flag to verify server certificate. (the flag is @c HTTP_CV_FLAG_AUTOMATIC by default) + * + * @since 2.1 + * + * @return An error code + * @param[in] flag Set the flag for certificate verification. + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE The method invoked is invalid. + * @exception E_SYSTEM A system error has occurred. + */ + result SetServerCertificateVerification(NetHttpCertificateVerificationFlag flag = HTTP_CV_FLAG_AUTOMATIC); + private: /** * This default constructor is intentionally declared as private so that only the platform can create an instance. diff --git a/inc/FNetHttpHttpTypes.h b/inc/FNetHttpHttpTypes.h index 44e2c90..212a9a4 100755 --- a/inc/FNetHttpHttpTypes.h +++ b/inc/FNetHttpHttpTypes.h @@ -93,47 +93,47 @@ enum HttpVersion */ enum NetHttpStatusCode { - NET_HTTP_STATUS_UNDEFINED = 0, /**< @if OSPDEPREC The undefined status @endf */ - NET_HTTP_STATUS_CONTINUE = 100, /**< @if OSPDEPREC The status code: 100 Continue @endf */ - NET_HTTP_STATUS_SWITCHING_PROTOCOLS = 101, /**< @if OSPDEPREC The status code: 101 Switching Protocols @endf */ - NET_HTTP_STATUS_OK = 200, /**< @if OSPDEPREC The status code: 200 OK @endf */ - NET_HTTP_STATUS_CREATED = 201, /**< @if OSPDEPREC The status code: 201 Created @endf */ - NET_HTTP_STATUS_ACCEPTED = 202, /**< @if OSPDEPREC The status code: 202 Accepted @endf */ - NET_HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 203, /**< @if OSPDEPREC The status code: 203 Non-Authoritative Information @endf */ - NET_HTTP_STATUS_NO_CONTENT = 204, /**< @if OSPDEPREC The status code: 204 No %Content @endf */ - NET_HTTP_STATUS_RESET_CONTENT = 205, /**< @if OSPDEPREC The status code: 205 Reset %Content @endf */ - NET_HTTP_STATUS_PARTIAL_CONTENT = 206, /**< @if OSPDEPREC The status code: 206 Partial %Content @endf */ + NET_HTTP_STATUS_UNDEFINED = 0, /**< @if OSPDEPREC The undefined status @endif */ + NET_HTTP_STATUS_CONTINUE = 100, /**< @if OSPDEPREC The status code: 100 Continue @endif */ + NET_HTTP_STATUS_SWITCHING_PROTOCOLS = 101, /**< @if OSPDEPREC The status code: 101 Switching Protocols @endif */ + NET_HTTP_STATUS_OK = 200, /**< @if OSPDEPREC The status code: 200 OK @endif */ + NET_HTTP_STATUS_CREATED = 201, /**< @if OSPDEPREC The status code: 201 Created @endif */ + NET_HTTP_STATUS_ACCEPTED = 202, /**< @if OSPDEPREC The status code: 202 Accepted @endif */ + NET_HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 203, /**< @if OSPDEPREC The status code: 203 Non-Authoritative Information @endif */ + NET_HTTP_STATUS_NO_CONTENT = 204, /**< @if OSPDEPREC The status code: 204 No %Content @endif */ + NET_HTTP_STATUS_RESET_CONTENT = 205, /**< @if OSPDEPREC The status code: 205 Reset %Content @endif */ + NET_HTTP_STATUS_PARTIAL_CONTENT = 206, /**< @if OSPDEPREC The status code: 206 Partial %Content @endif */ - NET_HTTP_STATUS_MULTIPLE_CHOICE = 300, /**< @if OSPDEPREC The status code: 300 Multiple Choices @endf */ - NET_HTTP_STATUS_MOVED_PERMANENTLY = 301, /**< @if OSPDEPREC The status code: 301 Moved Permanently @endf */ - NET_HTTP_STATUS_MOVED_TEMPORARILY = 302, /**< @if OSPDEPREC The status code: 302 Found @endf */ - NET_HTTP_STATUS_SEE_OTHER = 303, /**< @if OSPDEPREC The status code: 303 See Other @endf */ - NET_HTTP_STATUS_NOT_MODIFIED = 304, /**< @if OSPDEPREC The status code: 304 Not Modified @endf */ - NET_HTTP_STATUS_USE_PROXY = 305, /**< @if OSPDEPREC The status code: 305 Use Proxy @endf */ + NET_HTTP_STATUS_MULTIPLE_CHOICE = 300, /**< @if OSPDEPREC The status code: 300 Multiple Choices @endif */ + NET_HTTP_STATUS_MOVED_PERMANENTLY = 301, /**< @if OSPDEPREC The status code: 301 Moved Permanently @endif */ + NET_HTTP_STATUS_MOVED_TEMPORARILY = 302, /**< @if OSPDEPREC The status code: 302 Found @endif */ + NET_HTTP_STATUS_SEE_OTHER = 303, /**< @if OSPDEPREC The status code: 303 See Other @endif */ + NET_HTTP_STATUS_NOT_MODIFIED = 304, /**< @if OSPDEPREC The status code: 304 Not Modified @endif */ + NET_HTTP_STATUS_USE_PROXY = 305, /**< @if OSPDEPREC The status code: 305 Use Proxy @endif */ - NET_HTTP_STATUS_BAD_REQUEST = 400, /**< @if OSPDEPREC The status code: 400 Bad Request @endf */ - NET_HTTP_STATUS_UNAUTHORIZED = 401, /**< @if OSPDEPREC The status code: 401 Unauthorized @endf */ - NET_HTTP_STATUS_PAYMENT_REQUIRED = 402, /**< @if OSPDEPREC The status code: 402 Payment Required @endf */ - NET_HTTP_STATUS_FORBIDDEN = 403, /**< @if OSPDEPREC The status code: 403 Forbidden @endf */ - NET_HTTP_STATUS_NOT_FOUND = 404, /**< @if OSPDEPREC The status code: 404 Not Found @endf */ - NET_HTTP_STATUS_METHOD_NOT_ALLOWED = 405, /**< @if OSPDEPREC The status code: 405 Method Not Allowed @endf */ - NET_HTTP_STATUS_NOT_ACCEPTABLE = 406, /**< @if OSPDEPREC The status code: 406 Not Acceptable @endf */ - NET_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 407, /**< @if OSPDEPREC The status code: 407 Proxy Authentication Required @endf */ - NET_HTTP_STATUS_REQUEST_TIME_OUT = 408, /**< @if OSPDEPREC The status code: 408 Request Timeout (not used) @endf */ - NET_HTTP_STATUS_CONFLICT = 409, /**< @if OSPDEPREC The status code: 409 Conflict @endf */ - NET_HTTP_STATUS_GONE = 410, /**< @if OSPDEPREC The status code: 410 Gone @endf */ - NET_HTTP_STATUS_LENGTH_REQUIRED = 411, /**< @if OSPDEPREC The status code: 411 Length Required @endf */ - NET_HTTP_STATUS_PRECONDITION_FAILED = 412, /**< @if OSPDEPREC The status code: 412 Precondition Failed @endf */ - NET_HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE = 413, /**< @if OSPDEPREC The status code: 413 Request Entity Too Large (not used) @endf */ - NET_HTTP_STATUS_REQUEST_URI_TOO_LARGE = 414, /**< @if OSPDEPREC The status code: 414 Request-URI Too Long (not used) @endf */ - NET_HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415, /**< @if OSPDEPREC The status code: 415 Unsupported %Media Type @endf */ + NET_HTTP_STATUS_BAD_REQUEST = 400, /**< @if OSPDEPREC The status code: 400 Bad Request @endif */ + NET_HTTP_STATUS_UNAUTHORIZED = 401, /**< @if OSPDEPREC The status code: 401 Unauthorized @endif */ + NET_HTTP_STATUS_PAYMENT_REQUIRED = 402, /**< @if OSPDEPREC The status code: 402 Payment Required @endif */ + NET_HTTP_STATUS_FORBIDDEN = 403, /**< @if OSPDEPREC The status code: 403 Forbidden @endif */ + NET_HTTP_STATUS_NOT_FOUND = 404, /**<@if OSPDEPREC The status code: 404 Not Found @endif */ + NET_HTTP_STATUS_METHOD_NOT_ALLOWED = 405, /**< @if OSPDEPREC The status code: 405 Method Not Allowed @endif */ + NET_HTTP_STATUS_NOT_ACCEPTABLE = 406, /**< @if OSPDEPREC The status code: 406 Not Acceptable @endif */ + NET_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 407, /**< @if OSPDEPREC The status code: 407 Proxy Authentication Required @endif */ + NET_HTTP_STATUS_REQUEST_TIME_OUT = 408, /**< @if OSPDEPREC The status code: 408 Request Timeout (not used) @endif */ + NET_HTTP_STATUS_CONFLICT = 409, /**<@if OSPDEPREC The status code: 409 Conflict @endif */ + NET_HTTP_STATUS_GONE = 410, /**< @if OSPDEPREC The status code: 410 Gone @endif */ + NET_HTTP_STATUS_LENGTH_REQUIRED = 411, /**< @if OSPDEPREC The status code: 411 Length Required @endif */ + NET_HTTP_STATUS_PRECONDITION_FAILED = 412, /**<@if OSPDEPREC The status code: 412 Precondition Failed @endif */ + NET_HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE = 413, /**< @if OSPDEPREC The status code: 413 Request Entity Too Large (not used) @endif */ + NET_HTTP_STATUS_REQUEST_URI_TOO_LARGE = 414, /**< @if OSPDEPREC The status code: 414 Request-URI Too Long (not used) @endif */ + NET_HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415, /**< @if OSPDEPREC The status code: 415 Unsupported %Media Type @endif */ - NET_HTTP_STATUS_INTERNAL_SERVER_ERROR = 500, /**< @if OSPDEPREC The status code: 500 Internal Server Error @endf */ - NET_HTTP_STATUS_NOT_IMPLEMENTED = 501, /**< @if OSPDEPREC The status code: 501 Not Implemented @endf */ - NET_HTTP_STATUS_BAD_GATEWAY = 502, /**< @if OSPDEPREC The status code: 502 Bad Gateway @endf */ - NET_HTTP_STATUS_SERVICE_UNAVAILABLE = 503, /**< @if OSPDEPREC The status code: 503 Service Unavailable @endf */ - NET_HTTP_STATUS_GATEWAY_TIME_OUT = 504, /**< @if OSPDEPREC The status code: 504 Gateway Timeout @endf */ - NET_HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED = 505 /**< @if OSPDEPREC The status code: 505 HTTP Version Not Supported @endf */ + NET_HTTP_STATUS_INTERNAL_SERVER_ERROR = 500, /**< @if OSPDEPREC The status code: 500 Internal Server Error @endif */ + NET_HTTP_STATUS_NOT_IMPLEMENTED = 501, /**< @if OSPDEPREC The status code: 501 Not Implemented @endif */ + NET_HTTP_STATUS_BAD_GATEWAY = 502, /**< @if OSPDEPREC The status code: 502 Bad Gateway @endif */ + NET_HTTP_STATUS_SERVICE_UNAVAILABLE = 503, /**< @if OSPDEPREC The status code: 503 Service Unavailable @endif */ + NET_HTTP_STATUS_GATEWAY_TIME_OUT = 504, /**< @if OSPDEPREC The status code: 504 Gateway Timeout @endif */ + NET_HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED = 505 /**< @if OSPDEPREC The status code: 505 HTTP Version Not Supported @endif */ }; /** @@ -420,5 +420,19 @@ enum NetHttpCookieFlag NET_HTTP_COOKIE_FLAG_ALWAYS_MANUAL /**< The cookie will be handled by the user action with Tizen::Net::Http::HttpRequest::SetCookie() and Tizen::Net::Http::HttpCookieStorageManager::GetCookies() */ }; +/** + * @enum NetHttpCertificateVerificationFlag + * + * Defines the certificate verification mode. + * + * @since 2.1 + */ +enum NetHttpCertificateVerificationFlag +{ + HTTP_CV_FLAG_AUTOMATIC, /**< The certificate will be verified by system. If server certificate is invalid, the IHttpTransactionEventListener::OnTransactionCertVerificationRequiredN() listener is received. */ + HTTP_CV_FLAG_MANUAL, /**< The certificate verification will be handled by user action when the IHttpTransactionEventListener::OnTransactionCertVerificationRequestedN() listener is received. */ + HTTP_CV_FLAG_IGNORED, /**< The certificate verification will be ignored. */ +}; + } } } //Tizen::Net::Http #endif // _FNET_HTTP_HTTP_TYPES_H_ diff --git a/inc/FNetHttpIHttpTransactionEventListener.h b/inc/FNetHttpIHttpTransactionEventListener.h index 721ea84..d485fb2 100755 --- a/inc/FNetHttpIHttpTransactionEventListener.h +++ b/inc/FNetHttpIHttpTransactionEventListener.h @@ -25,8 +25,10 @@ #ifndef _FNET_HTTP_IHTTP_TRANSACTION_EVENT_LISTENER_H_ #define _FNET_HTTP_IHTTP_TRANSACTION_EVENT_LISTENER_H_ +#include #include #include +#include #include namespace Tizen { namespace Net { namespace Http @@ -154,6 +156,25 @@ public: */ virtual void OnTransactionCertVerificationRequiredN(HttpSession& httpSession, HttpTransaction& httpTransaction, Tizen::Base::String* pCert) = 0; + /** + * Called to notify when the server certificate verification has been requested. + * + * @since 2.1 + * @return The result for certificate verification. + * + * @param[in] httpSession The session information of the %Http transaction event + * @param[in] httpTransaction The transaction information of the %Http transaction event + * @param[in] pCertList The server certificate chain. An IList whose element is of the type Tizen::Security::Cert::X509Certificate *. + * + * @remarks Do not delete instance of @c httpSession or @c httpTransaction in this listener before the IHttpTransactionEventListener::OnTransactionCompleted() or IHttpTransactionEventListener::OnTransactionAborted() method is called. + * @see HttpTransaction::SetServerCertificateVerification() + */ + virtual bool OnTransactionCertVerificationRequestedN(HttpSession& httpSession, HttpTransaction& httpTransaction, Tizen::Base::Collection::IList* pCertList) + { + std::unique_ptr upCertList(pCertList); + return false; + } + protected: // // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application. @@ -164,15 +185,6 @@ protected: // virtual void IHttpTransactionEventListener_Reserved1(void) {} - // - // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application. - // - // This method is reserved and may change its name at any time without prior notice. - // - // @since 2.0 - // - virtual void IHttpTransactionEventListener_Reserved2(void) {} - }; } } } // Tizen::Net::Http diff --git a/inc/FNetIp4Address.h b/inc/FNetIp4Address.h old mode 100644 new mode 100755 index a2cacd7..7f1b156 --- a/inc/FNetIp4Address.h +++ b/inc/FNetIp4Address.h @@ -96,7 +96,8 @@ public: * @exception E_SUCCESS The instance is created successfully. * @exception E_INVALID_ARG The specified @c ipAddr is invalid. * @remarks The GetLastResult() method is used to check whether the %Ip4Address instance is created successfully. - * @see IpAddress::NetworkToHostOrder(), IpAddress::HostToNetworkOrder() + * @see IpAddress::NetworkToHostOrder() + * @see IpAddress::HostToNetworkOrder() */ Ip4Address(unsigned long ipAddr); @@ -152,7 +153,8 @@ public: * @param[out] ipAddr An unsigned @c long integer containing the raw IP address * @exception E_SUCCESS The method is successful. * @exception E_INVALID_STATE This instance is in an invalid state. - * @see IpAddress::NetworkToHostOrder(), IpAddress::HostToNetworkOrder() + * @see IpAddress::NetworkToHostOrder() + * @see IpAddress::HostToNetworkOrder() */ result GetAddress(unsigned long& ipAddr) const; diff --git a/inc/FNetNetAccountInfo.h b/inc/FNetNetAccountInfo.h old mode 100644 new mode 100755 index a057fbc..904127f --- a/inc/FNetNetAccountInfo.h +++ b/inc/FNetNetAccountInfo.h @@ -191,7 +191,8 @@ public: * @return The address scheme * @exception E_SUCCESS The method is successful. * @remarks The specific error code can be accessed using the GetLastResult() method. - * @see SetLocalAddress(), GetLocalAddress() + * @see SetLocalAddress() + * @see GetLocalAddress() */ NetAddressScheme GetLocalAddressScheme(void) const; @@ -233,7 +234,9 @@ public: * @return The address scheme for the DNS * @exception E_SUCCESS The method is successful. * @remarks The specific error code can be accessed using the GetLastResult() method. - * @see GetPrimaryDnsAddress(), GetSecondaryDnsAddress(), SetDnsAddress() + * @see GetPrimaryDnsAddress() + * @see GetSecondaryDnsAddress() + * @see SetDnsAddress() */ NetAddressScheme GetDnsAddressScheme(void) const; @@ -282,7 +285,8 @@ public: * @param[in] pSecondaryDnsAddress The statically assigned secondary DNS address if @c dnsAddrScheme is NET_ADDRESS_SCHEME_STATIC * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG A specified input parameter is invalid. - * @see GetPrimaryDnsAddress(), GetSecondaryDnsAddress() + * @see GetPrimaryDnsAddress() + * @see GetSecondaryDnsAddress() */ result SetDnsAddress(NetAddressScheme dnsAddrScheme, const IpAddress* pPrimaryDnsAddress, const IpAddress* pSecondaryDnsAddress); diff --git a/inc/FNetNetAccountManager.h b/inc/FNetNetAccountManager.h index b0bdeba..12394f4 100755 --- a/inc/FNetNetAccountManager.h +++ b/inc/FNetNetAccountManager.h @@ -85,7 +85,9 @@ public: * Creates a new network account. * * @since 2.0 - * @privilege %http://tizen.org/privilege/network.account + * + * @privlevel public + * @privilege http://tizen.org/privilege/network.account * * @return The @c NetAccountId assigned by the creation of a new network account, @n * else @c INVALID_HANDLE if an error occurs @@ -99,7 +101,9 @@ public: * @remarks This method creates a new network account and returns a @c NetAccountId value that can be used in method calls later to operate on the * account. If @c INVALID_HANDLE is returned, the specific error code can be accessed using the GetLastResult() method. A Wi-Fi account * cannot be created using %NetAccountManager. - * @see GetNetAccountInfoN(), UpdateNetAccount(), DeleteNetAccount() + * @see GetNetAccountInfoN() + * @see UpdateNetAccount() + * @see DeleteNetAccount() */ NetAccountId CreateNetAccount(NetAccountInfo& netAccountInfo); @@ -108,7 +112,9 @@ public: * If the account is read-only or in service, the deletion fails. The Wi-Fi accounts cannot be deleted by %NetAccountManager. * * @since 2.0 - * @privilege %http://tizen.org/privilege/network.account + * + * @privlevel public + * @privilege http://tizen.org/privilege/network.account * * @return An error code * @param[in] netAccountId A NetAccountId instance containing valid account information @@ -119,7 +125,9 @@ public: * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @remarks If the network account is created by another application, this method fails. * This method must use a warning pop-up to notify the user. - * @see CreateNetAccount(), GetNetAccountInfoN(), UpdateNetAccount() + * @see CreateNetAccount() + * @see GetNetAccountInfoN() + * @see UpdateNetAccount() */ result DeleteNetAccount(NetAccountId netAccountId); @@ -127,7 +135,9 @@ public: * Updates an existing network account. * * @since 2.0 - * @privilege %http://tizen.org/privilege/network.account + * + * @privlevel public + * @privilege http://tizen.org/privilege/network.account * * @return An error code * @param[in] netAccountInfo A NetAccountInfo instance containing network information to update an account @@ -143,27 +153,30 @@ public: * Before calling this method, the user must call GetNetAccountInfoN() to get the latest information in the registry * and change the desired fields of that information. * This method must use a warning pop-up to notify the user. - * @see CreateNetAccount(), GetNetAccountInfoN(), UpdateNetAccount(), DeleteNetAccount() + * @see CreateNetAccount() + * @see GetNetAccountInfoN() + * @see UpdateNetAccount() + * @see DeleteNetAccount() */ result UpdateNetAccount(const NetAccountInfo& netAccountInfo); /** - * @if VISPARTNER-MANUFACTURER * Updates an existing system network account. * - * @since 2.0 - * @visibility partner-manufacturer - * @privilege %http://tizen.org/privilege/networkmanager - * - * @return An error code - * @param[in] netAccountInfo A NetAccountInfo instance containing network information to update an account - * @exception E_SUCCESS The method is successful. - * @exception E_INVALID_ARG The specified input parameter is invalid. - * @exception E_INVALID_ACCOUNT The input account ID is invalid. - * @exception E_OPERATION_FAILED This request operation has failed due to an internal error. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * @see GetNetAccountInfoN(), UpdateNetAccount() - * @endif + * @since 2.0 + * + * @privlevel platform + * @privilege http://tizen.org/privilege/networkmanager + * + * @return An error code + * @param[in] netAccountInfo A NetAccountInfo instance containing network information to update an account + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified input parameter is invalid. + * @exception E_INVALID_ACCOUNT The input account ID is invalid. + * @exception E_OPERATION_FAILED This request operation has failed due to an internal error. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @see GetNetAccountInfoN() + * @see UpdateNetAccount() */ result UpdateSystemNetAccount(const NetAccountInfo& netAccountInfo); @@ -188,7 +201,9 @@ public: * To determine the type of instance returned, use the GetBearerType() method. * The instance can then be cast down to %WifiNetAccountInfo and used in a NET_BEARER_WIFI case. If the * application gets the last result by E_INVALID_PROXY, it must use a warning pop-up to notify the user. - * @see CreateNetAccount(), UpdateNetAccount(), DeleteNetAccount() + * @see CreateNetAccount() + * @see UpdateNetAccount() + * @see DeleteNetAccount() */ NetAccountInfo* GetNetAccountInfoN(NetAccountId netAccountId) const; @@ -251,14 +266,12 @@ public: NetAccountId GetNetAccountId(NetBearerType netBearerType = NET_BEARER_PS) const; /** - * @if VISPARTNER - * * Gets a network account, which is set for the application like email, IM, and so on. * * @since 2.0 * - * @visibility partner - * @privilege %http://tizen.org/privilege/customnetaccount + * @privlevel partner + * @privilege http://tizen.org/privilege/customnetaccount * * @return The @c NetAccountID with the specified name, @n * else INVALID_HANDLE is returned in case of an error or if %NetAccountInfo is not found @@ -268,19 +281,16 @@ public: * @exception E_SYSTEM An internal error has occurred. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @remarks The specific error code can be accessed using the GetLastResult() method. - * @endif */ NetAccountId GetAppNetAccountId(const Tizen::Base::String& netProfileName) const; /** - * @if VISPARTNER - * * Sets the application-wise default account ID to the one specified by the input argument value. * * @since 2.0 * - * @visibility partner - * @privilege %http://tizen.org/privilege/customnetaccount + * @privlevel partner + * @privilege http://tizen.org/privilege/customnetaccount * * @return An error code * @param[in] netAccountId The network account ID @@ -288,8 +298,6 @@ public: * @exception E_INVALID_ARG The specified @c netAccountId is invalid. * @exception E_SYSTEM An internal error has occurred. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * - * @endif */ result SetNetAccountId(NetAccountId netAccountId); @@ -316,7 +324,9 @@ public: * @brief [Deprecated] * @deprecated This method is deprecated because it is moved to the NetConnectionManager class. * @since 2.0 - * @privilege %http://tizen.org/privilege/network.connection + * + * @privlevel public + * @privilege http://tizen.org/privilege/network.connection * * @return An error code * @param[in] netPreference The preferred network diff --git a/inc/FNetNetConnection.h b/inc/FNetNetConnection.h index 58532d7..d933b57 100755 --- a/inc/FNetNetConnection.h +++ b/inc/FNetNetConnection.h @@ -155,7 +155,9 @@ public: * Starts the network connection. * * @since 2.0 - * @privilege %http://tizen.org/privilege/network.connection + * + * @privlevel public + * @privilege http://tizen.org/privilege/network.connection * * @return An error code * @exception E_SUCCESS The method is successful. @@ -177,7 +179,9 @@ public: * Stops the network connection. * * @since 2.0 - * @privilege %http://tizen.org/privilege/network.connection + * + * @privlevel public + * @privilege http://tizen.org/privilege/network.connection * * @return An error code * @exception E_SUCCESS The method is successful. @@ -190,7 +194,8 @@ public: * @remarks This method stops the network connection of an application. Additionally, it does not ensure immediate disconnection of the network * service (for example, 3G data service or Wi-Fi). The network service remains active till all the applications stop using the network * connection. Once stopped, the network connection can be restarted using the Start() method. - * @see Start(), Close() + * @see Start() + * @see Close() */ result Stop(void); @@ -200,7 +205,9 @@ public: * with a remote server or gateway. * * @since 2.0 - * @privilege %http://tizen.org/privilege/network.connection + * + * @privlevel public + * @privilege http://tizen.org/privilege/network.connection * * @return An error code * @exception E_SUCCESS The method is successful. diff --git a/inc/FNetNetConnectionManager.h b/inc/FNetNetConnectionManager.h index ea77ea0..c00998c 100755 --- a/inc/FNetNetConnectionManager.h +++ b/inc/FNetNetConnectionManager.h @@ -121,7 +121,9 @@ public: * Sets the preferred network. * * @since 2.0 - * @privilege %http://tizen.org/privilege/network.connection + * + * @privlevel public + * @privilege http://tizen.org/privilege/network.connection * * @return An error code * @param[in] netPreference The preferred network diff --git a/inc/FNetNetStatistics.h b/inc/FNetNetStatistics.h index 7942843..eb41244 100755 --- a/inc/FNetNetStatistics.h +++ b/inc/FNetNetStatistics.h @@ -81,18 +81,20 @@ public: * Gets the statistical information. @n * This can consist of details such as the call duration, the sent and received size, and so on. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/network.statistics.read + * @since 2.0 + * + * @privlevel public + * @privilege http://tizen.org/privilege/network.statistics * - * @return The number of bytes sent or received, @n - * else @c INVALID_HANDLE if an error occurs - * @param[in] bearerType The bearer type of the data call operation @n + * @return The number of bytes sent or received, @n + * else @c INVALID_HANDLE if an error occurs + * @param[in] bearerType The bearer type of the data call operation @n * NET_BEARER_WIFI_DIRECT and NET_BEARER_USB are not supported. - * @param[in] netStatType The type of statistical information to get - * @exception E_SUCCESS The method is successful. - * @exception E_INVALID_ARG A specified input parameter is invalid. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * @remarks The specific error code can be accessed using the GetLastResult() method. + * @param[in] netStatType The type of statistical information to get + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @remarks The specific error code can be accessed using the GetLastResult() method. */ long long GetNetStatisticsInfo(NetBearerType bearerType, NetStatisticsInfoType netStatType) const; @@ -100,7 +102,9 @@ public: * Resets the specified statistical information on the network according to the operation mode. * * @since 2.0 - * @privilege %http://tizen.org/privilege/network.statistics.write + * + * @privlevel platform + * @privilege http://tizen.org/privilege/netstatisticsmanager * * @return An error code * @param[in] bearerType The bearer type (OperationMode) whose statistical information is reset @n NET_BEARER_WIFI_DIRECT and NET_BEARER_USB are not supported. @@ -118,7 +122,9 @@ public: * Resets all the specified statistical information on the network according to the operation mode. * * @since 2.0 - * @privilege %http://tizen.org/privilege/network.statistics.write + * + * @privlevel platform + * @privilege http://tizen.org/privilege/netstatisticsmanager * * @return An error code * @param[in] bearerType The bearer type (OperationMode) whose statistical information would be reset @n NET_BEARER_WIFI_DIRECT and NET_BEARER_USB are not supported. diff --git a/inc/FNetNetTypes.h b/inc/FNetNetTypes.h index 337839b..e395bac 100644 --- a/inc/FNetNetTypes.h +++ b/inc/FNetNetTypes.h @@ -196,17 +196,11 @@ enum NetNapAuthType }; /** - * @if VISPARTNER-MANUFACTURER - * * @enum NetProxyType * * Defines the proxy type of the network * * @since 2.0 - * - * @visibility partner-manufacturer - * - * @endif */ enum NetProxyType { diff --git a/inc/FNetSockSecureSocket.h b/inc/FNetSockSecureSocket.h index b8e566a..73510e3 100755 --- a/inc/FNetSockSecureSocket.h +++ b/inc/FNetSockSecureSocket.h @@ -192,7 +192,8 @@ public: * Use Ioctl() (with NET_SOCKET_FIONBIO) to use a %SecureSocket in the blocking mode. * * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @param[in] netConnection A run-time session where a %SecureSocket instance is used @@ -236,7 +237,8 @@ public: * Use Ioctl() (with NET_SOCKET_FIONBIO) to use a %SecureSocket in the blocking mode. * * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @param[in] addressFamily A ::NetSocketAddressFamily value @@ -278,7 +280,8 @@ public: * All the resources associated with the secure socket are freed. * * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @exception E_SUCCESS The method is successful. @@ -299,12 +302,13 @@ public: * @if OSPCOMPAT * @brief [Compatibility] * @endif - * @since 2.0 + * @since 2.0 * @if OSPCOMPAT * @compatibility This method has compatibility issues with OSP compatible applications. @n * For more information, see @ref SecureSocketConnectPage "here". * @endif - * @privilege %http://tizen.org/privilege/socket + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @param[in] remoteEndPoint An instance of NetEndPoint representing the remote device @@ -337,11 +341,11 @@ public: * @page SecureSocketConnectPage Compatibility for Connect() * * @section SecureSocketConnectPageIssueSection Issues - * Implementing this method in OSP compatible applications has the following issues: @n + * Implementation of this method in %Tizen API versions prior to 2.1 has the following issue: @n * -# If the application provides a loopback address in NetEndPoint, it returns E_SYSTEM. * * @section SecureSocketConnectPageResolutionSection Resolutions - * This issue has been resolved in Tizen. @n + * The issue mentioned above is resolved in %Tizen API version 2.1 as follows: @n * -# If the application provides a loopback address in NetEndPoint, it returns E_SUCCESS instead of E_SYSTEM. */ @@ -474,8 +478,9 @@ public: /** * Binds the secure socket to a local address. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @param[in] localEndPoint The local NetEndPoint to associate with the secure socket @@ -499,8 +504,9 @@ public: /** * Places the secure socket in a listening state. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @param[in] backLog The maximum length of the pending connections queue @@ -528,23 +534,24 @@ public: * creates a new secure socket with the same socket type, protocol type, and protocol family * as the listening secure socket. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return A new secure socket for a newly created connection with the same socket type, protocol type, and protocol family, @n * else @c null if an error occurs * @exception E_SUCCESS The method is successful. * @exception E_WOULD_BLOCK A non-blocking secure socket operation cannot be completed immediately. * @exception E_INVALID_CERTIFICATE The server certificate verification has failed on client. - * @exception E_CERTIFICATE_VERIFICATION_FAILED The client certificate verification has failed. + * @exception E_CERTIFICATE_VERIFICATION_FAILED The client certificate verification has failed. * @exception E_INVALID_SOCKET The secure socket is invalid. * @exception E_INVALID_STATE The secure socket is not in a valid state. * @exception E_UNSUPPORTED_OPTION This operation is not supported for this socket. * @exception E_NETWORK_UNAVAILABLE The network is unavailable. * @exception E_TIMEOUT An attempt to connect to the server has timed out. - * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_OUT_OF_MEMORY The memory is insufficient. * @exception E_SYSTEM A system error has occurred. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @remarks Before calling this method, the Listen() method must be called first * to listen for and queue the incoming connection requests. * In the blocking mode, this method blocks until an incoming connection attempt @@ -560,7 +567,8 @@ public: * Executes the specified command on the socket. * * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @param[in] cmd The command to execute on the secure socket diff --git a/inc/FNetSockSocket.h b/inc/FNetSockSocket.h index 0c04ac9..8969e22 100755 --- a/inc/FNetSockSocket.h +++ b/inc/FNetSockSocket.h @@ -76,8 +76,9 @@ public: * The socket is initialized in a non-blocking mode by default. * Use Ioctl() (with NET_SOCKET_FIONBIO) to use a %Socket in the blocking mode. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @param[in] netConnection A run-time session where a %Socket instance is used @@ -86,17 +87,17 @@ public: * @param[in] protocol A ::NetSocketProtocol value * @exception E_SUCCESS The method is successful. * @exception E_WOULD_BLOCK A non-blocking socket operation cannot be completed immediately. - * @exception E_OUT_OF_MEMORY The memory is insufficient. - * @exception E_MAX_EXCEEDED All sockets are in use. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_MAX_EXCEEDED All sockets are in use. * @exception E_UNSUPPORTED_OPTION This operation is not supported for this socket. * @exception E_INVALID_ARG A specified input parameter is invalid. - * @exception E_UNSUPPORTED_PROTOCOL The protocol is not supported. - * @exception E_UNSUPPORTED_TYPE The socket type is not supported. + * @exception E_UNSUPPORTED_PROTOCOL The protocol is not supported. + * @exception E_UNSUPPORTED_TYPE The socket type is not supported. * @exception E_UNSUPPORTED_FAMILY The address family is not supported. * @exception E_SYSTEM A system error has occurred. * @exception E_INVALID_CONNECTION The network connection is invalid. * @exception E_FAILURE The method has failed. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @remarks The @c netConnection parameter specifies a run-time network connection. @n * The @c addressFamily parameter specifies an address family. @n * The @c socketType parameter specifies the type of the socket. @n @@ -126,8 +127,9 @@ public: * The socket is initialized in a non-blocking mode by default. * Use Ioctl() (with NET_SOCKET_FIONBIO) to use a %Socket in the blocking mode. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @param[in] addressFamily A ::NetSocketAddressFamily value @@ -174,8 +176,9 @@ public: * Closes the socket. @n * All the resources associated with the socket are freed. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @exception E_SUCCESS The method is successful. @@ -202,7 +205,8 @@ public: * @compatibility This method has compatibility issues with OSP compatible applications. @n * For more information, see @ref SocketConnectPage "here". * @endif - * @privilege %http://tizen.org/privilege/socket + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @param[in] remoteEndPoint An instance of NetEndPoint representing the remote device @@ -232,11 +236,11 @@ public: * @page SocketConnectPage Compatibility for Connect() * * @section SocketConnectPageIssueSection Issues - * Implementing this method in OSP compatible applications has the following issues: @n + * Implementation of this method in %Tizen API versions prior to 2.1 has the following issue: @n * -# If the application provides a loopback address in NetEndPoint, it returns E_SYSTEM. * * @section SocketConnectPageResolutionSection Resolutions - * This issue has been resolved in Tizen. @n + * The issue mentioned above is resolved in %Tizen API version 2.1 as follows: @n * -# If the application provides a loopback address in NetEndPoint, it returns E_SUCCESS instead of E_SYSTEM. */ @@ -354,11 +358,11 @@ public: * @page SocketSendToPage1 Compatibility for SendTo() * * @section SocketSendToPage1IssueSection Issues - * Implementing this method in OSP compatible applications has the following issues: @n + * Implementation of this method in %Tizen API versions prior to 2.1 has the following issue: @n * -# If the application provides a loopback address in NetEndPoint, it returns E_SYSTEM. * * @section SocketSendToPage1ResolutionSection Resolutions - * This issue has been resolved in Tizen. @n + * The issue mentioned above is resolved in %Tizen API version 2.1 as follows: @n * -# If the application provides a loopback address in NetEndPoint, it returns E_SUCCESS instead E_SYSTEM. */ @@ -403,11 +407,11 @@ public: * @page SocketSendToPage2 Compatibility for SendTo() * * @section SocketSendToPage2IssueSection Issues - * Implementing this method in OSP compatible applications has the following issues: @n + * Implementation of this method in %Tizen API versions prior to 2.1 has the following issue: @n * -# If the application provides a loopback address in NetEndPoint, it returns E_SYSTEM. * * @section SocketSendToPage2ResolutionSection Resolutions - * This issue has been resolved in Tizen. @n + * The issue mentioned above is resolved in %Tizen API version 2.1 as follows: @n * -# If the application provides a loopback address in NetEndPoint, it returns E_SUCCESS instead of E_SYSTEM. */ @@ -513,11 +517,11 @@ public: * @page SocketReceiveFromPage1 Compatibility for ReceiveFrom() * * @section SocketReceiveFromPage1IssueSection Issues - * Implementing this method in OSP compatible applications has the following issues: @n + * Implementation of this method in %Tizen API versions prior to 2.1 has the following issue: @n * -# If the application provides a loopback address in NetEndPoint, it returns E_SYSTEM. * * @section SocketReceiveFromPage1ResolutionSection Resolutions - * This issue has been resolved in Tizen. @n + * The issue mentioned above is resolved in %Tizen API version 2.1 as follows: @n * -# If the application provides a loopback address in NetEndPoint, it returns E_SUCCESS instead of E_SYSTEM. */ @@ -567,19 +571,20 @@ public: * @page SocketReceiveFromPage2 Compatibility for ReceiveFrom() * * @section SocketReceiveFromPage2IssueSection Issues - * Implementing this method in OSP compatible applications has the following issues: @n + * Implementation of this method in %Tizen API versions prior to 2.1 has the following issue: @n * -# If the application provides a loopback address in NetEndPoint, it returns E_SYSTEM. * * @section SocketReceiveFromPage2ResolutionSection Resolutions - * This issue has been resolved in Tizen. @n + * The issue mentioned above is resolved in %Tizen API version 2.1 as follows: @n * -# If the application provides a loopback address in NetEndPoint, it returns E_SUCCESS instead of E_SYSTEM. */ /** * Binds the socket to a local address. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @param[in] localEndPoint The local NetEndPoint to associate with the socket @@ -603,8 +608,9 @@ public: /** * Places the socket in a listening state. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @param[in] backLog The maximum length of the pending connections queue @@ -632,8 +638,9 @@ public: * creates a new socket with the same socket type, protocol type, and protocol family * as the listening socket. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return A new socket for a newly created connection with the same socket type, protocol type, and protocol family, @n * else @c null if an error occurs @@ -661,8 +668,9 @@ public: /** * Executes the specified command on the socket. * - * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @since 2.0 + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @param[in] cmd The command to execute on the socket diff --git a/inc/FNetSockSocketUtility.h b/inc/FNetSockSocketUtility.h index 12208ca..660deb5 100755 --- a/inc/FNetSockSocketUtility.h +++ b/inc/FNetSockSocketUtility.h @@ -80,12 +80,13 @@ public: * Determines the status of one or more sockets. * * @since 2.0 - * @privilege %http://tizen.org/privilege/socket + * @privlevel public + * @privilege http://tizen.org/privilege/socket * * @return An error code * @param[in,out] pCheckRead An IList of Socket instances to check for readability - * @param[in,out] pCheckWrite An IList of Socket instances to check for writability - * @param[in,out] pCheckError An IList of Socket instances to check for errors + * @param[in,out] pCheckWrite An IList of Socket instances to check for writability + * @param[in,out] pCheckError An IList of Socket instances to check for errors * @param[in] microSeconds The time to wait for a response, in microseconds * @exception E_SUCCESS The method is successful. * @exception E_INVALID_SOCKET The socket is invalid. diff --git a/inc/FNetWifiIWifiDirectDeviceListener.h b/inc/FNetWifiIWifiDirectDeviceListener.h index cc41e8b..dfe9e76 100644 --- a/inc/FNetWifiIWifiDirectDeviceListener.h +++ b/inc/FNetWifiIWifiDirectDeviceListener.h @@ -25,6 +25,7 @@ #include #include +#include namespace Tizen { namespace Base { namespace Collection { @@ -35,7 +36,6 @@ namespace Tizen { namespace Net { namespace Wifi { class WifiDirectGroupInfo; class WifiDirectDeviceInfo; -class WifiDirectGroupMember; /** * @interface IWifiDirectDeviceListener @@ -176,8 +176,8 @@ public: * @see WifiDirectDevice::CreateGroup() * @see WifiDirectDevice::CancelGroupCreation() * @endif - */ - virtual void OnWifiDirectGroupCreatedN(WifiDirectDeviceId localDeviceId, const WifiDirectGroupInfo& wifiDirectGroupInfo, const WifiDirectDeviceInfo& wifiDirectGroupOwnerDeviceInfo, WifiDirectGroupMember* pWifiDirectMember, result r) {} + */ + virtual void OnWifiDirectGroupCreatedN(WifiDirectDeviceId localDeviceId, const WifiDirectGroupInfo& wifiDirectGroupInfo, const WifiDirectDeviceInfo& wifiDirectGroupOwnerDeviceInfo, WifiDirectGroupMember* pWifiDirectMember, result r) { delete pWifiDirectMember; } /** * Called to notify the application when the scan is completed. @@ -223,6 +223,17 @@ public: */ virtual void OnWifiDirectAssociationCompleted(WifiDirectDeviceId localDeviceId, const WifiDirectDeviceInfo& wifiDirectGroupOwnerDeviceInfo, result r) {} + /** + * Called to notify the application when a remote device is found during the Wi-Fi Direct scan process. + * + * @since 2.1 + * + * @param[in] localDeviceId An ID for a Wi-Fi Direct device + * @param[in] remoteDeviceInfo The remote device that is found + * @see WifiDirectDevice::Scan() + */ + virtual void OnWifiDirectRemoteDeviceFound(WifiDirectDeviceId localDeviceId, const WifiDirectDeviceInfo& remoteDeviceInfo) {} + protected: // // This method is for internal use only. Using this method can cause behavioral, security-related, @@ -264,15 +275,6 @@ protected: // virtual void OnWifiDirectDeviceListener_Reserved4(void) {} - // - // This method is for internal use only. Using this method can cause behavioral, security-related, - // and consistency-related issues in the application. - // - // This method is reserved and may change its name at any time without prior notice. - // - // @since 2.0 - // - virtual void OnWifiDirectDeviceListener_Reserved5(void) {} }; // IWifiDirectDeviceListener } } } //Tizen::Net::Wifi diff --git a/inc/FNetWifiIWifiSystemMonitoringEventListener.h b/inc/FNetWifiIWifiSystemMonitoringEventListener.h index 53bceaa..1654e98 100644 --- a/inc/FNetWifiIWifiSystemMonitoringEventListener.h +++ b/inc/FNetWifiIWifiSystemMonitoringEventListener.h @@ -6,7 +6,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -15,14 +15,11 @@ // limitations under the License. // /** - * @if VISPARTNER-MANUFACTURER * @file FNetWifiIWifiSystemMonitoringEventListener.h * @brief This is the header file for the %IWifiSyWifiSystemMonitoringntListener interface. - * @visibility partner-manufacturer * * This header file contains the declarations of the %IWifiSystemMonitoringEventListener interface. * - * @endif */ #ifndef _FNET_WIFI_IWIFI_SYSTEM_MONITORING_EVENT_LISTENER_H_ #define _FNET_WIFI_IWIFI_SYSTEM_MONITORING_EVENT_LISTENER_H_ @@ -33,57 +30,45 @@ namespace Tizen { namespace Net { namespace Wifi { /** - * @if VISPARTNER-MANUFACTURER * @interface IWifiSystemMonitoringEventListener * @brief This interface provides the listeners for monitoring the Wi-Fi underlying system. * * @since 2.0 - * @visibility partner-manufacturer * * The IWifiSystemMonitoringEventListener interface specifies the methods used for creating notifications about the different * kinds of Wi-Fi system monitoring events. When a Wi-Fi system monitoring event is generated, one of these methods is called. - * @endif */ class _OSP_EXPORT_ IWifiSystemMonitoringEventListener : virtual public Tizen::Base::Runtime::IEventListener { public: /** - * @if VISPARTNER-MANUFACTURER * This polymorphic destructor should be overridden if required. * This way, the destructors of the derived classes are called when the destructor of this interface is called. * * @since 2.0 - * @visibility partner-manufacturer - * @endif */ virtual ~IWifiSystemMonitoringEventListener(void) {} /** - * @if VISPARTNER-MANUFACTURER * Called to notify the application that the state of local Wi-Fi connection is changed. * * @since 2.0 - * @visibility partner-manufacturer * * @param[in] state The state of the Wi-Fi current connection * @remark When the local device is connected with a particular access point, * IWifiManagerEventListener::OnWifiConnected() as well as this method with @c WIFI_CONN_STATE_CONNECTED * are called. Therefore, be careful to manipulate only one of those methods. So are the cases of * IWifiManagerEventListener::OnWifiDisconnected() and this method with @c WIFI_CONN_STATE_NOT_CONNECTED. - * @endif */ virtual void OnWifiConnectionStateChanged(WifiConnectionState state) = 0; /** - * @if VISPARTNER-MANUFACTURER * Called to notify the application that the scan result of Wi-Fi system on background is updated. * * @since 2.0 - * @visibility partner-manufacturer * * @remark Call WifiManager::GetSystemScanResultN() for checking the content of this update. - * @endif */ virtual void OnWifiSystemScanResultUpdated(void) = 0; diff --git a/inc/FNetWifiWifiBssInfo.h b/inc/FNetWifiWifiBssInfo.h index ba999d8..f73cd77 100644 --- a/inc/FNetWifiWifiBssInfo.h +++ b/inc/FNetWifiWifiBssInfo.h @@ -150,63 +150,49 @@ public: void SetSsid(const Tizen::Base::String& ssid); /** - * @if VISPARTNER-MANUFACTURER * Checks whether an access point (BSS) is known or not. @n * The access point becomes a known BSS if it has been connected with this device. * * @since 2.0 - * @visibility partner-manufacturer * * @return @c true if the access point is known, @n * else @c false * @see SetUnknown() - * @endif */ bool IsKnown(void) const; /** - * @if VISPARTNER-MANUFACTURER * Sets the access point (BSS) unknown. * * @since 2.0 - * @visibility partner-manufacturer * * @see IsKnown() - * @endif */ void SetUnknown(void); /** - * @if VISPARTNER-MANUFACTURER * Gets the local IP address scheme. * * @since 2.0 - * @visibility partner-manufacturer * * @return The address scheme for the local IP address - * @endif */ Tizen::Net::NetAddressScheme GetLocalAddressScheme(void) const; /** - * @if VISPARTNER-MANUFACTURER * Sets the local IP address scheme. @n * The %SetLocalAddressScheme() method allows determining whether to use static address or dynamic address. * * @since 2.0 - * @visibility partner-manufacturer * * @param[in] scheme The address scheme for the local IP address - * @endif */ void SetLocalAddressScheme(Tizen::Net::NetAddressScheme scheme); /** - * @if VISPARTNER-MANUFACTURER * Gets the local IP address in the static address scheme. * * @since 2.0 - * @visibility partner-manufacturer * * @return The local address configured to this access point, @n * else @c null if an error occurs or there is no previously set address @@ -215,16 +201,13 @@ public: * For example, the address scheme for the IP address is @c NET_ADDRESS_SCHEME_DYNAMIC. * @remarks The specific error code can be accessed using the GetLastResult() method. * @see SetLocalAddress() - * @endif */ const Tizen::Net::IpAddress* GetLocalAddress(void) const; /** - * @if VISPARTNER-MANUFACTURER * Sets the local IP address in the static address scheme. * * @since 2.0 - * @visibility partner-manufacturer * * @return An error code * @param[in] pAddress The new address to be assigned @@ -233,16 +216,13 @@ public: * For example, The address scheme for the IP address is NET_ADDRESS_SCHEME_DYNAMIC. * @remarks The existing local address is unset when the input argument is @c null. * @see GetLocalAddress() - * @endif */ result SetLocalAddress(const Tizen::Net::IpAddress* pAddress); /** - * @if VISPARTNER-MANUFACTURER * Gets the subnet mask address in the static address scheme. * * @since 2.0 - * @visibility partner-manufacturer * * @return The subnet mask address configured to this access point, @n * else @c null if an error occurs or there is no previously set address @@ -251,16 +231,13 @@ public: * For example, the address scheme for the IP address is @c NET_ADDRESS_SCHEME_DYNAMIC. * @remarks The specific error code can be accessed using the GetLastResult() method. * @see SetSubnetMaskAddress() - * @endif */ const Tizen::Net::IpAddress* GetSubnetMaskAddress(void) const; /** - * @if VISPARTNER-MANUFACTURER * Sets the subnet mask address in the static address scheme. * * @since 2.0 - * @visibility partner-manufacturer * * @return An error code * @param[in] pAddress The new address to assign @@ -269,16 +246,13 @@ public: * For example, the address scheme for the IP address is @c NET_ADDRESS_SCHEME_DYNAMIC. * @remarks The existing subnet mask address is unset when the input argument is @c null. * @see GetSubnetMaskAddress() - * @endif */ result SetSubnetMaskAddress(const Tizen::Net::IpAddress* pAddress); /** - * @if VISPARTNER-MANUFACTURER * Gets the default gateway address in the static address scheme. * * @since 2.0 - * @visibility partner-manufacturer * * @return The default gateway address configured to this access point, @n * else @c null if an error occurs or there is no previously set address @@ -287,16 +261,13 @@ public: * For example, the address scheme for the IP address is NET_ADDRESS_SCHEME_DYNAMIC. * @remarks The specific error code can be accessed using the GetLastResult() method. * @see SetDefaultGatewayAddress() - * @endif */ const Tizen::Net::IpAddress* GetDefaultGatewayAddress(void) const; /** - * @if VISPARTNER-MANUFACTURER * Sets the default gateway address in the static address scheme. * * @since 2.0 - * @visibility partner-manufacturer * * @return An error code * @param[in] pAddress The new address to assign @@ -305,16 +276,13 @@ public: * For example, the address scheme for the IP address is @c NET_ADDRESS_SCHEME_DYNAMIC. * @remarks The existing gateway address is unset when the input argument is @c null. * @see GetDefaultGatewayAddress() - * @endif */ result SetDefaultGatewayAddress(const Tizen::Net::IpAddress* pAddress); /** - * @if VISPARTNER-MANUFACTURER * Gets the primary DNS address in the static address scheme. * * @since 2.0 - * @visibility partner-manufacturer * * @return The primary DNS address configured to this access point, @n * else @c null if an error occurs or there is no previously set address @@ -323,16 +291,13 @@ public: * For example, the address scheme for the IP address is @c NET_ADDRESS_SCHEME_DYNAMIC. * @remarks The specific error code can be accessed using the GetLastResult() method. * @see SetPrimaryDnsAddress() - * @endif */ const Tizen::Net::IpAddress* GetPrimaryDnsAddress(void) const; /** - * @if VISPARTNER-MANUFACTURER * Sets the primary DNS address in the static address scheme. * * @since 2.0 - * @visibility partner-manufacturer * * @return An error code * @param[in] pAddress The new address to assign @@ -341,16 +306,13 @@ public: * For example, the address scheme for the IP address is @c NET_ADDRESS_SCHEME_DYNAMIC. * @remarks The existing primary DNS address is unset when the input argument is @c null. * @see GetPrimaryDnsAddress() - * @endif */ result SetPrimaryDnsAddress(const Tizen::Net::IpAddress* pAddress); /** - * @if VISPARTNER-MANUFACTURER * Gets the secondary DNS address in the static address scheme. * * @since 2.0 - * @visibility partner-manufacturer * * @return The secondary DNS address configured to this access point, @n * else @c null if an error occurs or there is no previously set address @@ -359,16 +321,13 @@ public: * For example, the address scheme for the IP address is NET_ADDRESS_SCHEME_DYNAMIC. * @remarks The specific error code can be accessed using the GetLastResult() method. * @see SetSecondaryDnsAddress() - * @endif */ const Tizen::Net::IpAddress* GetSecondaryDnsAddress(void) const; /** - * @if VISPARTNER-MANUFACTURER * Sets the secondary DNS address in the static address scheme. * * @since 2.0 - * @visibility partner-manufacturer * * @return An error code * @param[in] pAddress The new address to assign @@ -377,42 +336,33 @@ public: * For example, the address scheme for the IP address is @c NET_ADDRESS_SCHEME_DYNAMIC. * @remarks The existing secondary DNS address is unset when the input argument is @c null. * @see GetSecondaryDnsAddress() - * @endif */ result SetSecondaryDnsAddress(const Tizen::Net::IpAddress* pAddress); /** - * @if VISPARTNER-MANUFACTURER * Gets the proxy type. * * @since 2.0 - * @visibility partner-manufacturer * * @return The proxy type * @see SetProxyType() - * @endif */ Tizen::Net::NetProxyType GetProxyType(void) const; /** - * @if VISPARTNER-MANUFACTURER * Sets the proxy type. * * @since 2.0 - * @visibility partner-manufacturer * * @param[in] type The proxy type * @see GetProxyType() - * @endif */ void SetProxyType(Tizen::Net::NetProxyType type); /** - * @if VISPARTNER-MANUFACTURER * Gets the proxy address. * * @since 2.0 - * @visibility partner-manufacturer * * @return The proxy address, @n * else an empty string if an error occurs or there is no previously set address @@ -421,16 +371,13 @@ public: * For example, the specified input type is @c NET_PROXY_TYPE_NONE. * @remarks The specific error code can be accessed using the GetLastResult() method. * @see SetProxyAddress() - * @endif */ Tizen::Base::String GetProxyAddress(void) const; /** - * @if VISPARTNER-MANUFACTURER * Sets the proxy address. * * @since 2.0 - * @visibility partner-manufacturer * * @return An error code * @param[in] address The proxy address @@ -439,7 +386,6 @@ public: * For example, The specified input type is NET_PROXY_TYPE_NONE. * @remarks The existing proxy address is unset when the input argument is an empty string. * @see GetProxyAddress() - * @endif */ result SetProxyAddress(const Tizen::Base::String& address); diff --git a/inc/FNetWifiWifiDirectDevice.h b/inc/FNetWifiWifiDirectDevice.h index b8f8915..6d30f1d 100755 --- a/inc/FNetWifiWifiDirectDevice.h +++ b/inc/FNetWifiWifiDirectDevice.h @@ -180,7 +180,8 @@ public: * Activates the local Wi-Fi device by using the Wi-Fi Direct enabled. * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @exception E_SUCCESS The activation is successful. @@ -209,7 +210,8 @@ public: * Deactivates the local Wi-Fi device. * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @exception E_SUCCESS The deactivation is successful. @@ -315,7 +317,8 @@ public: * Instead of using this API, use Connect() or CreateAutonomousGroup() API. * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @param[in] pWifiDirectGroupInfo The pointer of a WiFiDirectGroupInfo @@ -357,7 +360,8 @@ public: * Instead of using this API, use CancelConnect() API * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @exception E_SUCCESS The method is successful. @@ -376,7 +380,8 @@ public: * Scans Wi-Fi Direct Devices which are in the specified type. * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.wifidirect.read + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.read * * @return An error code * @exception E_SUCCESS The method is successful. @@ -394,7 +399,8 @@ public: * Cancels the Wi-Fi Direct previous scan operation. * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.wifidirect.read + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.read * * @return An error code * @exception E_SUCCESS The method is successful. @@ -417,7 +423,8 @@ public: * Instead of using this API, use Connect() API * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @param[in] wifiDirectGroupOwnerDeviceInfo The WifiDirectDeviceInfo value of a group owner @@ -473,7 +480,8 @@ public: * Connects to the Wi-Fi Direct connection with the specified peer device. * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @param[in] remoteDeviceInfo The remote peer device to connect. @@ -498,7 +506,8 @@ public: * Cancels the request for Wi-Fi Direct connection. * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @exception E_SUCCESS The method is successful. @@ -516,7 +525,8 @@ public: * Creates a Wi-Fi Direct group as the group owner. * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @exception E_SUCCESS The method is successful. @@ -534,8 +544,8 @@ public: * Sets the configuration information of a Wi-Fi Direct group. * * @since 2.0 - * - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @param[in] groupSettingInfo The group setting information @@ -552,8 +562,8 @@ public: * Disconnects the specified peer device. * * @since 2.0 - * - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @param[in] peerDeviceInfo The peer device to disconnect @@ -573,8 +583,8 @@ public: * Leaves the currently participating Wi-Fi Direct group. * * @since 2.0 - * - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @exception E_SUCCESS The method is successful. diff --git a/inc/FNetWifiWifiDirectGroupClient.h b/inc/FNetWifiWifiDirectGroupClient.h index 2746601..043f364 100755 --- a/inc/FNetWifiWifiDirectGroupClient.h +++ b/inc/FNetWifiWifiDirectGroupClient.h @@ -73,8 +73,8 @@ public: * it is integrated into WifiDirectDevice class. use WifiDirectDevice::Disconnect() API. * * @since 2.0 - * - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @exception E_SUCCESS The method is successful. @@ -98,8 +98,8 @@ public: * Instead of using this API, WifiDirectDevice::GetGroupOwnerInfoN() API. * * @since 2.0 - * - * @privilege %http://tizen.org/privilege/wifi.wifidirect.read, %http://tizen.org/privilege/network.connection and %http://tizen.org/privilege/socket @n + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.read, http://tizen.org/privilege/network.connection and http://tizen.org/privilege/socket @n * All the above privileges are required * * @return An error code @@ -128,8 +128,8 @@ public: * Now the Wi-Fi Direct APIs have been revised to allow the use of APIs with ease irrespective of the role. @n * * @since 2.0 - * - * @privilege %http://tizen.org/privilege/wifi.wifidirect.read, %http://tizen.org/privilege/network.connection and %http://tizen.org/privilege/socket @n + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.read, http://tizen.org/privilege/network.connection and http://tizen.org/privilege/socket @n * All the above privileges are required * * @return An error code diff --git a/inc/FNetWifiWifiDirectGroupOwner.h b/inc/FNetWifiWifiDirectGroupOwner.h index 46ad20d..287bbfa 100755 --- a/inc/FNetWifiWifiDirectGroupOwner.h +++ b/inc/FNetWifiWifiDirectGroupOwner.h @@ -78,8 +78,8 @@ public: * As the APIs have been integrated into the WifiDirectDevice class, use WifiDirectDevice::LeaveGroup() API instead. * * @since 2.0 - * - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @exception E_SUCCESS The method is successful. @@ -104,8 +104,8 @@ public: * As the APIs have been integrated into the WifiDirectDevice class, use WifiDirectDevice::Disconnect() API instead. * * @since 2.0 - * - * @privilege %http://tizen.org/privilege/wifi.wifidirect.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.admin * * @return An error code * @param[in] wifiDirectRemoteDeviceInfo The device information of a group client to disconnect @@ -154,8 +154,8 @@ public: * Now the Wi-Fi Direct APIs have been revised to allow the use of APIs with ease irrespective of the role. @n * * @since 2.0 - * - * @privilege %http://tizen.org/privilege/wifi.wifidirect.read, %http://tizen.org/privilege/network.connection and %http://tizen.org/privilege/socket @n + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.read, http://tizen.org/privilege/network.connection and http://tizen.org/privilege/socket @n * All the above privileges are required * * @return An error code @@ -182,8 +182,8 @@ public: * Now the Wi-Fi Direct APIs have been revised to allow the use of APIs with ease irrespective of the role. @n * * @since 2.0 - * - * @privilege %http://tizen.org/privilege/wifi.wifidirect.read, %http://tizen.org/privilege/network.connection and %http://tizen.org/privilege/socket @n + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.wifidirect.read, http://tizen.org/privilege/network.connection and http://tizen.org/privilege/socket @n * All the above privileges are required * * @return An error code diff --git a/inc/FNetWifiWifiManager.h b/inc/FNetWifiWifiManager.h index 7736101..5541f2e 100755 --- a/inc/FNetWifiWifiManager.h +++ b/inc/FNetWifiWifiManager.h @@ -134,7 +134,8 @@ public: * Activates the local Wi-Fi device. * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.admin * * @return An error code * @exception E_SUCCESS The activation is successful. @@ -152,7 +153,8 @@ public: * Deactivates the local Wi-Fi device. * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.admin * * @return An error code * @exception E_SUCCESS The deactivation is successful. @@ -209,7 +211,8 @@ public: * Scans for a nearby BSS with both the infrastructure and independent modes. * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.read + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.read * * @return An error code * @exception E_SUCCESS The method is successful. @@ -226,7 +229,8 @@ public: * Connects to a specific access point that is a BSS with an infrastructure mode. * * @since 2.0 - * @privilege %http://tizen.org/privilege/wifi.admin + * @privlevel public + * @privilege http://tizen.org/privilege/wifi.admin * * @return An error code * @param[in] targetApInfo A BSS information representing the target access point @@ -244,12 +248,11 @@ public: result Connect(const WifiBssInfo& targetApInfo); /** - * @if VISPARTNER-MANUFACTURER * Sets the behavior mode of the Wi-Fi background system about connection and background scanning. * * @since 2.0 - * @visibility partner-manufacturer - * @privilege %http://tizen.org/privilege/wifimanager + * @privlevel platform + * @privilege http://tizen.org/privilege/wifimanager * * @return An error code * @param[in] mode A Wi-Fi background system mode @@ -257,18 +260,16 @@ public: * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @exception E_OPERATION_FAILED The operation has failed. * @exception E_SYSTEM The method cannot proceed due to a severe system error. - * @endif */ result SetWifiSystemScanMode(WifiSystemScanMode mode); /** - * @if VISPARTNER-MANUFACTURER * Adds the specified listener for receiving the notification when the state of current Wi-Fi connection is changed * or the result of Wi-Fi background scanning is updated * * @since 2.0 - * @visibility partner-manufacturer - * @privilege %http://tizen.org/privilege/wifimanager + * @privlevel platform + * @privilege http://tizen.org/privilege/wifimanager * * @return An error code * @param[in] listener The listener to add @@ -276,18 +277,16 @@ public: * @exception E_OBJ_ALREADY_EXIST The listener is already added. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @exception E_SYSTEM The method cannot proceed due to a severe system error. - * @endif */ result AddSystemMonitoringEventListener(IWifiSystemMonitoringEventListener& listener); /** - * @if VISPARTNER-MANUFACTURER * Removes the specified IWifiSystemMonitoringEventListener instance for receiving the notification. The removed listener * cannot listen to the events that are fired. * * @since 2.0 - * @visibility partner-manufacturer - * @privilege %http://tizen.org/privilege/wifimanager + * @privlevel platform + * @privilege http://tizen.org/privilege/wifimanager * * @return An error code * @param[in] listener The listener to remove @@ -295,42 +294,34 @@ public: * @exception E_OBJ_NOT_FOUND The listener is not found. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @exception E_SYSTEM The method cannot proceed due to a severe system error. - * @endif */ result RemoveSystemMonitoringEventListener(IWifiSystemMonitoringEventListener& listener); /** - * @if VISPARTNER-MANUFACTURER * Gets the state of current Wi-Fi connection. * * @since 2.0 - * @visibility partner-manufacturer * * @return The state of the current Wi-Fi connection - * @endif */ WifiConnectionState GetConnectionState(void) const; /** - * @if VISPARTNER-MANUFACTURER * Gets the information of current Wi-Fi connection target which the local device is connecting or connected with. * * @since 2.0 - * @visibility partner-manufacturer * * @return A pointer to the WifiBssInfo instance representing the information of current Wi-Fi connection target * else @c null if GetConnectionState() is WIFI_CONN_STATE_NOT_CONNECTED - * @endif */ WifiBssInfo* GetConnectionTargetInfoN(void) const; /** - * @if VISPARTNER-MANUFACTURER * Updates the Wi-Fi BSS information which is saved in the underlying Wi-Fi system. * * @since 2.0 - * @visibility partner-manufacturer - * @privilege %http://tizen.org/privilege/wifimanager + * @privlevel platform + * @privilege http://tizen.org/privilege/wifimanager * * @return An error code * @param[in] bssInfo A BSS information representing the access point @@ -339,20 +330,18 @@ public: * @exception E_OBJ_NOT_FOUND The specified input parameter is not found. * @exception E_OPERATION_FAILED The operation has failed. * @exception E_SYSTEM The method cannot proceed due to a severe system error. - * @endif + * + * @remarks The updated information is deleted when Wi-Fi is turned off if the BSS has never been connected before. */ result UpdateBssInfo(const WifiBssInfo& bssInfo); /** - * @if VISPARTNER-MANUFACTURER * Gets a list of the latest search results which the underlying Wi-Fi system scan periodically on background. * * @since 2.0 - * @visibility partner-manufacturer * * @return An IList containing WifiBssInfo of existing Wi-Fi connections if successful, @n * else @c null - * @endif */ Tizen::Base::Collection::IList* GetSystemScanResultN(void) const; diff --git a/inc/FNetWifiWifiTypes.h b/inc/FNetWifiWifiTypes.h index 6cc7921..f99a643 100644 --- a/inc/FNetWifiWifiTypes.h +++ b/inc/FNetWifiWifiTypes.h @@ -61,9 +61,9 @@ static const int MAX_WIFI_DIRECT_GROUP_OWNER_INTENT = 15; */ enum WifiPowerStatus { - WIFI_POWER_STATUS_OFF = 0, /**< The local Wi-Fi device is turned off */ - WIFI_POWER_STATUS_ON, /**< The local Wi-Fi device is turned on */ - WIFI_POWER_STATUS_DEEP_SLEEP, /**< The local Wi-Fi device enters deep sleep mode */ + WIFI_POWER_STATUS_OFF = 0, /**< The local Wi-Fi device is turned off */ + WIFI_POWER_STATUS_ON, /**< The local Wi-Fi device is turned on */ + WIFI_POWER_STATUS_DEEP_SLEEP, /**< The local Wi-Fi device enters deep sleep mode */ }; /** @@ -75,24 +75,24 @@ enum WifiPowerStatus */ enum WifiBssType { - WIFI_BSS_TYPE_INFRASTRUCTURE = 0, /**< The infrastructure type which usually consists of a single Access Point (AP) @n - * However, in order to provide sufficient coverage, it could be necessary to use two - * or more APs. @n - * Logically, there needs to be an interconnection among APs, and this concept is - * called Distribution %System (DS). @n - * Connecting with multiple APs through DS creates a wireless network of an arbitrary - * size. @n - * This is called Extended Service Set (ESS). Finally, a logical connection point to - * the wired LAN is supported by a concept designated as Portal. */ - WIFI_BSS_TYPE_INDEPENDENT, /**< The simplest Wi-Fi configuration is called as Independent Basic Service Set (IBSS) - * or ad hoc @n - * The IBSS is a self-contained network that only supports direct communication - * between Stations (STAs) that belong to the same BSS. @n - * The most common example of this connection is the use of Wi-Fi to establish - * peer-to-peer network connection between two STAs. */ - WIFI_BSS_TYPE_ANY, /**< The type with no specification */ - WIFI_BSS_TYPE_MAX = 65535 // This enum value is for internal use only. Using this enum value can cause behavioral, - // security-related, and consistency-related issues in the application. + WIFI_BSS_TYPE_INFRASTRUCTURE = 0, /**< The infrastructure type which usually consists of a single Access Point (AP) @n + * However, in order to provide sufficient coverage, it could be necessary to use two + * or more APs. @n + * Logically, there needs to be an interconnection among APs, and this concept is + * called Distribution %System (DS). @n + * Connecting with multiple APs through DS creates a wireless network of an arbitrary + * size. @n + * This is called Extended Service Set (ESS). Finally, a logical connection point to + * the wired LAN is supported by a concept designated as Portal. */ + WIFI_BSS_TYPE_INDEPENDENT, /**< The simplest Wi-Fi configuration is called as Independent Basic Service Set (IBSS) + * or ad hoc @n + * The IBSS is a self-contained network that only supports direct communication + * between Stations (STAs) that belong to the same BSS. @n + * The most common example of this connection is the use of Wi-Fi to establish + * peer-to-peer network connection between two STAs. */ + WIFI_BSS_TYPE_ANY, /**< The type with no specification */ + WIFI_BSS_TYPE_MAX = 65535 // This enum value is for internal use only. Using this enum value can cause behavioral, + // security-related, and consistency-related issues in the application. }; /** @@ -106,17 +106,17 @@ enum WifiBssType */ enum WifiAuthenticationType { - WIFI_AUTHENTICATION_OPEN = 0, /**< The Open %System Authentication that admits any STA to the DS */ - WIFI_AUTHENTICATION_SHARED, /**< The Shared Key Authentication relies on the WEP to demonstrate knowledge of a - * WEP encryption key */ - WIFI_AUTHENTICATION_WPA, /**< The Enterprise Authentication that supports WPA (Wi-Fi Protected Access) */ - WIFI_AUTHENTICATION_WPA_PSK, /**< The Personal Authentication that supports WPA; PSK stands for PreShared Key */ - WIFI_AUTHENTICATION_WPA2, /**< The Enterprise Authentication that supports WPA2 */ - WIFI_AUTHENTICATION_WPA2_PSK, /**< The Personal Authentication that supports WPA2; PSK stands for PreShared Key */ - WIFI_AUTHENTICATION_WPA_WPA2_MIXED_PSK, /**< The Personal Authentication that supports both WPA and WPA2; PSK stands for - * PreShared Key */ - WIFI_AUTHENTICATION_MAX = 65535 // This enum value is for internal use only. Using this enum value can cause - // behavioral, security-related, and consistency-related issues in the application. + WIFI_AUTHENTICATION_OPEN = 0, /**< The Open %System Authentication that admits any STA to the DS */ + WIFI_AUTHENTICATION_SHARED, /**< The Shared Key Authentication relies on the WEP to demonstrate knowledge of a + * WEP encryption key */ + WIFI_AUTHENTICATION_WPA, /**< The Enterprise Authentication that supports WPA (Wi-Fi Protected Access) */ + WIFI_AUTHENTICATION_WPA_PSK, /**< The Personal Authentication that supports WPA; PSK stands for PreShared Key */ + WIFI_AUTHENTICATION_WPA2, /**< The Enterprise Authentication that supports WPA2 */ + WIFI_AUTHENTICATION_WPA2_PSK, /**< The Personal Authentication that supports WPA2; PSK stands for PreShared Key */ + WIFI_AUTHENTICATION_WPA_WPA2_MIXED_PSK, /**< The Personal Authentication that supports both WPA and WPA2; PSK stands for + * PreShared Key */ + WIFI_AUTHENTICATION_MAX = 65535 // This enum value is for internal use only. Using this enum value can cause + // behavioral, security-related, and consistency-related issues in the application. }; /** @@ -128,13 +128,13 @@ enum WifiAuthenticationType */ enum WifiEncryptionType { - WIFI_ENCRYPTION_NONE = 0, /**< The type with no encryption */ - WIFI_ENCRYPTION_WEP, /**< The Wired Equivalent Privacy @n This is only used for open and shared methods. */ - WIFI_ENCRYPTION_TKIP, /**< The Temporal Key Integrity Protocol */ - WIFI_ENCRYPTION_AES, /**< The Advanced Encryption Standard */ - WIFI_ENCRYPTION_TKIP_AES_MIXED, /**< The TKIP and AES are both supported */ - WIFI_ENCRYPTION_MAX = 65535 // This enum value is for internal use only. Using this enum value can cause behavioral, - // security-related, and consistency-related issues in the application. + WIFI_ENCRYPTION_NONE = 0, /**< The type with no encryption */ + WIFI_ENCRYPTION_WEP, /**< The Wired Equivalent Privacy @n This is only used for open and shared methods. */ + WIFI_ENCRYPTION_TKIP, /**< The Temporal Key Integrity Protocol */ + WIFI_ENCRYPTION_AES, /**< The Advanced Encryption Standard */ + WIFI_ENCRYPTION_TKIP_AES_MIXED, /**< The TKIP and AES are both supported */ + WIFI_ENCRYPTION_MAX = 65535 // This enum value is for internal use only. Using this enum value can cause behavioral, + // security-related, and consistency-related issues in the application. }; /** @@ -146,14 +146,14 @@ enum WifiEncryptionType */ enum WifiEapType { - WIFI_EAP_NONE = 0, /**< The method type where no EAP method is used */ - WIFI_EAP_SIM, /**< The EAP-SIM; EAP for GSM Subscriber Identity */ - WIFI_EAP_AKA, /**< The EAP-AKA; EAP for UMTS Authentication and Key Agreement */ - WIFI_EAP_TTLS_MSCHAPV2, /**< The EAP-TTLS/MSCHAPv2; Tunnel MSCHAPv2 through TTLS(Tunneled Transport Layer Security) */ - WIFI_EAP_PEAP_MSCHAPV2, /**< The PEAPv0/EAP-MSCHAPv2; Tunnel MSCHAPv2 through PEAP(Protected Extensible Authentication - * Protocol) */ - WIFI_EAP_PEAP_GTC, /**< The PEAPv1/EAP-GTC; Tunnel GTC through PEAP(Protected Extensible Authentication Protocol) */ - WIFI_EAP_TLS /**< The EAP-TLS, Not supported yet */ + WIFI_EAP_NONE = 0, /**< The method type where no EAP method is used */ + WIFI_EAP_SIM, /**< The EAP-SIM; EAP for GSM Subscriber Identity */ + WIFI_EAP_AKA, /**< The EAP-AKA; EAP for UMTS Authentication and Key Agreement */ + WIFI_EAP_TTLS_MSCHAPV2, /**< The EAP-TTLS/MSCHAPv2; Tunnel MSCHAPv2 through TTLS(Tunneled Transport Layer Security) */ + WIFI_EAP_PEAP_MSCHAPV2, /**< The PEAPv0/EAP-MSCHAPv2; Tunnel MSCHAPv2 through PEAP(Protected Extensible Authentication + * Protocol) */ + WIFI_EAP_PEAP_GTC, /**< The PEAPv1/EAP-GTC; Tunnel GTC through PEAP(Protected Extensible Authentication Protocol) */ + WIFI_EAP_TLS /**< The EAP-TLS, Not supported yet */ }; /** @@ -170,12 +170,12 @@ enum WifiEapType */ enum WifiWepKeyLen { - WIFI_WEP_KEY_LEN_64BIT = 0, /**< @if OSPDEPREC The WEP key of length 64bits @n - * The minimum length of the WEP key is 5 digits (40bits). @endif */ - WIFI_WEP_KEY_LEN_128BIT, /**< @if OSPDEPREC The WEP key of length 128bits @n - * The minimum length of the WEP key is 13 digits (104bits). @endif */ - WIFI_WEP_KEY_LEN_MAX = 65535 // This enum value is for internal use only. Using this enum value can cause behavioral, - // security-related, and consistency-related issues in the application. + WIFI_WEP_KEY_LEN_64BIT = 0, /**< @if OSPDEPREC The WEP key of length 64bits @n + * The minimum length of the WEP key is 5 digits (40bits). @endif */ + WIFI_WEP_KEY_LEN_128BIT, /**< @if OSPDEPREC The WEP key of length 128bits @n + * The minimum length of the WEP key is 13 digits (104bits). @endif */ + WIFI_WEP_KEY_LEN_MAX = 65535 // This enum value is for internal use only. Using this enum value can cause behavioral, + // security-related, and consistency-related issues in the application. }; /** @@ -194,10 +194,10 @@ enum WifiWepKeyLen */ enum WifiWepKeyIndex { - WIFI_WEP_KEY_INDEX_1 = 1, /**< @if OSPDEPREC The WEP Key Index 1 @endif */ - WIFI_WEP_KEY_INDEX_2 = 2, /**< @if OSPDEPREC The WEP Key Index 2 @endif */ - WIFI_WEP_KEY_INDEX_3 = 3, /**< @if OSPDEPREC The WEP Key Index 3 @endif */ - WIFI_WEP_KEY_INDEX_4 = 4, /**< @if OSPDEPREC The WEP Key Index 4 @endif */ + WIFI_WEP_KEY_INDEX_1 = 1, /**< @if OSPDEPREC The WEP Key Index 1 @endif */ + WIFI_WEP_KEY_INDEX_2 = 2, /**< @if OSPDEPREC The WEP Key Index 2 @endif */ + WIFI_WEP_KEY_INDEX_3 = 3, /**< @if OSPDEPREC The WEP Key Index 3 @endif */ + WIFI_WEP_KEY_INDEX_4 = 4, /**< @if OSPDEPREC The WEP Key Index 4 @endif */ }; /** @@ -236,8 +236,8 @@ enum WifiRadioChannel */ enum WifiDirectDeviceStatus { - WIFI_DIRECT_DEVICE_DEACTIVATED = 0, /**< The Wi-Fi interface is deactivated */ - WIFI_DIRECT_DEVICE_ACTIVATED /**< The Wi-Fi interface is activated */ + WIFI_DIRECT_DEVICE_DEACTIVATED = 0, /**< The Wi-Fi interface is deactivated */ + WIFI_DIRECT_DEVICE_ACTIVATED /**< The Wi-Fi interface is activated */ }; /** @@ -249,10 +249,10 @@ enum WifiDirectDeviceStatus */ enum WifiDirectGroupMemberType { - WIFI_DIRECT_GROUP_MEMBER_TYPE_NONE = 0, /**< The Wi-Fi Direct Group Non-member @n That is, the device does not belong to any - * group. */ - WIFI_DIRECT_GROUP_MEMBER_TYPE_OWNER, /**< The Wi-Fi Direct Group Owner */ - WIFI_DIRECT_GROUP_MEMBER_TYPE_CLIENT /**< The Wi-Fi Direct Group Client */ + WIFI_DIRECT_GROUP_MEMBER_TYPE_NONE = 0, /**< The Wi-Fi Direct Group Non-member @n That is, the device does not belong to any + * group. */ + WIFI_DIRECT_GROUP_MEMBER_TYPE_OWNER, /**< The Wi-Fi Direct Group Owner */ + WIFI_DIRECT_GROUP_MEMBER_TYPE_CLIENT /**< The Wi-Fi Direct Group Client */ }; /** @@ -264,28 +264,28 @@ enum WifiDirectGroupMemberType */ enum WifiDirectDeviceTypeCategory { - WIFI_DIRECT_DEVICE_TYPE_CATEGORY_COMPUTER = 0, /**< The PC, Server, %Media Center, UMPC, Notebook, Desktop, - * MID, Netbook, and so on */ - WIFI_DIRECT_DEVICE_TYPE_CATEGORY_INPUT_DEVICE, /**< The Keyboard, Mouse, Joystick, Trackball, Gaming - * controller, Remote, Touchscreen, Biometric reader, Barcode - * reader, and so on */ - WIFI_DIRECT_DEVICE_TYPE_CATEGORY_PRINTER_SCANNER_FAX_COPIER, /**< The Printer, Print Server, Scanner, Fax, Copier, - * All-in-one, and so on */ - WIFI_DIRECT_DEVICE_TYPE_CATEGORY_CAMERA, /**< The Digital still camera, Video camera, %Web camera, - * %Security camera, and so on */ - WIFI_DIRECT_DEVICE_TYPE_CATEGORY_STORAGE, /**< The NAS */ - WIFI_DIRECT_DEVICE_TYPE_CATEGORY_NETWORK_INFRASTRUCTURE, /**< The AP, Router, Switch, Gateway, and so on */ - WIFI_DIRECT_DEVICE_TYPE_CATEGORY_DISPLAY, /**< The Television, Electronic picture frame, Projector, - * Monitor, and so on */ - WIFI_DIRECT_DEVICE_TYPE_CATEGORY_MULTIMEDIA_DEVICE, /**< The DAR, PVR, MCX, Set-top box, %Media server, %Media - * adapter, %Media extender, Portable video player, and so - * on */ - WIFI_DIRECT_DEVICE_TYPE_CATEGORY_GAMING_DEVICE, /**< The Xbox, Playstation, Game console, Game console adaptor, - * Portable gaming device, and so on */ - WIFI_DIRECT_DEVICE_TYPE_CATEGORY_TELEPHONE, /**< The Windows Mobile, Phone, Smartphone, and so on */ - WIFI_DIRECT_DEVICE_TYPE_CATEGORY_AUDIO_DEVICE, /**< The Audio tuner, Audio receiver, Speaker, Portable Music - * Player, Headset, Headphone, Microphone, and so on */ - WIFI_DIRECT_DEVICE_TYPE_CATEGORY_OTHERS = 255 /**< A device which is not classified into the above types */ + WIFI_DIRECT_DEVICE_TYPE_CATEGORY_COMPUTER = 0, /**< The PC, Server, %Media Center, UMPC, Notebook, Desktop, + * MID, Netbook, and so on */ + WIFI_DIRECT_DEVICE_TYPE_CATEGORY_INPUT_DEVICE, /**< The Keyboard, Mouse, Joystick, Trackball, Gaming + * controller, Remote, Touchscreen, Biometric reader, Barcode + * reader, and so on */ + WIFI_DIRECT_DEVICE_TYPE_CATEGORY_PRINTER_SCANNER_FAX_COPIER, /**< The Printer, Print Server, Scanner, Fax, Copier, + * All-in-one, and so on */ + WIFI_DIRECT_DEVICE_TYPE_CATEGORY_CAMERA, /**< The Digital still camera, Video camera, %Web camera, + * %Security camera, and so on */ + WIFI_DIRECT_DEVICE_TYPE_CATEGORY_STORAGE, /**< The NAS */ + WIFI_DIRECT_DEVICE_TYPE_CATEGORY_NETWORK_INFRASTRUCTURE, /**< The AP, Router, Switch, Gateway, and so on */ + WIFI_DIRECT_DEVICE_TYPE_CATEGORY_DISPLAY, /**< The Television, Electronic picture frame, Projector, + * Monitor, and so on */ + WIFI_DIRECT_DEVICE_TYPE_CATEGORY_MULTIMEDIA_DEVICE, /**< The DAR, PVR, MCX, Set-top box, %Media server, %Media + * adapter, %Media extender, Portable video player, and so + * on */ + WIFI_DIRECT_DEVICE_TYPE_CATEGORY_GAMING_DEVICE, /**< The Xbox, Playstation, Game console, Game console adaptor, + * Portable gaming device, and so on */ + WIFI_DIRECT_DEVICE_TYPE_CATEGORY_TELEPHONE, /**< The Windows Mobile, Phone, Smartphone, and so on */ + WIFI_DIRECT_DEVICE_TYPE_CATEGORY_AUDIO_DEVICE, /**< The Audio tuner, Audio receiver, Speaker, Portable Music + * Player, Headset, Headphone, Microphone, and so on */ + WIFI_DIRECT_DEVICE_TYPE_CATEGORY_OTHERS = 255 /**< A device which is not classified into the above types */ }; /** @@ -303,12 +303,12 @@ enum WifiDirectDeviceTypeCategory */ enum WifiDirectAssociationTerminationReason { - WIFI_DIRECT_ASSOCIATION_TERMINATION_REASON_SELF_INITIATED = 0, /**< @if OSPDEPREC The enumerator that is delivered to a group owner or - * group client who initiates the disassociation request @endif */ - WIFI_DIRECT_ASSOCIATION_TERMINATION_REASON_DISCONNECTED /**< @if OSPDEPREC The enumerator that is delivered to a group owner or - * group client who receives the disassociation request or - * when a client is disconnected due to out of range or - * abrupt connection loss to the group owner @endif */ + WIFI_DIRECT_ASSOCIATION_TERMINATION_REASON_SELF_INITIATED = 0, /**< @if OSPDEPREC The enumerator that is delivered to a group owner or + * group client who initiates the disassociation request @endif */ + WIFI_DIRECT_ASSOCIATION_TERMINATION_REASON_DISCONNECTED /**< @if OSPDEPREC The enumerator that is delivered to a group owner or + * group client who receives the disassociation request or + * when a client is disconnected due to out of range or + * abrupt connection loss to the group owner @endif */ }; /** @@ -320,21 +320,18 @@ enum WifiDirectAssociationTerminationReason */ enum WifiWpsConfigurationMode { - WIFI_WPS_CONFIG_MODE_NONE = 0, /**< The configuration mode with no method to be provided */ - WIFI_WPS_CONFIG_MODE_PIN_DISPLAY, /**< A method to display the PIN code */ - WIFI_WPS_CONFIG_MODE_PIN_KEYPAD, /**< A method to provide the keypad to input the PIN */ - WIFI_WPS_CONFIG_MODE_PBC /**< A method of Push Button Configuration (PBC) */ + WIFI_WPS_CONFIG_MODE_NONE = 0, /**< The configuration mode with no method to be provided */ + WIFI_WPS_CONFIG_MODE_PIN_DISPLAY, /**< A method to display the PIN code */ + WIFI_WPS_CONFIG_MODE_PIN_KEYPAD, /**< A method to provide the keypad to input the PIN */ + WIFI_WPS_CONFIG_MODE_PBC /**< A method of Push Button Configuration (PBC) */ }; /** - * @if VISPARTNER-MANUFACTURER * @enum WifiConnectionState * * Defines the state of the Wi-Fi connection. * * @since 2.0 - * @visibility partner-manufacturer - * @endif */ enum WifiConnectionState { @@ -345,14 +342,11 @@ enum WifiConnectionState }; /** - * @if VISPARTNER-MANUFACTURER * @enum WifiSystemScanMode * * Defines the mode of the Wi-Fi background system behaviors, mainly about background scanning. * * @since 2.0 - * @visibility partner-manufacturer - * @endif */ enum WifiSystemScanMode { diff --git a/packaging/osp-net.spec b/packaging/osp-net.spec index d519559..099b0a5 100755 --- a/packaging/osp-net.spec +++ b/packaging/osp-net.spec @@ -3,7 +3,7 @@ Name: osp-net Summary: The Network library of OSP -Version: 1.2.0.0 +Version: 1.2.1.0 Release: 1 Group: System/Libraries License: Apache License, Version 2.0 or Flora diff --git a/src/FNetNetStatistics.cpp b/src/FNetNetStatistics.cpp index a9053c2..170dde3 100644 --- a/src/FNetNetStatistics.cpp +++ b/src/FNetNetStatistics.cpp @@ -72,7 +72,7 @@ NetStatistics::GetNetStatisticsInfo(NetBearerType operationMode, NetStatisticsIn ClearLastResult(); - r = _AccessController::CheckUserPrivilege(_PRV_NETWORK_STATISTICS_READ); + r = _AccessController::CheckUserPrivilege(_PRV_NETWORK_STATISTICS_READ, _PRV_NETWORK_STATISTICS); r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_OUT_OF_MEMORY); SysTryReturn(NID_NET, r == E_SUCCESS, INVALID_HANDLE, r, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(r)); @@ -91,10 +91,6 @@ NetStatistics::Reset(NetBearerType operationMode, NetStatisticsInfoType netStatT { result r = E_SUCCESS; - r = _AccessController::CheckUserPrivilege(_PRV_NETWORK_STATISTICS_WRITE); - r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_OUT_OF_MEMORY); - SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "The application does not have the privilege to call this method."); - SysAssertf(__pNetStatisticsImpl != null, "Not yet constructed. Construct() should be called before use."); r = __pNetStatisticsImpl->Reset(operationMode, netStatType); @@ -108,10 +104,6 @@ NetStatistics::ResetAll(NetBearerType operationMode) { result r = E_SUCCESS; - r = _AccessController::CheckUserPrivilege(_PRV_NETWORK_STATISTICS_WRITE); - r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_OUT_OF_MEMORY); - SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "The application does not have the privilege to call this method."); - SysAssertf(__pNetStatisticsImpl != null, "Not yet constructed. Construct() should be called before use."); r = __pNetStatisticsImpl->ResetAll(operationMode); diff --git a/src/FNet_DefaultSystemNetConnection.cpp b/src/FNet_DefaultSystemNetConnection.cpp index c34e63f..2633b48 100644 --- a/src/FNet_DefaultSystemNetConnection.cpp +++ b/src/FNet_DefaultSystemNetConnection.cpp @@ -143,23 +143,6 @@ _DefaultSystemNetConnection::Construct(void) { UpdateConnectionInfo(profileHandle); connection_profile_destroy(profileHandle); - -// ToDo - temporal fix -#ifdef _OSP_EMUL_ - if (_pConnectionInfo->GetProxyAddress().IsEmpty()) - { - char* pProxy = null; - - ret = connection_get_proxy(connectionHandle, CONNECTION_ADDRESS_FAMILY_IPV4, &pProxy); - if ((ret == CONNECTION_ERROR_NONE) && (pProxy != null)) - { - SysLog(NID_NET, "Proxy Address is [%s].", pProxy); - _pConnectionInfo->SetProxyAddress(String(pProxy)); - free(pProxy); - } - } -#endif // _OSP_EMUL_ - } else { diff --git a/src/FNet_LocalDhcpServerImpl.cpp b/src/FNet_LocalDhcpServerImpl.cpp index 8e71e7c..9c35636 100644 --- a/src/FNet_LocalDhcpServerImpl.cpp +++ b/src/FNet_LocalDhcpServerImpl.cpp @@ -892,7 +892,7 @@ _LocalDhcpServerImpl::OnWifiDirectClientAssociated(WifiDirectDeviceId localDevic String(*pGetMacAddressFunction)(const WifiDirectDeviceInfo& deviceinfo) = null; // Get MAC address of the client - pGetMacAddressFunction = reinterpret_cast(dlsym(__pDllHandle, "_WifiDirectDeviceInfoImpl_GetVirtualMacAddress")); + pGetMacAddressFunction = reinterpret_cast(dlsym(__pDllHandle, "_WifiDirectDeviceInfoImpl_GetMacAddress")); SysTryReturnVoidResult(NID_NET, pGetMacAddressFunction != null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get a function pointer.", GetErrorMessage(E_SYSTEM)); @@ -939,7 +939,7 @@ _LocalDhcpServerImpl::OnWifiDirectClientDisassociated(WifiDirectDeviceId localDe String(*pGetMacAddressFunction)(const WifiDirectDeviceInfo& deviceinfo) = null; // Get MAC address of the client - pGetMacAddressFunction = reinterpret_cast(dlsym(__pDllHandle, "_WifiDirectDeviceInfoImpl_GetVirtualMacAddress")); + pGetMacAddressFunction = reinterpret_cast(dlsym(__pDllHandle, "_WifiDirectDeviceInfoImpl_GetMacAddress")); SysTryReturnVoidResult(NID_NET, pGetMacAddressFunction != null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get a function pointer.", GetErrorMessage(E_SYSTEM)); @@ -992,7 +992,7 @@ _LocalDhcpServerImpl::ConvertDhcpClientInfo(const WifiDirectDeviceInfo& wifiDire "A system error has been occurred. Failed to get a function pointer."); pGetMacAddressFunction = reinterpret_cast - (dlsym(__pDllHandle, "_WifiDirectDeviceInfoImpl_GetVirtualMacAddress")); + (dlsym(__pDllHandle, "_WifiDirectDeviceInfoImpl_GetMacAddress")); SysTryReturnResult(NID_NET, pGetMacAddressFunction != null, E_SYSTEM, "A system error has been occurred. Failed to get a function pointer."); @@ -1090,9 +1090,9 @@ _LocalDhcpServerImpl::ConvertDhcpClientInfo(const wifi_direct_connected_peer_inf "A system error has been occurred. Failed to get DhcpClientInfo instance."); pDhcpClientInfoImpl->__dhcpClientName = String(pPeerInfo->device_name); - pDhcpClientInfoImpl->__macAddress = ConvertMacAddress((char*)pPeerInfo->interface_address); + pDhcpClientInfoImpl->__macAddress = ConvertMacAddress((char*)pPeerInfo->mac_address); - pDhcpClientInfoImpl->__pLocalAddress.reset(new (std::nothrow) Ip4Address(pPeerInfo->ip_address)); + pDhcpClientInfoImpl->__pLocalAddress.reset(new (std::nothrow) Ip4Address(pPeerInfo->ip_address)); SysTryReturnResult(NID_NET, pDhcpClientInfoImpl->__pLocalAddress != null, E_OUT_OF_MEMORY, "Memory allocation failed"); return r; diff --git a/src/FNet_NetAccountDatabase.cpp b/src/FNet_NetAccountDatabase.cpp index 7a8c6e5..8f60328 100644 --- a/src/FNet_NetAccountDatabase.cpp +++ b/src/FNet_NetAccountDatabase.cpp @@ -364,6 +364,59 @@ _NetAccountDatabase::GetAccountNamesN(void) } IList* +_NetAccountDatabase::GetProfileNamesN(void) +{ + static const wchar_t _NET_ACCOUNT_DATABASE_GET_PROFILE_NAMES_STATEMENT[] = + L"SELECT profileName FROM NetAccountTable"; + + result r = E_SUCCESS; + Database accountDb; + unique_ptr pStmt; + unique_ptr pEnum; + unique_ptr pList; + + r = accountDb.Construct(_NetAccountDatabase::GetDbPath(), false); + SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); + + pStmt.reset(accountDb.CreateStatementN(String(_NET_ACCOUNT_DATABASE_GET_PROFILE_NAMES_STATEMENT))); + r = GetLastResult(); + SysTryReturn(NID_NET, pStmt != null, null, r, "[%s] Propagating.", GetErrorMessage(r)); + + pList.reset(new (std::nothrow) ArrayList()); + r = GetLastResult(); + SysTryReturn(NID_NET, pList != null, null, r, "[%s] Propagating.", GetErrorMessage(r)); + + r = pList->Construct(); + SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); + + pEnum.reset(accountDb.ExecuteStatementN(*pStmt)); + r = GetLastResult(); + SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); + + if (pEnum != null) + { + while (pEnum->MoveNext() == E_SUCCESS) + { + unique_ptr pProfileName(new (std::nothrow) String()); + SysTryReturn(NID_NET, pProfileName != null, null, E_OUT_OF_MEMORY, + "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + + r = pEnum->GetStringAt(0, *pProfileName); + SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); + + r = pList->Add(*pProfileName); + SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); + + pProfileName.release(); + } + } + + ClearLastResult(); // To suppress E_OUT_OF_RANGE + + return pList.release(); +} + +IList* _NetAccountDatabase::GetAppProfileNamesN(void) { static const wchar_t _NET_ACCOUNT_DATABASE_GET_PROFILE_NAMES_STATEMENT[] = diff --git a/src/FNet_NetAccountDatabase.h b/src/FNet_NetAccountDatabase.h index c40a05a..21e7e73 100644 --- a/src/FNet_NetAccountDatabase.h +++ b/src/FNet_NetAccountDatabase.h @@ -66,6 +66,7 @@ public: static result UpdateAccountName(NetAccountId accountId, const Tizen::Base::String& accountName); static Tizen::Base::Collection::IListT* GetAccountIdsN(void); static Tizen::Base::Collection::IList* GetAccountNamesN(void); + static Tizen::Base::Collection::IList* GetProfileNamesN(void); static Tizen::Base::Collection::IList* GetAppProfileNamesN(void); static result GetAccountName(NetAccountId accountId, Tizen::Base::String& accountName); static result GetProfileName(NetAccountId accountId, Tizen::Base::String& profileName); diff --git a/src/FNet_NetAccountInfoImpl.cpp b/src/FNet_NetAccountInfoImpl.cpp index 3eca91a..56e023d 100644 --- a/src/FNet_NetAccountInfoImpl.cpp +++ b/src/FNet_NetAccountInfoImpl.cpp @@ -177,9 +177,9 @@ _NetAccountInfoImpl::Construct(NetAccountInfo* pAccountInfo, void* pProfileHandl char* pAuthPassword = null; char* pHomeUrl = null; - ret = connection_profile_get_name(profileHandle, &pProfileName); + ret = connection_profile_get_id(profileHandle, &pProfileName); SysTryReturnResult(NID_NET, ret == CONNECTION_ERROR_NONE, E_SYSTEM, - "A system error has been occurred. The return value from connection_profile_get_name() is %d", ret); + "A system error has been occurred. The return value from connection_profile_get_id() is %d", ret); profileName = String(pProfileName); free(pProfileName); diff --git a/src/FNet_NetAccountManagerImpl.cpp b/src/FNet_NetAccountManagerImpl.cpp index 8f9e5ba..6c5bfd1 100644 --- a/src/FNet_NetAccountManagerImpl.cpp +++ b/src/FNet_NetAccountManagerImpl.cpp @@ -43,6 +43,32 @@ namespace Tizen { namespace Net { static const char _WIFI_LIBRARY_NAME[] = "libosp-wifi.so"; +_NetProfileInfo::_NetProfileInfo(void) +{ +} + +_NetProfileInfo::_NetProfileInfo(const String& profileName, const String& profileDisplayName) + : __profileName(profileName) + , __profileDisplayName(profileDisplayName) +{ +} + +_NetProfileInfo::~_NetProfileInfo(void) +{ +} + +String +_NetProfileInfo::GetProfileName(void) const +{ + return __profileName; +} + +String +_NetProfileInfo::GetProfileDisplayName(void) const +{ + return __profileDisplayName; +} + _NetAccountManagerImpl::_NetAccountManagerImpl(void) : __pConnectionHandle(null) { @@ -466,9 +492,9 @@ _NetAccountManagerImpl::GetPsProfileHandleN(const String& profileName) char* pTempProfileName = null; String tempProfileName; - ret = connection_profile_get_name(profileHandle, &pTempProfileName); + ret = connection_profile_get_id(profileHandle, &pTempProfileName); SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, null, E_SYSTEM, - "[%s] A system error has been occurred. The return value from connection_profile_get_name() is %d", + "[%s] A system error has been occurred. The return value from connection_profile_get_id() is %d", GetErrorMessage(E_SYSTEM), ret); tempProfileName = String(pTempProfileName); @@ -548,92 +574,122 @@ _NetAccountManagerImpl::GetWifiProfileHandleN(void) return matchingProfileHandle; } -String -_NetAccountManagerImpl::GetInternetProfileName(void) +_NetProfileInfo +_NetAccountManagerImpl::GetInternetProfileInfo(void) { ClearLastResult(); - String profileName; + _NetProfileInfo profileInfo; int ret = CONNECTION_ERROR_NONE; connection_h connectionHandle = null; - connection_profile_iterator_h iterator = null; connection_profile_h profileHandle = null; - connection_profile_type_e profileType = CONNECTION_PROFILE_TYPE_WIFI; ret = connection_create(&connectionHandle); - SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileName, E_SYSTEM, + SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileInfo, E_SYSTEM, "[%s] A system error has been occurred. The return value from connection_create() is %d", GetErrorMessage(E_SYSTEM), ret); unique_ptr pConnectionHandle(connectionHandle); - ret = connection_get_profile_iterator(connectionHandle, - CONNECTION_ITERATOR_TYPE_REGISTERED, &iterator); - SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileName, E_SYSTEM, - "[%s] A system error has been occurred. The return value from connection_get_profile_iterator() is %d", + ret = connection_get_default_cellular_service_profile(connectionHandle, CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET, &profileHandle); + if ((ret != CONNECTION_ERROR_NONE) || (profileHandle == null)) + { + SysLog(NID_NET, "Internet profile is not found, so search a prepaid-Internet profile."); + + ret = connection_get_default_cellular_service_profile(connectionHandle, CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET, &profileHandle); + } + SysTryReturn(NID_NET, profileHandle != null, profileInfo, E_INVALID_ACCOUNT, + "[%s] Internet(incl. prepaid) profile is not found.", GetErrorMessage(E_INVALID_ACCOUNT)); + unique_ptr pProfileHandle(profileHandle); + + char* pProfileName = null; + char* pProfileDisplayName = null; + String profileName; + String profileDisplayName; + + ret = connection_profile_get_id(profileHandle, &pProfileName); + SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileInfo, E_SYSTEM, + "[%s] A system error has been occurred. The return value from connection_profile_get_id() is %d", GetErrorMessage(E_SYSTEM), ret); - unique_ptr pIterator(iterator); - ret = connection_profile_iterator_next(iterator, &profileHandle); - while ((ret == CONNECTION_ERROR_NONE) && (profileHandle != null)) - { - char* pProfileName = null; + profileName = String(pProfileName); + free(pProfileName); - ret = connection_profile_get_type(profileHandle, &profileType); - SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileName, E_SYSTEM, - "[%s] A system error has been occurred. The return value from connection_profile_get_type() is %d", - GetErrorMessage(E_SYSTEM), ret); + ret = connection_profile_get_name(profileHandle, &pProfileDisplayName); + SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileInfo, E_SYSTEM, + "[%s] A system error has been occurred. The return value from connection_profile_get_name() is %d", + GetErrorMessage(E_SYSTEM), ret); - if (profileType == CONNECTION_PROFILE_TYPE_CELLULAR) - { - connection_cellular_service_type_e serviceType = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN; + profileDisplayName = String(pProfileDisplayName); + free(pProfileDisplayName); - ret = connection_profile_get_cellular_service_type(profileHandle, &serviceType); - SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileName, E_SYSTEM, - "[%s] A system error has been occurred. The return value from connection_profile_get_cellular_service_type() is %d", - GetErrorMessage(E_SYSTEM), ret); + profileInfo = _NetProfileInfo(profileName, profileDisplayName); - ret = connection_profile_get_name(profileHandle, &pProfileName); - SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileName, E_SYSTEM, - "[%s] A system error has been occurred. The return value from connection_profile_get_name() is %d", - GetErrorMessage(E_SYSTEM), ret); + SysLog(NID_NET, "GetInternetProfileInfo() has been succeeded with profile[%ls][%ls]", profileInfo.GetProfileDisplayName().GetPointer(), profileInfo.GetProfileName().GetPointer()); - profileName = String(pProfileName); - free(pProfileName); + return profileInfo; +} - if ((serviceType == CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET) - || (serviceType == CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET)) - { - SysLog(NID_NET, "Internet profile is found."); - break; - } - else - { - profileName.Clear(); - } - } - else - { - SysLog(NID_NET, "Ignore non-cellular profile."); - } +_NetProfileInfo +_NetAccountManagerImpl::GetMmsProfileInfo(void) +{ + ClearLastResult(); - profileHandle = null; - ret = connection_profile_iterator_next(iterator, &profileHandle); + _NetProfileInfo profileInfo; + int ret = CONNECTION_ERROR_NONE; + connection_h connectionHandle = null; + connection_profile_h profileHandle = null; + + ret = connection_create(&connectionHandle); + SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileInfo, E_SYSTEM, + "[%s] A system error has been occurred. The return value from connection_create() is %d", + GetErrorMessage(E_SYSTEM), ret); + unique_ptr pConnectionHandle(connectionHandle); + + ret = connection_get_default_cellular_service_profile(connectionHandle, CONNECTION_CELLULAR_SERVICE_TYPE_MMS, &profileHandle); + if ((ret != CONNECTION_ERROR_NONE) || (profileHandle == null)) + { + SysLog(NID_NET, "MMS profile is not found, so search a prepaid-MMS profile."); + + ret = connection_get_default_cellular_service_profile(connectionHandle, CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_MMS, &profileHandle); } + SysTryReturn(NID_NET, profileHandle != null, profileInfo, E_INVALID_ACCOUNT, + "[%s] MMS(incl. prepaid) profile is not found.", GetErrorMessage(E_INVALID_ACCOUNT)); + unique_ptr pProfileHandle(profileHandle); + + char* pProfileName = null; + char* pProfileDisplayName = null; + String profileName; + String profileDisplayName; + + ret = connection_profile_get_id(profileHandle, &pProfileName); + SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileInfo, E_SYSTEM, + "[%s] A system error has been occurred. The return value from connection_profile_get_id() is %d", + GetErrorMessage(E_SYSTEM), ret); - SysTryReturn(NID_NET, !profileName.IsEmpty(), profileName, E_INVALID_ACCOUNT, - "[%s] Internet profile is not found.", GetErrorMessage(E_INVALID_ACCOUNT)); + profileName = String(pProfileName); + free(pProfileName); - SysLog(NID_NET, "GetInternetProfileName() has been succeeded with profile:%ls", profileName.GetPointer()); + ret = connection_profile_get_name(profileHandle, &pProfileDisplayName); + SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileInfo, E_SYSTEM, + "[%s] A system error has been occurred. The return value from connection_profile_get_name() is %d", + GetErrorMessage(E_SYSTEM), ret); + + profileDisplayName = String(pProfileDisplayName); + free(pProfileDisplayName); + + profileInfo = _NetProfileInfo(profileName, profileDisplayName); - return profileName; + SysLog(NID_NET, "GetMmsProfileInfo() has been succeeded with profile[%ls][%ls]", profileInfo.GetProfileDisplayName().GetPointer(), profileInfo.GetProfileName().GetPointer()); + + return profileInfo; } -String -_NetAccountManagerImpl::GetMmsProfileName(void) +IList* +_NetAccountManagerImpl::GetAppProfileNamesN(void) { ClearLastResult(); - String profileName; + result r = E_SUCCESS; int ret = CONNECTION_ERROR_NONE; connection_h connectionHandle = null; connection_profile_iterator_h iterator = null; @@ -641,14 +697,20 @@ _NetAccountManagerImpl::GetMmsProfileName(void) connection_profile_type_e profileType = CONNECTION_PROFILE_TYPE_WIFI; ret = connection_create(&connectionHandle); - SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileName, E_SYSTEM, + SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred. The return value from connection_create() is %d", GetErrorMessage(E_SYSTEM), ret); unique_ptr pConnectionHandle(connectionHandle); - ret = connection_get_profile_iterator(connectionHandle, - CONNECTION_ITERATOR_TYPE_REGISTERED, &iterator); - SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileName, E_SYSTEM, + unique_ptr pList(new (std::nothrow) ArrayList()); + SysTryReturn(NID_NET, pList != null, null, E_OUT_OF_MEMORY, + "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + + r = pList->Construct(); + SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); + + ret = connection_get_profile_iterator(connectionHandle, CONNECTION_ITERATOR_TYPE_REGISTERED, &iterator); + SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred. The return value from connection_get_profile_iterator() is %d", GetErrorMessage(E_SYSTEM), ret); unique_ptr pIterator(iterator); @@ -659,37 +721,38 @@ _NetAccountManagerImpl::GetMmsProfileName(void) char* pProfileName = null; ret = connection_profile_get_type(profileHandle, &profileType); - SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileName, E_SYSTEM, + SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred. The return value from connection_profile_get_type() is %d", - GetErrorMessage(E_SYSTEM), ret); + GetErrorMessage(E_SYSTEM), ret); if (profileType == CONNECTION_PROFILE_TYPE_CELLULAR) { connection_cellular_service_type_e serviceType = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN; - ret = connection_profile_get_cellular_service_type(profileHandle, - &serviceType); - SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileName, E_SYSTEM, + ret = connection_profile_get_cellular_service_type(profileHandle, &serviceType); + SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred. The return value from connection_profile_get_cellular_service_type() is %d", GetErrorMessage(E_SYSTEM), ret); - ret = connection_profile_get_name(profileHandle, &pProfileName); - SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, profileName, E_SYSTEM, - "[%s] A system error has been occurred. The return value from connection_profile_get_name() is %d", - GetErrorMessage(E_SYSTEM), ret); + if (serviceType == CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION) + { + ret = connection_profile_get_id(profileHandle, &pProfileName); + SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, null, E_SYSTEM, + "[%s] A system error has been occurred. The return value from connection_profile_get_id() is %d", + GetErrorMessage(E_SYSTEM), ret); - profileName = String(pProfileName); - free(pProfileName); + unique_ptr pProfileNameString(new (std::nothrow) String(pProfileName)); + free(pProfileName); + SysTryReturn(NID_NET, pProfileNameString != null, null, E_OUT_OF_MEMORY, + "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - if ((serviceType == CONNECTION_CELLULAR_SERVICE_TYPE_MMS) - || (serviceType == CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_MMS)) - { - SysLog(NID_NET, "MMS profile is found."); - break; + r = pList->Add(*pProfileNameString); + SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); + pProfileNameString.release(); } else { - profileName.Clear(); + SysLog(NID_NET, "Ignore non-app profile."); } } else @@ -701,16 +764,13 @@ _NetAccountManagerImpl::GetMmsProfileName(void) ret = connection_profile_iterator_next(iterator, &profileHandle); } - SysTryReturn(NID_NET, !profileName.IsEmpty(), profileName, E_INVALID_ACCOUNT, - "[%s] MMS profile is not found.", GetErrorMessage(E_INVALID_ACCOUNT)); - - SysLog(NID_NET, "GetMmsProfileName() has been succeeded with profile:%ls", profileName.GetPointer()); + SysLog(NID_NET, "GetAppProfileNamesN() has been succeeded with profiles count:%d", pList->GetCount()); - return profileName; + return pList.release(); } IList* -_NetAccountManagerImpl::GetAppProfileNamesN(void) +_NetAccountManagerImpl::GetAllProfileInfosN(void) { ClearLastResult(); @@ -743,8 +803,6 @@ _NetAccountManagerImpl::GetAppProfileNamesN(void) ret = connection_profile_iterator_next(iterator, &profileHandle); while ((ret == CONNECTION_ERROR_NONE) && (profileHandle != null)) { - char* pProfileName = null; - ret = connection_profile_get_type(profileHandle, &profileType); SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred. The return value from connection_profile_get_type() is %d", @@ -759,21 +817,38 @@ _NetAccountManagerImpl::GetAppProfileNamesN(void) "[%s] A system error has been occurred. The return value from connection_profile_get_cellular_service_type() is %d", GetErrorMessage(E_SYSTEM), ret); - if (serviceType == CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION) + if ((serviceType == CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET) + || (serviceType == CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET) + || (serviceType == CONNECTION_CELLULAR_SERVICE_TYPE_MMS) + || (serviceType == CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_MMS) + || (serviceType == CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION)) { - ret = connection_profile_get_name(profileHandle, &pProfileName); + char* pProfileName = null; + char* pProfileDisplayName = null; + String profileName; + String profileDisplayName; + + ret = connection_profile_get_id(profileHandle, &pProfileName); + SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, null, E_SYSTEM, + "[%s] A system error has been occurred. The return value from connection_profile_get_id() is %d", + GetErrorMessage(E_SYSTEM), ret); + profileName = String(pProfileName); + free(pProfileName); + + ret = connection_profile_get_name(profileHandle, &pProfileDisplayName); SysTryReturn(NID_NET, ret == CONNECTION_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred. The return value from connection_profile_get_name() is %d", GetErrorMessage(E_SYSTEM), ret); + profileDisplayName = String(pProfileDisplayName); + free(pProfileDisplayName); - unique_ptr pProfileNameString(new (std::nothrow) String(pProfileName)); - free(pProfileName); - SysTryReturn(NID_NET, pProfileNameString != null, null, E_OUT_OF_MEMORY, - "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + unique_ptr<_NetProfileInfo> pProfileInfo(new (std::nothrow) _NetProfileInfo(profileName, profileDisplayName)); - r = pList->Add(*pProfileNameString); + SysLog(NID_NET, "Cellular profile is found: [%d][%ls][%ls].", serviceType, profileDisplayName.GetPointer(), profileName.GetPointer()); + + r = pList->Add(*pProfileInfo); SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); - pProfileNameString.release(); + pProfileInfo.release(); } else { @@ -789,7 +864,7 @@ _NetAccountManagerImpl::GetAppProfileNamesN(void) ret = connection_profile_iterator_next(iterator, &profileHandle); } - SysLog(NID_NET, "GetAppProfileNamesN() has been succeeded with profiles count:%d", pList->GetCount()); + SysLog(NID_NET, "GetAllProfileInfosN() has been succeeded with profiles count:%d", pList->GetCount()); return pList.release(); } diff --git a/src/FNet_NetAccountManagerImpl.h b/src/FNet_NetAccountManagerImpl.h index f9fdbbc..4e7adb4 100644 --- a/src/FNet_NetAccountManagerImpl.h +++ b/src/FNet_NetAccountManagerImpl.h @@ -24,14 +24,10 @@ #include #include +#include #include #include "FNet_NetUtility.h" -namespace Tizen { namespace Base -{ -class String; -} } // Tizen::Base - namespace Tizen { namespace Base { namespace Collection { class IList; @@ -43,6 +39,22 @@ class NetAccountInfo; class NetAccountManager; class _PsSystemNetConnection; +class _NetProfileInfo + : public Tizen::Base::Object +{ +public: + _NetProfileInfo(void); + _NetProfileInfo(const Tizen::Base::String& profileName, const Tizen::Base::String& profileDisplayName); + ~_NetProfileInfo(void); + + Tizen::Base::String GetProfileName(void) const; + Tizen::Base::String GetProfileDisplayName(void) const; + +private: + Tizen::Base::String __profileName; + Tizen::Base::String __profileDisplayName; +}; // _NetProfileInfo + class _NetAccountManagerImpl : public Tizen::Base::Object { @@ -137,9 +149,10 @@ public: public: static void* GetPsProfileHandleN(const Tizen::Base::String& profileName); static void* GetWifiProfileHandleN(void); - static Tizen::Base::String GetInternetProfileName(void); - static Tizen::Base::String GetMmsProfileName(void); + static _NetProfileInfo GetInternetProfileInfo(void); + static _NetProfileInfo GetMmsProfileInfo(void); static Tizen::Base::Collection::IList* GetAppProfileNamesN(void); + static Tizen::Base::Collection::IList* GetAllProfileInfosN(void); static NetAccountInfo* CreateWifiNetAccountInfoN(void* pProfileInfo); private: diff --git a/src/FNet_NetIpcProxy.cpp b/src/FNet_NetIpcProxy.cpp index 16c14ea..6cd15ae 100644 --- a/src/FNet_NetIpcProxy.cpp +++ b/src/FNet_NetIpcProxy.cpp @@ -158,4 +158,40 @@ _NetIpcProxy::SetNetAccountId(NetAccountId netAccountId, NetAccountId& netAccoun return r; } +result +_NetIpcProxy::ResetNetStatistics(NetBearerType bearerType, NetStatisticsInfoType statType) +{ + result r = E_SUCCESS; + unsigned long ret = 0; + + SysLog(NID_NET, "ResetNetStatistics() has been called with bearer:%d stat:%d", bearerType, statType); + + unique_ptr pMessage(new (std::nothrow) ConnectivityNetServiceMsg_resetNetStatistics(bearerType, statType, &ret)); + SysTryReturnResult(NID_NET, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed."); + + r = __pIpcClient->SendRequest(*pMessage); + SysTryReturnResult(NID_NET, r == E_SUCCESS, E_SYSTEM, "A system error has been occurred."); + SysTryReturnResult(NID_NET, ret == E_SUCCESS, ret, "Propagating."); + + return r; +} + +result +_NetIpcProxy::ResetAllNetStatistics(NetBearerType bearerType) +{ + result r = E_SUCCESS; + unsigned long ret = 0; + + SysLog(NID_NET, "ResetAllNetStatistics() has been called with bearer:%d", bearerType); + + unique_ptr pMessage(new (std::nothrow) ConnectivityNetServiceMsg_resetAllNetStatistics(bearerType, &ret)); + SysTryReturnResult(NID_NET, pMessage != null, E_OUT_OF_MEMORY, "Memory allocation failed."); + + r = __pIpcClient->SendRequest(*pMessage); + SysTryReturnResult(NID_NET, r == E_SUCCESS, E_SYSTEM, "A system error has been occurred."); + SysTryReturnResult(NID_NET, ret == E_SUCCESS, ret, "Propagating."); + + return r; +} + }} // Tizen::Net diff --git a/src/FNet_NetIpcProxy.h b/src/FNet_NetIpcProxy.h index 292120a..b91bcc5 100644 --- a/src/FNet_NetIpcProxy.h +++ b/src/FNet_NetIpcProxy.h @@ -57,6 +57,8 @@ public: result GetAppNetAccountId(const Tizen::Base::String& netProfileName, NetAccountId& netAccountId) const; result SetNetAccountId(NetAccountId netAccountId, NetAccountId& netAccountId2); result UpdateSystemNetAccount(const Tizen::Base::String& profileName, const NetAccountInfo& netAccountInfo, NetBearerType bearerType); + result ResetNetStatistics(NetBearerType bearerType, NetStatisticsInfoType statType); + result ResetAllNetStatistics(NetBearerType bearerType); private: _NetIpcProxy(void); diff --git a/src/FNet_NetStatisticsImpl.cpp b/src/FNet_NetStatisticsImpl.cpp index bd595da..b8e0940 100644 --- a/src/FNet_NetStatisticsImpl.cpp +++ b/src/FNet_NetStatisticsImpl.cpp @@ -25,6 +25,7 @@ #include #include "FNet_NetTypes.h" #include "FNet_NetStatisticsImpl.h" +#include "FNet_NetIpcProxy.h" using namespace Tizen::Base; @@ -167,151 +168,35 @@ _NetStatisticsImpl::GetNetStatisticsInfo(NetBearerType operationMode, NetStatist result _NetStatisticsImpl::Reset(NetBearerType operationMode, NetStatisticsInfoType netStatType) { - int err = CONNECTION_ERROR_NONE; - SysAssertf(__isConstructed, "Not yet constructed. Construct() should be called before use."); - SysTryReturnResult(NID_NET, (operationMode == NET_BEARER_WIFI || operationMode == NET_BEARER_PS), - E_INVALID_ARG, "Invalid argument is used."); - - //Reset net statistics info based on type - switch (netStatType) - { - //supported cases - case NET_STAT_RCVD_SIZE: - if (operationMode == NET_BEARER_PS) - { - err = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA); - } - else if (operationMode == NET_BEARER_WIFI) - { - err = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA); - } - else - { - // should not reach here. - SysLog(NID_NET, "_NetStatisticsImpl::Reset invalid mode: %d", operationMode); - SysTryReturnResult(NID_NET, false, E_INVALID_ARG, "Invalid argument is used."); - } - - break; - - case NET_STAT_SENT_SIZE: - if (operationMode == NET_BEARER_PS) - { - err = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA); - } - else if (operationMode == NET_BEARER_WIFI) - { - err = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA); - } - else - { - // should not reach here. - SysLog(NID_NET, "_NetStatisticsImpl::Reset invalid mode: %d", operationMode); - SysTryReturnResult(NID_NET, false, E_INVALID_ARG, "Invalid argument is used."); - } - - break; - - case NET_STAT_TOTAL_RCVD_SIZE: - if (operationMode == NET_BEARER_PS) - { - err = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA); - } - else if (operationMode == NET_BEARER_WIFI) - { - err = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA); - } - else - { - // should not reach here. - SysLog(NID_NET, "_NetStatisticsImpl::Reset invalid mode: %d", operationMode); - SysTryReturnResult(NID_NET, false, E_INVALID_ARG, "Invalid argument is used."); - } - - break; - - case NET_STAT_TOTAL_SENT_SIZE: - if (operationMode == NET_BEARER_PS) - { - err = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA); - } - else if (operationMode == NET_BEARER_WIFI) - { - err = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA); - } - else - { - // should not reach here. - SysLog(NID_NET, "_NetStatisticsImpl::Reset invalid mode: %d", operationMode); - SysTryReturnResult(NID_NET, false, E_INVALID_ARG, "Invalid argument is used."); - } - - break; + result r = E_SUCCESS; - default: - SysTryReturnResult(NID_NET, false, E_INVALID_ARG, "Invalid argument is used."); + _NetIpcProxy* pProxy = _NetIpcProxy::GetInstance(); + SysTryReturnResult(NID_NET, pProxy != null, E_SYSTEM, + "A system error has been occurred. Failed to get an IPC proxy."); - break; - } + r = pProxy->ResetNetStatistics(operationMode, netStatType); + SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating."); - // make sure u catch error - SysLog(NID_NET, "_NetStatisticsImpl::Reset err code: %d", err); - SysTryReturnResult(NID_NET, err == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Operation failed ."); - - return E_SUCCESS; + return r; } result _NetStatisticsImpl::ResetAll(NetBearerType operationMode) { - int err = CONNECTION_ERROR_NONE; - SysAssertf(__isConstructed, "Not yet constructed. Construct() should be called before use."); - //we support only PS and WIFI - if (operationMode == NET_BEARER_PS) - { - err = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA); - SysTryReturnResult(NID_NET, err == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Operation failed ."); - - err = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA); - SysTryReturnResult(NID_NET, err == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Operation failed ."); - - err = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA); - SysTryReturnResult(NID_NET, err == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Operation failed ."); - - err = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA); - SysTryReturnResult(NID_NET, err == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Operation failed ."); - - } - else if (operationMode == NET_BEARER_WIFI) - { - err = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA); - SysTryReturnResult(NID_NET, err == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Operation failed ."); - - err = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA); - SysTryReturnResult(NID_NET, err == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Operation failed ."); - - err = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA); - SysTryReturnResult(NID_NET, err == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Operation failed ."); - - err = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA); - SysTryReturnResult(NID_NET, err == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Operation failed ."); - } - else - { - // we dont support other bearer types - SysTryReturnResult(NID_NET, false, E_INVALID_ARG, "Invalid argument is used."); + result r = E_SUCCESS; - } + _NetIpcProxy* pProxy = _NetIpcProxy::GetInstance(); + SysTryReturnResult(NID_NET, pProxy != null, E_SYSTEM, + "A system error has been occurred. Failed to get an IPC proxy."); - // make sure u catch error - SysLog(NID_NET, "_NetStatisticsImpl::ResetAll err code: %d", err); - SysTryReturnResult(NID_NET, err == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Operation failed ."); + r = pProxy->ResetAllNetStatistics(operationMode); + SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating."); - return E_SUCCESS; + return r; } _NetStatisticsImpl* diff --git a/src/FNet_PsSystemNetConnection.cpp b/src/FNet_PsSystemNetConnection.cpp index a95da7a..672f4f2 100644 --- a/src/FNet_PsSystemNetConnection.cpp +++ b/src/FNet_PsSystemNetConnection.cpp @@ -49,18 +49,21 @@ PsOpenCallback(connection_error_e res, void* pUserData) NetConnectionState connectionState = pConnection->GetConnectionState(); bool isConnected = false; char* pProfileName = null; + char* pProfileDisplayName = null; int ret = CONNECTION_ERROR_NONE; connection_profile_h profileHandle = pConnection->GetProfileHandle(); connection_profile_state_e state = CONNECTION_PROFILE_STATE_DISCONNECTED; ret = connection_profile_refresh(profileHandle); SysLog(NID_NET, "The return value from connection_profile_refresh() is %d", ret); - ret = connection_profile_get_name(profileHandle, &pProfileName); + ret = connection_profile_get_id(profileHandle, &pProfileName); + SysLog(NID_NET, "The return value from connection_profile_get_id() is %d", ret); + ret = connection_profile_get_name(profileHandle, &pProfileDisplayName); SysLog(NID_NET, "The return value from connection_profile_get_name() is %d", ret); ret = connection_profile_get_state(profileHandle, &state); SysLog(NID_NET, "The return value from connection_profile_get_state() is %d", ret); - SysLog(NID_NET, "PsOpenCallback() has been called with res:%d, state:%d, name%s", res, state, pProfileName); + SysLog(NID_NET, "PsOpenCallback() has been called with res:%d, state:%d, name:[%s][%s]", res, state, pProfileDisplayName, pProfileName); if ((res == CONNECTION_ERROR_NONE) && (state == CONNECTION_PROFILE_STATE_CONNECTED)) { @@ -74,6 +77,7 @@ PsOpenCallback(connection_error_e res, void* pUserData) } free(pProfileName); + free(pProfileDisplayName); if (connectionState != NET_CONNECTION_STATE_STARTING) { @@ -98,18 +102,21 @@ PsCloseCallback(connection_error_e res, void* pUserData) NetConnectionState connectionState = pConnection->GetConnectionState(); bool isConnected = false; char* pProfileName = null; + char* pProfileDisplayName = null; int ret = CONNECTION_ERROR_NONE; connection_profile_h profileHandle = pConnection->GetProfileHandle(); connection_profile_state_e state = CONNECTION_PROFILE_STATE_DISCONNECTED; ret = connection_profile_refresh(profileHandle); SysLog(NID_NET, "The return value from connection_profile_refresh() is %d", ret); - ret = connection_profile_get_name(profileHandle, &pProfileName); + ret = connection_profile_get_id(profileHandle, &pProfileName); + SysLog(NID_NET, "The return value from connection_profile_get_id() is %d", ret); + ret = connection_profile_get_name(profileHandle, &pProfileDisplayName); SysLog(NID_NET, "The return value from connection_profile_get_name() is %d", ret); ret = connection_profile_get_state(profileHandle, &state); SysLog(NID_NET, "The return value from connection_profile_get_state() is %d", ret); - SysLog(NID_NET, "PsCloseCallback() has been called with res:%d, state:%d, name:%s", res, state, pProfileName); + SysLog(NID_NET, "PsCloseCallback() has been called with res:%d, state:%d, name:[%s][%s]", res, state, pProfileDisplayName, pProfileName); if ((res == CONNECTION_ERROR_NONE) && (state == CONNECTION_PROFILE_STATE_CONNECTED)) { @@ -123,6 +130,7 @@ PsCloseCallback(connection_error_e res, void* pUserData) } free(pProfileName); + free(pProfileDisplayName); if (connectionState != NET_CONNECTION_STATE_STOPPING) { @@ -140,15 +148,18 @@ PsStateChangedCallback(connection_profile_state_e state, void* pUserData) NetConnectionState connectionState = pConnection->GetConnectionState(); bool isConnected = false; char* pProfileName = null; + char* pProfileDisplayName = null; int ret = CONNECTION_ERROR_NONE; connection_profile_h profileHandle = pConnection->GetProfileHandle(); ret = connection_profile_refresh(profileHandle); SysLog(NID_NET, "The return value from connection_profile_refresh() is %d", ret); - ret = connection_profile_get_name(profileHandle, &pProfileName); + ret = connection_profile_get_id(profileHandle, &pProfileName); + SysLog(NID_NET, "The return value from connection_profile_get_id() is %d", ret); + ret = connection_profile_get_name(profileHandle, &pProfileDisplayName); SysLog(NID_NET, "The return value from connection_profile_get_name() is %d", ret); - SysLog(NID_NET, "PsStateChangedCallback() has been called with state:%d, name:%s", state, pProfileName); + SysLog(NID_NET, "PsStateChangedCallback() has been called with state:%d, name:[%s][%s]", state, pProfileDisplayName, pProfileName); if (state == CONNECTION_PROFILE_STATE_CONNECTED) { @@ -162,6 +173,7 @@ PsStateChangedCallback(connection_profile_state_e state, void* pUserData) } free(pProfileName); + free(pProfileDisplayName); if ((connectionState == NET_CONNECTION_STATE_STARTING) || (connectionState == NET_CONNECTION_STATE_STOPPING)) { diff --git a/src/FNet_SystemNetConnection.cpp b/src/FNet_SystemNetConnection.cpp index 89d817d..8c5a8ad 100644 --- a/src/FNet_SystemNetConnection.cpp +++ b/src/FNet_SystemNetConnection.cpp @@ -398,6 +398,7 @@ _SystemNetConnection::InitializeNetworkFrameworkOnce(void) { result r = E_SUCCESS; NetAccountId accountId = INVALID_HANDLE; + String accountName; __pPsSystemConnectionMap = new (std::nothrow) HashMap(); SysTryReturnVoidResult(NID_NET, __pPsSystemConnectionMap != null, E_OUT_OF_MEMORY, @@ -413,12 +414,12 @@ _SystemNetConnection::InitializeNetworkFrameworkOnce(void) SysTryReturnVoidResult(NID_NET, r == E_SUCCESS, r, "[%s] A system error has been occurred. Failed to initialize the network database.", GetErrorMessage(r)); - String internetProfileName = _NetAccountManagerImpl::GetInternetProfileName(); - String mmsProfileName = _NetAccountManagerImpl::GetMmsProfileName(); + _NetProfileInfo internetProfileInfo = _NetAccountManagerImpl::GetInternetProfileInfo(); + _NetProfileInfo mmsProfileInfo = _NetAccountManagerImpl::GetMmsProfileInfo(); String profileName; r = _NetAccountDatabase::GetProfileName(_DEFAULT_PS_ACCOUNT_ID, profileName); - if (internetProfileName.IsEmpty()) + if (internetProfileInfo.GetProfileName().IsEmpty()) { SysLog(NID_NET, "Internet profile is not found."); @@ -430,23 +431,29 @@ _SystemNetConnection::InitializeNetworkFrameworkOnce(void) } else { - if (internetProfileName != profileName) + if (internetProfileInfo.GetProfileName() != profileName) { - SysLog(NID_NET, "Internet profile is changed. [%ls] -> [%ls]", profileName.GetPointer(), internetProfileName.GetPointer()); + SysLog(NID_NET, "Internet profile is changed. [%ls] -> [%ls]", profileName.GetPointer(), internetProfileInfo.GetProfileName().GetPointer()); if (!profileName.IsEmpty()) { r = _NetAccountDatabase::RemoveAccountByAccountId(_DEFAULT_PS_ACCOUNT_ID); } - r = _NetAccountDatabase::AddAccount(internetProfileName, internetProfileName, _NET_ACCOUNT_OWNER_SYSTEM_INTERNET, accountId); + r = _NetAccountDatabase::RemoveAccountByProfileName(internetProfileInfo.GetProfileName()); + + accountName.Clear(); + accountName.Append(internetProfileInfo.GetProfileDisplayName()); + accountName.Append(internetProfileInfo.GetProfileName()); + + r = _NetAccountDatabase::AddAccount(accountName, internetProfileInfo.GetProfileName(), _NET_ACCOUNT_OWNER_SYSTEM_INTERNET, accountId); } } profileName.Clear(); r = _NetAccountDatabase::GetProfileName(_DEFAULT_MMS_ACCOUNT_ID, profileName); - if (mmsProfileName.IsEmpty()) + if (mmsProfileInfo.GetProfileName().IsEmpty()) { SysLog(NID_NET, "MMS profile is not found."); @@ -458,21 +465,27 @@ _SystemNetConnection::InitializeNetworkFrameworkOnce(void) } else { - if (mmsProfileName != profileName) + if (mmsProfileInfo.GetProfileName() != profileName) { - SysLog(NID_NET, "MMS profile is changed. [%ls] -> [%ls]", profileName.GetPointer(), mmsProfileName.GetPointer()); + SysLog(NID_NET, "MMS profile is changed. [%ls] -> [%ls]", profileName.GetPointer(), mmsProfileInfo.GetProfileName().GetPointer()); if (!profileName.IsEmpty()) { r = _NetAccountDatabase::RemoveAccountByAccountId(_DEFAULT_MMS_ACCOUNT_ID); } - r = _NetAccountDatabase::AddAccount(mmsProfileName, mmsProfileName, _NET_ACCOUNT_OWNER_SYSTEM_MMS, accountId); + r = _NetAccountDatabase::RemoveAccountByProfileName(mmsProfileInfo.GetProfileName()); + + accountName.Clear(); + accountName.Append(mmsProfileInfo.GetProfileDisplayName()); + accountName.Append(mmsProfileInfo.GetProfileName()); + + r = _NetAccountDatabase::AddAccount(accountName, mmsProfileInfo.GetProfileName(), _NET_ACCOUNT_OWNER_SYSTEM_MMS, accountId); } } - unique_ptr pAccountList(_NetAccountDatabase::GetAppProfileNamesN()); - unique_ptr pProfileList(_NetAccountManagerImpl::GetAppProfileNamesN()); + unique_ptr pAccountList(_NetAccountDatabase::GetProfileNamesN()); + unique_ptr pProfileList(_NetAccountManagerImpl::GetAllProfileInfosN()); if (pProfileList != null) { @@ -483,22 +496,26 @@ _SystemNetConnection::InitializeNetworkFrameworkOnce(void) unique_ptr pEnum(pProfileList->GetEnumeratorN()); if (pEnum != null) { - String* pProfileName = null; + _NetProfileInfo* pProfileInfo = null; while (pEnum->MoveNext() == E_SUCCESS) { - pProfileName = dynamic_cast(pEnum->GetCurrent()); - if (pProfileName != null) + pProfileInfo = dynamic_cast<_NetProfileInfo*>(pEnum->GetCurrent()); + if (pProfileInfo != null) { - if (pAccountList->Contains(*pProfileName)) + if (pAccountList->Contains(pProfileInfo->GetProfileName())) { - SysLog(NID_NET, "ProfileName[%ls] is already on DB.", pProfileName->GetPointer()); - pAccountList->Remove(*pProfileName, true); + SysLog(NID_NET, "ProfileName[%ls] is already on DB.", pProfileInfo->GetProfileName().GetPointer()); + pAccountList->Remove(pProfileInfo->GetProfileName(), true); } else { - // OSP account - SysLog(NID_NET, "ProfileName[%ls] is not found on DB, so add it.", pProfileName->GetPointer()); - r = _NetAccountDatabase::AddAccount(*pProfileName, *pProfileName, _NET_ACCOUNT_OWNER_OTHER, accountId); + // OSP or Non-default account + accountName.Clear(); + accountName.Append(pProfileInfo->GetProfileDisplayName()); + accountName.Append(pProfileInfo->GetProfileName()); + + SysLog(NID_NET, "ProfileName[%ls] is not found on DB, so add it.", pProfileInfo->GetProfileName().GetPointer()); + r = _NetAccountDatabase::AddAccount(accountName, pProfileInfo->GetProfileName(), _NET_ACCOUNT_OWNER_OTHER, accountId); } } } diff --git a/src/http/FNetHttpHttpTransaction.cpp b/src/http/FNetHttpHttpTransaction.cpp index 2a263e8..15b17a3 100644 --- a/src/http/FNetHttpHttpTransaction.cpp +++ b/src/http/FNetHttpHttpTransaction.cpp @@ -225,4 +225,15 @@ HttpTransaction::SetTimeout(int timeout) return r; } +result +HttpTransaction::SetServerCertificateVerification(NetHttpCertificateVerificationFlag flag) +{ + result r = E_SUCCESS; + + r = __pHttpTransactionImpl->SetServerCertificateVerification(flag); + SysTryReturnResult(NID_NET_HTTP, r == E_SUCCESS, r, "Propagating."); + + return r; +} + } } } // Tizen::Net::Http diff --git a/src/http/FNetHttp_HttpCommon.cpp b/src/http/FNetHttp_HttpCommon.cpp index 99c7901..b790eff 100644 --- a/src/http/FNetHttp_HttpCommon.cpp +++ b/src/http/FNetHttp_HttpCommon.cpp @@ -34,6 +34,7 @@ #include #include #include "FNetHttp_HttpCommon.h" +#include "FNetHttp_HttpTransactionEvent.h" using namespace std; using namespace Tizen::Base; @@ -119,10 +120,23 @@ static const char* NetHttpTransactionEventTypesToString[] = "_HTTP_TRANSACTION_EVENT_TYPE_DOWNLOAD_PROGRESS" }; +static const char* NetHttpCertificateVerificationFlagToString[] = +{ + "HTTP_CV_FLAG_AUTOMATIC", + "HTTP_CV_FLAG_MANUAL", + "HTTP_CV_FLAG_IGNORED" +}; + +const char* +_HttpUtility::ConvertHttpTransactionEventTypeToString(_HttpTransactionEventType type) +{ + return NetHttpTransactionEventTypesToString[type]; +} + const char* -_HttpUtility::ConvertHttpTransactionEventTypeToString(_HttpTransactionEventType index) +_HttpUtility::ConvertNetHttpCertificateVerificationFlagToString(NetHttpCertificateVerificationFlag flag) { - return NetHttpTransactionEventTypesToString[index]; + return NetHttpCertificateVerificationFlagToString[flag]; } void @@ -456,7 +470,7 @@ _HttpUtility::GetSslCertList(void) } result -_HttpUtility::AddSslCertInfo(_HttpSslInfo & sslInfo) +_HttpUtility::SetSslCertInfo(_HttpSslInfo & sslInfo) { result r = E_SUCCESS; @@ -474,15 +488,11 @@ _HttpUtility::AddSslCertInfo(_HttpSslInfo & sslInfo) return r; } -IList* -_HttpUtility::GetSslCertInfoN(int socketFd) +_HttpSslInfo* +_HttpUtility::GetSslCertInfo(int socketFd) { ClearLastResult(); - unique_ptr pResultList(new (std::nothrow)LinkedList()); - SysTryReturn(NID_NET_HTTP, pResultList != null, null, E_OUT_OF_MEMORY, - "[E_OUT_OF_MEMORY] Memory allocation failed."); - IList* pServerCertList = GetSslCertList(); Mutex* pHttpMutex = GetHttpMutex(); _HttpSslInfo* pSSLInfo = null; @@ -504,42 +514,26 @@ _HttpUtility::GetSslCertInfoN(int socketFd) if (pSSLInfo->GetSocketFd() == socketFd) { SysLog(NID_NET_HTTP, "Found the same server cert."); - pResultList->Add(*pSSLInfo); + return pSSLInfo; } } - return pResultList.release(); + return null; } result -_HttpUtility::RemoveSslCertInfo(int socketFd) +_HttpUtility::RemoveSslCertInfo(_HttpSslInfo & sslInfo) { ClearLastResult(); result r = E_SUCCESS; Mutex* pHttpMutex = GetHttpMutex(); - _HttpSslInfo* pSSLInfo = null; IList *pServerCertList = GetSslCertList(); - unique_ptr pResultList(GetSslCertInfoN(socketFd)); - SysTryReturnResult(NID_NET_HTTP, pResultList != null, E_OUT_OF_MEMORY, - "Memory allocation failed."); - MutexGuard locked(*pHttpMutex); SysTryReturnResult(NID_NET_HTTP, locked.IsLocked(), E_SYSTEM, "Failed to lock mutex."); - unique_ptr pEnum(pResultList->GetEnumeratorN()); - while (pEnum->MoveNext() == E_SUCCESS) - { - pSSLInfo = dynamic_cast< _HttpSslInfo* >(pEnum->GetCurrent()); - SysTryReturnResult(NID_NET_HTTP, pSSLInfo != null, E_OUT_OF_MEMORY, - "Memory allocation failed."); - - SysLog(NID_NET_HTTP, "Found the server cert. socketFd(%d), depth(%d)", pSSLInfo->GetSocketFd(), pSSLInfo->GetDepth()); - pServerCertList->Remove(*pSSLInfo, false); - } - - pResultList->RemoveAll(true); + pServerCertList->Remove(sslInfo, true); return r; } @@ -749,6 +743,16 @@ _HttpSslInfo::_HttpSslInfo(int socketFd, int depth, const String & serverCert, c __depth = depth; __serverCert = serverCert; __errorMessage = errorMessage; + __pHttpTransactionEvent = null; + __flag = HTTP_CV_FLAG_AUTOMATIC; +} + +_HttpSslInfo::_HttpSslInfo(int socketFd, _HttpTransactionEvent* pHttpTransactionEvent) +{ + __socketFd = socketFd; + __depth = -1; + __pHttpTransactionEvent = pHttpTransactionEvent; + __flag = HTTP_CV_FLAG_MANUAL; } _HttpSslInfo::~_HttpSslInfo() @@ -779,4 +783,16 @@ _HttpSslInfo::GetSocketFd() const return __socketFd; } +_HttpTransactionEvent* +_HttpSslInfo::GetHttpTransactionEvent(void) const +{ + return __pHttpTransactionEvent; +} + +NetHttpCertificateVerificationFlag +_HttpSslInfo::GetCertificateVerificationFlag(void) const +{ + return __flag; +} + } } } // Tizen::Net::Http diff --git a/src/http/FNetHttp_HttpDeleter.h b/src/http/FNetHttp_HttpDeleter.h index d393eb9..b11c4ee 100644 --- a/src/http/FNetHttp_HttpDeleter.h +++ b/src/http/FNetHttp_HttpDeleter.h @@ -91,5 +91,40 @@ struct _HttpCookieStorageManagerDeleter } }; +struct _CollectionDeleter +{ + template + void operator()(Collection* pCollection) + { + pCollection->RemoveAll(true); + delete pCollection; + } +}; + +struct _CharDeleter +{ + void operator()(char* pBytes) + { + free(pBytes); + } +}; + +struct _X509Deleter +{ + void operator()(X509* pCert) + { + X509_free(pCert); + } +}; + +struct _X509ChainDeleter +{ + void operator()(STACK_OF(X509)* pCertChain) + { + sk_X509_free(pCertChain); + } +}; + + } } } //Tizen::Net::Http #endif // _FNET_HTTP_INTERNAL_HTTP_DELETER_H_ diff --git a/src/http/FNetHttp_HttpMultipleConnectionInfo.cpp b/src/http/FNetHttp_HttpMultipleConnectionInfo.cpp index 5d656aa..aee0cb9 100644 --- a/src/http/FNetHttp_HttpMultipleConnectionInfo.cpp +++ b/src/http/FNetHttp_HttpMultipleConnectionInfo.cpp @@ -374,8 +374,9 @@ _HttpMultipleConnectionInfo::CheckCurlMultiStatus(void) { if (_HttpUtility::IsSslError(curlCode)) { - IList* pSslList = _HttpUtility::GetSslCertInfoN(pHttpTransactionUserData->GetSocketFd()); - if (pSslList == null || pSslList->GetCount() == 0) + _HttpSslInfo* pSSLInfo = _HttpUtility::GetSslCertInfo(pHttpTransactionUserData->GetSocketFd()); + + if (pSSLInfo == null) { if (curlCode == CURLE_SSL_CACERT || curlCode == CURLE_SSL_ISSUER_ERROR || curlCode == CURLE_SSL_CRL_BADFILE || curlCode == CURLE_SSL_CACERT_BADFILE) { @@ -388,27 +389,28 @@ _HttpMultipleConnectionInfo::CheckCurlMultiStatus(void) } else { - IEnumerator* pEnum = null; - _HttpSslInfo* pSSLInfo = null; - - pEnum = pSslList->GetEnumeratorN(); - while (pEnum->MoveNext() == E_SUCCESS) + if (pSSLInfo->GetCertificateVerificationFlag() == HTTP_CV_FLAG_MANUAL) { - _HttpSslInfo* pTempSSLInfo = dynamic_cast< _HttpSslInfo* >(pEnum->GetCurrent()); - SysAssertf(pTempSSLInfo != null, "The pTempSSLInfo must hot be null."); - - if (pSSLInfo == null || pTempSSLInfo->GetDepth() < pSSLInfo->GetDepth()) + r = _HttpUtility::RemoveSslCertInfo(*pSSLInfo); + if (IsFailed(r)) { - pSSLInfo = pTempSSLInfo; - SysLog(NID_NET_HTTP, "The value of _HttpSslInfo is depth(%d), Subject(%ls).", pSSLInfo->GetDepth(), pSSLInfo->GetServerCert().GetPointer()); + SysLogException(NID_NET_HTTP, E_SYSTEM, "[E_SYSTEM] Failed to remove the server cert."); } + + SysLog(NID_NET_HTTP, "The server certificate verification is failed by user."); + + //Fire the event(_HTTP_TRANSACTION_EVENT_TYPE_ABORTED) + pHttpTransactionEvent->FireTransactionAbortedEvent(E_HTTP_USER); + + goto FINISH; } - delete pEnum; + + SysLog(NID_NET_HTTP, "The value of _HttpSslInfo is depth(%d), Subject(%ls).", pSSLInfo->GetDepth(), pSSLInfo->GetServerCert().GetPointer()); SysLog(NID_NET_HTTP, "SERVER CERT FAIL(Reason: %ls)", pSSLInfo->GetErrorMessage().GetPointer()); String* pServerCert = new (std::nothrow) String(pSSLInfo->GetServerCert()); - r = _HttpUtility::RemoveSslCertInfo(pHttpTransactionUserData->GetSocketFd()); + r = _HttpUtility::RemoveSslCertInfo(*pSSLInfo); if (IsFailed(r)) { SysLogException(NID_NET_HTTP, E_SYSTEM, "[E_SYSTEM] Failed to remove the server cert."); @@ -427,7 +429,6 @@ _HttpMultipleConnectionInfo::CheckCurlMultiStatus(void) } } - delete pSslList; } else { diff --git a/src/http/FNetHttp_HttpRequestImpl.cpp b/src/http/FNetHttp_HttpRequestImpl.cpp index 8af311c..1cb1196 100644 --- a/src/http/FNetHttp_HttpRequestImpl.cpp +++ b/src/http/FNetHttp_HttpRequestImpl.cpp @@ -623,6 +623,48 @@ _HttpRequestImpl::GetNextDataN(int recommendedSize) } result +_HttpRequestImpl::Set(_HttpRequestImpl* pHttpRequestImpl) +{ + result r = E_SUCCESS; + + HttpHeader* pHttpHeader = null; + HttpHeader* pSrcHttpHeader = null; + + //Sets member variables. + __method = pHttpRequestImpl->GetMethod(); + pHttpRequestImpl->GetCustomMethod(__customMethodName); + __methodName = pHttpRequestImpl->GetMethodName(); + __httpVersion = pHttpRequestImpl->GetVersion(); + pHttpRequestImpl->GetUri(__uri); + __cookieValue = pHttpRequestImpl->GetCookie(); + __encoding = pHttpRequestImpl->GetAcceptEncoding(); + __pIHttpEntity = pHttpRequestImpl->GetEntity(); + + pHttpHeader = pHttpRequestImpl->GetHeader(); + + //Sets request buffer. (message queue). + ByteBuffer* pBuffer = null; + do + { + pBuffer = pHttpRequestImpl->ReadBodyN(); + if (pBuffer) + { + this->WriteBody(*pBuffer); + } + } + while(pBuffer != null); + + // Sets the headers. + pSrcHttpHeader = new (std::nothrow) HttpHeader(pHttpHeader); + SysTryReturn(NID_NET_HTTP, pSrcHttpHeader != null, null, E_OUT_OF_MEMORY, + "[E_OUT_OF_MEMORY] Memory allocation failed."); + + __pHttpRequest->_pHeader = pSrcHttpHeader; + + return r; +} + +result _HttpRequestImpl::SetCookie(const Tizen::Base::String& cookieString) { result r = E_SUCCESS; diff --git a/src/http/FNetHttp_HttpSessionImpl.cpp b/src/http/FNetHttp_HttpSessionImpl.cpp index 072e7c8..f80eec6 100644 --- a/src/http/FNetHttp_HttpSessionImpl.cpp +++ b/src/http/FNetHttp_HttpSessionImpl.cpp @@ -902,6 +902,7 @@ _HttpSessionImpl::IsConnectionStarted(void) const void _HttpSessionImpl::IgnoreSslVerification(void) { + SysLog(NID_NET_HTTP, "Ignore to verify server certificate of current HttpSession[%d]", __sessionId); __isAlreadyResumed = true; } @@ -986,7 +987,7 @@ _HttpSessionImpl::OpenTransactionN(const HttpAuthentication& auth) } HttpTransaction* -_HttpSessionImpl::OpenTransactionWithCurlN(CURL* pCurl) +_HttpSessionImpl::OpenTransactionWithCurlN(CURL* pCurl, bool uncheckedMaxTransactions) { SysAssertf(!__isClosed, "The HttpSession[%d] has been closed.", __sessionId); @@ -996,7 +997,7 @@ _HttpSessionImpl::OpenTransactionWithCurlN(CURL* pCurl) unique_ptr pHttpTransaction; _HttpTransactionImpl* pHttpTransactionImpl = null; - if (__sessionMode != NET_HTTP_SESSION_MODE_MULTIPLE_HOST) + if (__sessionMode != NET_HTTP_SESSION_MODE_MULTIPLE_HOST && !uncheckedMaxTransactions) { SysTryReturn(NID_NET_HTTP, __countOfTransaction < GetMaxTransactionCount(), null, E_MAX_EXCEEDED, "[E_MAX_EXCEEDED] Number(%d) of HttpTransaction exceeds max HttpTransaction count(%d).", __countOfTransaction, GetMaxTransactionCount()); @@ -1012,7 +1013,7 @@ _HttpSessionImpl::OpenTransactionWithCurlN(CURL* pCurl) SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, r, "[%s] Failed to construct the HttpTransaction.", GetErrorMessage(r)); - if (__isAlreadyResumed == true) + if (__isAlreadyResumed == true && __sessionMode != NET_HTTP_SESSION_MODE_MULTIPLE_HOST) { pHttpTransactionImpl->IgnoreSslVerification(); SysLog(NID_NET_HTTP, "Ignore SSL verification."); @@ -1166,96 +1167,27 @@ _HttpSessionImpl::ReopenTransactionWithAuthN(HttpTransaction& httpTransaction) unique_ptr pCreatedTransaction; _HttpTransactionImpl* pCreatedTransactionImpl = null; - _HttpRequestImpl* pCreatedHttpRequestImpl = null; - _HttpTransactionImpl* pHttpTransactionImpl = null; - HttpRequest* pHttpRequest = null; - _HttpRequestImpl* pHttpRequestImpl = null; - _HttpAuthenticationImpl* pAuthenticationImpl = null; - - ByteBuffer bodyBuffer; - ByteBuffer* pRequestBuffer = null; - String uri; - NetHttpMethod method; - ArrayListT< IHttpTransactionEventListener* > listenerList; - Object* pUserData = null; pHttpTransactionImpl = _HttpTransactionImpl::GetInstance(httpTransaction); SysTryReturn(NID_NET_HTTP, pHttpTransactionImpl != null, null, E_SYSTEM, "[E_SYSTEM] An internal error has occurred."); - pHttpRequest = pHttpTransactionImpl->GetRequest(); - SysTryReturn(NID_NET_HTTP, pHttpRequest != null, null, E_SYSTEM, - "[E_SYSTEM] An internal error has occurred."); - - pHttpRequestImpl = _HttpRequestImpl::GetInstance(*pHttpRequest); - SysTryReturn(NID_NET_HTTP, pHttpRequestImpl != null, null, E_SYSTEM, - "[E_SYSTEM] An internal error has occurred."); - - method = pHttpRequestImpl->GetMethod(); - - r = pHttpRequestImpl->GetUri(uri); - SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, r, - "[%s] Failed to get the uri.", GetErrorMessage(r)); - - r = listenerList.Construct(*(pHttpTransactionImpl->GetEventListenerList())); - SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, E_OUT_OF_MEMORY, - "[E_OUT_OF_MEMORY] Memory allocation failed."); - - pAuthenticationImpl = pHttpTransactionImpl->GetHttpAuthenticationImpl(); - SysTryReturn(NID_NET_HTTP, pAuthenticationImpl != null, null, E_INVALID_STATE, - "[E_INVALID_STATE] The HttpAuthentication is null."); - - pUserData = httpTransaction.GetUserObject(); - - r = CloseTransaction(httpTransaction); - SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, r, - "[%s] Propagating.", GetErrorMessage(r)); - - pCreatedTransaction.reset(OpenTransactionN()); + pCreatedTransaction.reset(OpenTransactionWithCurlN(null, true)); r = GetLastResult(); SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, r, "[%s] Failed to open the HttpTransaction.", GetErrorMessage(r)); pCreatedTransactionImpl = _HttpTransactionImpl::GetInstance(*pCreatedTransaction); - r = pCreatedTransactionImpl->SetUserObject(pUserData); - SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, r, - "[%s] Failed to set the user object.", GetErrorMessage(r)); - - pCreatedHttpRequestImpl = _HttpRequestImpl::GetInstance(*pCreatedTransactionImpl->GetRequest()); - - r = pCreatedHttpRequestImpl->SetMethod(method); - SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, r, - "[%s] Failed to set the method.", GetErrorMessage(r)); + // The data of pHttpTransactionImpl is set to the pCreatedTransactionImpl. + r = pCreatedTransactionImpl->Set(pHttpTransactionImpl); + SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, E_SYSTEM, + "[E_SYSTEM] An internal error has occurred."); - r = pCreatedHttpRequestImpl->SetUri(uri); + r = CloseTransaction(httpTransaction); SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, r, - "[%s] Failed to set the URI.", GetErrorMessage(r)); - - pRequestBuffer = pHttpTransactionImpl->GetRequestBuffer(); - if (pRequestBuffer != null) - { - //Clear the flag of _HttpRequestImpl - pHttpRequestImpl->SetReceivedTransactionReadyToWriteEvent(false); - - r = pCreatedHttpRequestImpl->WriteBody(*pRequestBuffer); - SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, r, "[%s] Failed to write the body.", GetErrorMessage(r)); - - SysLog(NID_NET_HTTP, "The __pRequestBuffer is added to the Body."); - } - - for (int i = 0; i < listenerList.GetCount(); i++) - { - IHttpTransactionEventListener* pListener = null; - r = listenerList.GetAt(i, pListener); - SysTryReturn(NID_NET_HTTP, r == E_SUCCESS && pListener != null, null, E_SYSTEM, - "[E_SYSTEM] A system error has occurred."); - - r = pCreatedTransactionImpl->AddHttpTransactionListener(*pListener); - SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, r, - "[%s] Failed to add the HttpTransactionEventListener.", GetErrorMessage(r)); - } + "[%s] Propagating.", GetErrorMessage(r)); SysLog(NID_NET_HTTP, "The HttpTransaction[%d] was re-opened.", pCreatedTransactionImpl->GetTransactionId()); diff --git a/src/http/FNetHttp_HttpTransactionEvent.cpp b/src/http/FNetHttp_HttpTransactionEvent.cpp index 55f993d..e8f7a48 100644 --- a/src/http/FNetHttp_HttpTransactionEvent.cpp +++ b/src/http/FNetHttp_HttpTransactionEvent.cpp @@ -44,6 +44,7 @@ _HttpTransactionEvent::_HttpTransactionEvent(void) , __pHttpTransactionImpl(null) , __pHttpProgressListener(null) , __transactionId(-1) + , __isCertRequestedResult(false) { } @@ -83,6 +84,18 @@ _HttpTransactionEvent::SetHttpProgressListener(const IHttpProgressEventListener* return r; } +bool +_HttpTransactionEvent::GetCertRequestedResult(void) const +{ + return __isCertRequestedResult; +} + +_HttpSessionImpl* +_HttpTransactionEvent::GetHttpSessionImpl(void) const +{ + return __pHttpSessionImpl; +} + result _HttpTransactionEvent::FireTransactionReadyToReadEvent(int readBodyLength, bool async) { @@ -189,6 +202,32 @@ _HttpTransactionEvent::FireTransactionCertVerificationRequiredNEvent(String* pSe } result +_HttpTransactionEvent::FireTransactionCertVerificationRequestedNEvent(Tizen::Base::Collection::IList* pServerCertList, bool async) +{ + result r = E_SUCCESS; + + SysLog(NID_NET_HTTP, "Fire the event(_HTTP_TRANSACTION_EVENT_TYPE_CERT_VERIFICATION_REQUESTED), async(%d)", async); + + _HttpTransactionEventArg* pEventArg = new (std::nothrow) _HttpTransactionEventArg(__transactionId, _HTTP_TRANSACTION_EVENT_TYPE_CERT_VERIFICATION_REQUESTED); + SysTryReturnResult(NID_NET_HTTP, pEventArg != null, + E_OUT_OF_MEMORY, "Memory allocation failed."); + + pEventArg->SetServerCertList(pServerCertList); + + if (async) + { + FireAsync(*pEventArg); + } + else + { + Fire(*pEventArg); + } + + return r; + +} + +result _HttpTransactionEvent::FireTransactionCompletedEvent(bool async) { result r = E_SUCCESS; @@ -477,6 +516,14 @@ _HttpTransactionEvent::FireImpl(IEventListener& listener, const IEventArg& arg) break; + case _HTTP_TRANSACTION_EVENT_TYPE_CERT_VERIFICATION_REQUESTED: + + SysLog(NID_NET_HTTP, "####### Calling callback : OnTransactionCertVerificationRequestedN(HttpTransaction[%d])", transactionId); + __isCertRequestedResult = pHttpTransactionEventListener->OnTransactionCertVerificationRequestedN(*pHttpSessoin, *pHttpTransaction, pHttpTransactionEventArg->GetServerCertList()); + SysLog(NID_NET_HTTP, "####### Called callback : OnTransactionCertVerificationRequestedN(%d)", __isCertRequestedResult); + + break; + case _HTTP_TRANSACTION_EVENT_TYPE_UPLOAD_PROGRESS: currentUploadProgress = pHttpTransactionEventArg->GetCurrentUploadProgress(); diff --git a/src/http/FNetHttp_HttpTransactionEvent.h b/src/http/FNetHttp_HttpTransactionEvent.h index a958819..029eeda 100644 --- a/src/http/FNetHttp_HttpTransactionEvent.h +++ b/src/http/FNetHttp_HttpTransactionEvent.h @@ -59,6 +59,10 @@ public: result SetHttpProgressListener(const IHttpProgressEventListener* pListener); + bool GetCertRequestedResult(void) const; + + _HttpSessionImpl* GetHttpSessionImpl(void) const; + result FireTransactionReadyToReadEvent(int readBodyLength, bool async = false); result FireTransactionReadyToWriteEvent(int recommenedLength, bool async = false); @@ -67,6 +71,8 @@ public: result FireTransactionCertVerificationRequiredNEvent(Tizen::Base::String* pServerCert, bool async = false); + result FireTransactionCertVerificationRequestedNEvent(Tizen::Base::Collection::IList* pServerCertList, bool async = false); + result FireTransactionCompletedEvent(bool async = false); result FireTransactionAbortedEvent(result error, bool async = false); @@ -88,6 +94,7 @@ private: _HttpTransactionImpl* __pHttpTransactionImpl; IHttpProgressEventListener* __pHttpProgressListener; int __transactionId; + bool __isCertRequestedResult; }; // _HttpTransactionEvent diff --git a/src/http/FNetHttp_HttpTransactionEventArg.cpp b/src/http/FNetHttp_HttpTransactionEventArg.cpp index 26b6ae3..95ca592 100644 --- a/src/http/FNetHttp_HttpTransactionEventArg.cpp +++ b/src/http/FNetHttp_HttpTransactionEventArg.cpp @@ -21,11 +21,13 @@ */ #include +#include #include "FNetHttp_HttpTransactionImpl.h" #include "FNetHttp_HttpTransactionEvent.h" #include "FNetHttp_HttpTransactionEventArg.h" using namespace Tizen::Base; +using namespace Tizen::Base::Collection; namespace Tizen { namespace Net { namespace Http { @@ -44,6 +46,7 @@ _HttpTransactionEventArg::_HttpTransactionEventArg(int transactionId, _HttpTrans , __downloadCurrentProgress(0) , __downloadTotalProgress(0) , __pServerCert(null) + , __pServerCertList(null) { } @@ -189,4 +192,16 @@ _HttpTransactionEventArg::GetServerCert(void) const return __pServerCert; } +void +_HttpTransactionEventArg::SetServerCertList(IList* pServerCertList) +{ + __pServerCertList = pServerCertList; +} + +IList* +_HttpTransactionEventArg::GetServerCertList(void) const +{ + return __pServerCertList; +} + } } } // Tizen::Net::Http diff --git a/src/http/FNetHttp_HttpTransactionEventArg.h b/src/http/FNetHttp_HttpTransactionEventArg.h index ee733a1..c4ccfec 100644 --- a/src/http/FNetHttp_HttpTransactionEventArg.h +++ b/src/http/FNetHttp_HttpTransactionEventArg.h @@ -31,6 +31,11 @@ namespace Tizen { namespace Base class String; } } +namespace Tizen { namespace Base { namespace Collection +{ +class IList; +} } } + namespace Tizen { namespace Net { namespace Http { /** @@ -96,6 +101,11 @@ public: Tizen::Base::String* GetServerCert(void) const; + void SetServerCertList(Tizen::Base::Collection::IList* pServerCertList); + + Tizen::Base::Collection::IList* GetServerCertList(void) const; + + private: _HttpTransactionEventArg(const _HttpTransactionEventArg& rhs); @@ -115,6 +125,7 @@ private: long long __downloadCurrentProgress; long long __downloadTotalProgress; Tizen::Base::String* __pServerCert; + Tizen::Base::Collection::IList* __pServerCertList; }; // _HttpTransactionEventArg diff --git a/src/http/FNetHttp_HttpTransactionImpl.cpp b/src/http/FNetHttp_HttpTransactionImpl.cpp index 6e1bf75..27b16b2 100644 --- a/src/http/FNetHttp_HttpTransactionImpl.cpp +++ b/src/http/FNetHttp_HttpTransactionImpl.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -97,6 +98,7 @@ _HttpTransactionImpl::_HttpTransactionImpl(HttpTransaction* pHttpTransaction) , __isAlreadyResumed(false) , __isAlreadyPaused(false) , __isCertRequiredEventFired(false) + , __certificateFlag(HTTP_CV_FLAG_AUTOMATIC) , __pHttpProgressListener(null) , __pHttpTransactionUserData(null) , __pHttpCurl(null) @@ -345,6 +347,80 @@ _HttpTransactionImpl::Abort(void) return r; } +result +_HttpTransactionImpl::Set(_HttpTransactionImpl* pHttpTransactionImpl) +{ + result r = E_SUCCESS; + + HttpRequest* pHttpRequest = null; + _HttpRequestImpl* pHttpRequestImpl = null; + _HttpRequestImpl* pSrcHttpRequestImpl = null; + + ByteBuffer* pRequestBuffer = null; + ArrayListT< IHttpTransactionEventListener* > listenerList; + Object* pUserObject = null; + + //Sets user object. + pUserObject = pHttpTransactionImpl->GetUserObject(); + __pUserData = pUserObject; + + //Sets event listener. + r = listenerList.Construct(*(pHttpTransactionImpl->GetEventListenerList())); + SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, E_OUT_OF_MEMORY, + "[E_OUT_OF_MEMORY] Memory allocation failed."); + + for (int i = 0; i < listenerList.GetCount(); i++) + { + IHttpTransactionEventListener* pListener = null; + r = listenerList.GetAt(i, pListener); + SysTryReturn(NID_NET_HTTP, r == E_SUCCESS && pListener != null, null, E_SYSTEM, + "[E_SYSTEM] A system error has occurred."); + + r = this->AddHttpTransactionListener(*pListener); + SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, r, + "[%s] Failed to add the HttpTransactionEventListener.", GetErrorMessage(r)); + } + + __pHttpProgressListener = pHttpTransactionImpl->GetHttpProgressEventListener(); + + __enableTransactionReadyToWrite = pHttpTransactionImpl->IsTransactionReadyToWriteEanbled(); + __timeout = pHttpTransactionImpl->GetTimeout(); + __certificateId = pHttpTransactionImpl->GetClientCertificate(); + __isAlreadyResumed = pHttpTransactionImpl->IsAlreadyResumed(); + __certificateFlag = pHttpTransactionImpl->GetServerCertificateVerification(); + + pHttpRequest = pHttpTransactionImpl->GetRequest(); + SysTryReturn(NID_NET_HTTP, pHttpRequest != null, null, E_SYSTEM, + "[E_SYSTEM] An internal error has occurred."); + + pHttpRequestImpl = _HttpRequestImpl::GetInstance(*pHttpRequest); + SysTryReturn(NID_NET_HTTP, pHttpRequestImpl != null, null, E_SYSTEM, + "[E_SYSTEM] An internal error has occurred."); + + pSrcHttpRequestImpl = _HttpRequestImpl::GetInstance(*__pHttpRequest); + SysTryReturn(NID_NET_HTTP, pSrcHttpRequestImpl != null, null, E_SYSTEM, + "[E_SYSTEM] An internal error has occurred."); + + //Sets HttpRequest. + r = pSrcHttpRequestImpl->Set(pHttpRequestImpl); + SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, E_SYSTEM, + "[E_SYSTEM] An internal error has occurred."); + + pRequestBuffer = pHttpTransactionImpl->GetRequestBuffer(); + if (pRequestBuffer != null) + { + //Clear the flag of _HttpRequestImpl + pSrcHttpRequestImpl->SetReceivedTransactionReadyToWriteEvent(false); + + r = pSrcHttpRequestImpl->WriteBody(*pRequestBuffer); + SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, null, r, "[%s] Failed to write the body.", GetErrorMessage(r)); + + SysLog(NID_NET_HTTP, "The __pRequestBuffer is added to the Body."); + } + + return r; +} + String _HttpTransactionImpl::GetDefaultUserAgent(void) { @@ -577,11 +653,17 @@ _HttpTransactionImpl::Submit(void) SysTryReturnResult(NID_NET_HTTP, r == E_SUCCESS, E_INVALID_ARG, "Failed to parse the content-length."); //Set Content-Length - if (contentLen >= 0) + if (contentLen > 0) { curl_easy_setopt(pCurl, CURLOPT_POSTFIELDSIZE_LARGE, static_cast< curl_off_t >(contentLen)); SysLog(NID_NET_HTTP, "Set the Content-Length(%lld).", contentLen); } + else if (contentLen == 0) + { + curl_easy_setopt(pCurl, CURLOPT_POSTFIELDSIZE_LARGE, static_cast< curl_off_t >(contentLen)); + curl_easy_setopt(pCurl, CURLOPT_COPYPOSTFIELDS, NULL); + SysLog(NID_NET_HTTP, "Set the Content-Length(%lld).", contentLen); + } SysLog(NID_NET_HTTP, "The Content-Length is %lld.", contentLen); } @@ -646,20 +728,29 @@ _HttpTransactionImpl::Submit(void) curl_easy_setopt(pCurl, CURLOPT_LOW_SPEED_TIME, 30L); } - //Set default CA path. - String caPath = _CertService::GetCertificateCrtFilePath(); - SysLog(NID_NET_HTTP, "The CA Path is %ls.", caPath.GetPointer()); + if (__certificateFlag == HTTP_CV_FLAG_IGNORED) + { + curl_easy_setopt(pCurl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(pCurl, CURLOPT_SSL_VERIFYHOST, 0); + SysLog(NID_NET_HTTP, "The server certificate verification is ignored."); - char* pCaPath = _StringConverter::CopyToCharArrayN(caPath); - SysTryReturnResult(NID_NET_HTTP, pCaPath != null, - E_OUT_OF_MEMORY, "Memory allocation failed."); + } else + { + //Set default CA path. + String caPath = _CertService::GetCertificateCrtFilePath(); + SysLog(NID_NET_HTTP, "The CA Path is %ls.", caPath.GetPointer()); - curl_easy_setopt(pCurl, CURLOPT_CAINFO, pCaPath); - curl_easy_setopt(pCurl, CURLOPT_CAPATH, null); - delete[] pCaPath; + char* pCaPath = _StringConverter::CopyToCharArrayN(caPath); + SysTryReturnResult(NID_NET_HTTP, pCaPath != null, + E_OUT_OF_MEMORY, "Memory allocation failed."); + + curl_easy_setopt(pCurl, CURLOPT_CAINFO, pCaPath); + curl_easy_setopt(pCurl, CURLOPT_CAPATH, null); + delete[] pCaPath; - curl_easy_setopt(pCurl, CURLOPT_SSL_VERIFYPEER, 0); - curl_easy_setopt(pCurl, CURLOPT_SSL_VERIFYHOST, 2); + curl_easy_setopt(pCurl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(pCurl, CURLOPT_SSL_VERIFYHOST, 2); + } if (__certificateId >= 0) { @@ -1104,6 +1195,12 @@ _HttpTransactionImpl::SetTimeout(int timeout) return r; } +int +_HttpTransactionImpl::GetTimeout(void) const +{ + return __timeout; +} + result _HttpTransactionImpl::SetClientCertificate(int certificateId) { @@ -1122,6 +1219,36 @@ _HttpTransactionImpl::SetClientCertificate(int certificateId) return r; } +int +_HttpTransactionImpl::GetClientCertificate(void) const +{ + return __certificateId; +} + +result +_HttpTransactionImpl::SetServerCertificateVerification(NetHttpCertificateVerificationFlag flag) +{ + result r = E_SUCCESS; + + SysTryReturnResult(NID_NET_HTTP, __isClosed == false, + E_INVALID_STATE, "HttpTransaction[%d] is already closed.", __transactionId); + + SysTryReturnResult(NID_NET_HTTP, __isSubmitted == false, + E_INVALID_STATE, "HttpTransaction[%d] is already submitted.", __transactionId); + + __certificateFlag = flag; + + SysLog(NID_NET_HTTP, "Set the flag for certificate verification.[%s].", _HttpUtility::ConvertNetHttpCertificateVerificationFlagToString(flag)); + + return r; +} + +NetHttpCertificateVerificationFlag +_HttpTransactionImpl::GetServerCertificateVerification(void) const +{ + return __certificateFlag; +} + _HttpTransactionImpl* _HttpTransactionImpl::GetInstance(HttpTransaction& httpTransaction) { @@ -1724,15 +1851,32 @@ _HttpTransactionImpl::OnHttpSslHandshake(CURL* pCurl, SSL_CTX* pSslctx, void* pU result r = E_SUCCESS; CURLcode curlCode = CURLE_OK; + SysLog(NID_NET_HTTP, "Received OnHttpSslHandshake()"); + _HttpTransactionUserData* pHttpTransactionUserData = static_cast< _HttpTransactionUserData* >(pUserData); _HttpTransactionImpl* pHttpTransactionImpl = pHttpTransactionUserData->GetHttpTransactionImpl(); - if (pHttpTransactionImpl->__isAlreadyResumed) + if (pHttpTransactionImpl->__isAlreadyResumed || pHttpTransactionImpl->__certificateFlag == HTTP_CV_FLAG_IGNORED) { SysLog(NID_NET_HTTP, "Resume the HttpTransaction. Ignore to verify the server cert."); } else { + if (pHttpTransactionImpl->__certificateFlag == HTTP_CV_FLAG_MANUAL) + { + unique_ptr<_HttpSslInfo> pSSLInfo; + + SysLog(NID_NET_HTTP, "The certificate mode is HTTP_CV_FLAG_MANUAL"); + + pSSLInfo.reset(new (std::nothrow) _HttpSslInfo(pHttpTransactionUserData->GetSocketFd(), pHttpTransactionImpl->__pHttpTransactionEvent)); + SysTryReturn(NID_NET_HTTP, pSSLInfo != null, CURLE_SSL_CERTPROBLEM, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + + r = _HttpUtility::SetSslCertInfo(*pSSLInfo); + SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, CURLE_SSL_CERTPROBLEM, r, "[%s] Memory allocation failed.", GetErrorMessage(r)); + + pSSLInfo.release(); + } + SSL_CTX_set_verify_depth(pSslctx, _HTTP_CERT_VERIFICATION_DEPTH_LIMIT); SSL_CTX_set_verify(pSslctx, SSL_VERIFY_PEER, _HttpTransactionImpl::OnHttpSslVerify); } @@ -1789,6 +1933,7 @@ _HttpTransactionImpl::OnHttpSslVerify(int preverify_ok, X509_STORE_CTX* pX509ctx result r = E_SUCCESS; int socketFd = -1; unique_ptr<_HttpSslInfo> pSSLInfo; + _HttpSslInfo* pExistSslInfo = null; int sslIndex = SSL_get_ex_data_X509_STORE_CTX_idx(); SSL* pSsl = (SSL*) X509_STORE_CTX_get_ex_data(pX509ctx, sslIndex); @@ -1797,54 +1942,151 @@ _HttpTransactionImpl::OnHttpSslVerify(int preverify_ok, X509_STORE_CTX* pX509ctx socketFd = SSL_get_fd(pSsl); SysLog(NID_NET_HTTP, "The ssl socket is %d.", socketFd); - X509* pServerCert = null; + X509* pSrcServerCert = null; + unique_ptr pServerCert; int depth = X509_STORE_CTX_get_error_depth(pX509ctx); int error = X509_STORE_CTX_get_error(pX509ctx); - if (error != X509_V_OK) + pExistSslInfo = _HttpUtility::GetSslCertInfo(socketFd); + + if (pExistSslInfo != null) { - STACK_OF(X509)* pServerCertChain = null; + bool certVerificationResult = false; + + _HttpTransactionEvent* pHttpTransactionEvent = pExistSslInfo->GetHttpTransactionEvent(); + SysTryReturn(NID_NET_HTTP, pHttpTransactionEvent != null, 0, E_SYSTEM, "[E_SYSTEM] pHttpTransactionEvent must not be null."); + + if (pHttpTransactionEvent->GetCertRequestedResult()) + { + SysLog(NID_NET_HTTP, "The certificate verification is already resumed."); + return 1; + } + + //The certificateFlag is HTTP_CV_FLAG_MANUAL. String serverCertString; - pServerCertChain = X509_STORE_CTX_get1_chain(pX509ctx); + STACK_OF(X509)* pSrcServerCertChain = X509_STORE_CTX_get1_chain(pX509ctx); + unique_ptr pServerCertChain(pSrcServerCertChain); if (pServerCertChain != null) { + unique_ptr pCertList(new (nothrow) LinkedList(SingleObjectDeleter)); + SysTryReturn(NID_NET_HTTP, pCertList != null, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + int numberOfCerts = pServerCertChain->stack.num; for (int i = numberOfCerts; i > 0; i--) { - pServerCert = sk_X509_pop(pServerCertChain); + pSrcServerCert = sk_X509_pop(pSrcServerCertChain); + pServerCert.reset(pSrcServerCert); if (pServerCert != null) { char tempSubjectName[_HTTP_CERT_SUBJECT_SIZE]; - X509_NAME_oneline(X509_get_subject_name(pServerCert), tempSubjectName, _HTTP_CERT_SUBJECT_SIZE); + X509_NAME_oneline(X509_get_subject_name(pSrcServerCert), tempSubjectName, _HTTP_CERT_SUBJECT_SIZE); serverCertString = String(tempSubjectName); - SysLog(NID_NET_HTTP, "The subject of certificate is %ls[depth: %d].", serverCertString.GetPointer(), i -1); - depth = i -1; - X509_free(pServerCert); + SysLog(NID_NET_HTTP, "Count of Certs(%d), The subject of certificate is %ls[depth: %d].", numberOfCerts, serverCertString.GetPointer(), i -1); + + // Converter X509 to ByteBuffer. + int bufferSize = -1; + int len = -1; + ByteBuffer buffer; + unique_ptr pX509Certificate; + char* pSrcCertBytes = null; + unique_ptr pCertBytes; + + BIO* pNewBIoCert = BIO_new(BIO_s_mem()); + unique_ptr pBIoCert(pNewBIoCert); + SysTryReturn(NID_NET_HTTP, pBIoCert != null, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + + PEM_write_bio_X509(pNewBIoCert, pSrcServerCert); + bufferSize = BIO_number_written(pNewBIoCert); + + pSrcCertBytes = (char*) calloc(bufferSize, sizeof(char)); + pCertBytes.reset(pSrcCertBytes); + SysTryReturn(NID_NET_HTTP, pCertBytes != null, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + + len = BIO_read(pNewBIoCert, pSrcCertBytes, bufferSize); + SysLog(NID_NET_HTTP, "The buffer size is %d.", len); + + r = buffer.Construct((byte*)pSrcCertBytes, 0, len, len); + SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + pX509Certificate.reset(new (nothrow) X509Certificate()); + SysTryReturn(NID_NET_HTTP, pX509Certificate != null, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + + r = pX509Certificate->Construct(buffer); + SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, 0, E_SYSTEM, "[E_SYSTEM] Failed to construct X509Certificate."); + + SysLog(NID_NET_HTTP, "Subject: %ls, Issuer: %ls", pX509Certificate->GetSubject().GetPointer(), pX509Certificate->GetIssuer().GetPointer()); + + r = pCertList->Add(*pX509Certificate); + SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + + pX509Certificate.release(); } } - sk_X509_free(pServerCertChain); - } - - const char* pErrorMsg = X509_verify_cert_error_string(error); - SysLog(NID_NET_HTTP, "Failed to verify the cert. depth(%d) - error(%s)", depth, pErrorMsg); - SysLog(NID_NET_HTTP, "The subject of last certificate is %ls.", serverCertString.GetPointer()); - pSSLInfo.reset(new (std::nothrow) _HttpSslInfo(socketFd, depth, serverCertString, pErrorMsg)); - SysTryReturn(NID_NET_HTTP, pSSLInfo != null, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + //Fire the event(_HTTP_TRANSACTION_EVENT_TYPE_CERT_VERIFICATION_REQUESTED) + pHttpTransactionEvent->FireTransactionCertVerificationRequestedNEvent(pCertList.release()); - r = _HttpUtility::AddSslCertInfo(*pSSLInfo); - SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, 0, r, "[%s] Memory allocation failed.", GetErrorMessage(r)); + certVerificationResult = pHttpTransactionEvent->GetCertRequestedResult(); + if (certVerificationResult) + { + _HttpSessionImpl* pHttpSessionImpl = pHttpTransactionEvent->GetHttpSessionImpl(); + pHttpSessionImpl->IgnoreSslVerification(); + } - pSSLInfo.release(); + //Check the result + return pHttpTransactionEvent->GetCertRequestedResult(); + } return 0; - } - else + } else { - return 1; + // The certificateFlag is HTTP_CV_FLAG_AUTOMATIC. + if (error != X509_V_OK) + { + String serverCertString; + STACK_OF(X509)* pSrcServerCertChain = X509_STORE_CTX_get1_chain(pX509ctx); + unique_ptr pServerCertChain(pSrcServerCertChain); + if (pServerCertChain != null) + { + int numberOfCerts = pServerCertChain->stack.num; + for (int i = numberOfCerts; i > 0; i--) + { + pSrcServerCert = sk_X509_pop(pSrcServerCertChain); + pServerCert.reset(pSrcServerCert); + if (pServerCert != null) + { + char tempSubjectName[_HTTP_CERT_SUBJECT_SIZE]; + X509_NAME_oneline(X509_get_subject_name(pSrcServerCert), tempSubjectName, _HTTP_CERT_SUBJECT_SIZE); + serverCertString = String(tempSubjectName); + + SysLog(NID_NET_HTTP, "The subject of certificate is %ls[depth: %d].", serverCertString.GetPointer(), i -1); + depth = i -1; + } + } + } + + const char* pErrorMsg = X509_verify_cert_error_string(error); + SysLog(NID_NET_HTTP, "Failed to verify the cert. depth(%d) - error(%s)", depth, pErrorMsg); + SysLog(NID_NET_HTTP, "The subject of last certificate is %ls.", serverCertString.GetPointer()); + + pSSLInfo.reset(new (std::nothrow) _HttpSslInfo(socketFd, depth, serverCertString, pErrorMsg)); + SysTryReturn(NID_NET_HTTP, pSSLInfo != null, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + + r = _HttpUtility::SetSslCertInfo(*pSSLInfo); + SysTryReturn(NID_NET_HTTP, r == E_SUCCESS, 0, r, "[%s] Memory allocation failed.", GetErrorMessage(r)); + + pSSLInfo.release(); + + return 0; + + } + else + { + return 1; + } + } } diff --git a/src/inc/FNetHttp_HttpCommon.h b/src/inc/FNetHttp_HttpCommon.h index 15c1c54..6940cab 100644 --- a/src/inc/FNetHttp_HttpCommon.h +++ b/src/inc/FNetHttp_HttpCommon.h @@ -48,6 +48,7 @@ class Mutex; namespace Tizen { namespace Net { namespace Http { class _HttpSslInfo; +class _HttpTransactionEvent; /** * The User-Agent header name @@ -273,6 +274,7 @@ enum _HttpTransactionEventType _HTTP_TRANSACTION_EVENT_TYPE_COMPLETD, _HTTP_TRANSACTION_EVENT_TYPE_ABORTED, _HTTP_TRANSACTION_EVENT_TYPE_CERT_VERIFICATION_REQUIRED, + _HTTP_TRANSACTION_EVENT_TYPE_CERT_VERIFICATION_REQUESTED, _HTTP_TRANSACTION_EVENT_TYPE_UPLOAD_PROGRESS, _HTTP_TRANSACTION_EVENT_TYPE_DOWNLOAD_PROGRESS }; @@ -357,9 +359,17 @@ public: * Converts NetHttpTransactionEventType to string name. * * @return The string of NetHttpTransactionEventType - * @param[in] index The index of NetHttpTransactionEventType + * @param[in] type The type of NetHttpTransactionEventType */ - static const char* ConvertHttpTransactionEventTypeToString(_HttpTransactionEventType index); + static const char* ConvertHttpTransactionEventTypeToString(_HttpTransactionEventType type); + + /** + * Converts NetHttpCertificateVerificationFlag to string name. + * + * @return The string of NetHttpCertificateVerificationFlag + * @param[in] flag The flag of NetHttpCertificateVerificationFlag + */ + static const char* ConvertNetHttpCertificateVerificationFlagToString(NetHttpCertificateVerificationFlag flag); /** * Adds a buffer to the header buffer. @@ -487,17 +497,17 @@ public: static Tizen::Base::Collection::IList* GetSslCertList(void); /** - * Adds a _HttpSslInfo + * Sets a _HttpSslInfo * * @return An error code * @param[in] sslInfo The instance of _HttpSslInfo * @exception E_OUT_OF_MEMORY The memory is insufficient. * @exception E_SYSTEM A system error has occurred. */ - static result AddSslCertInfo(_HttpSslInfo& sslInfo); + static result SetSslCertInfo(_HttpSslInfo& sslInfo); /** - * Gets a list of _HttpSslInfo searched by socket fd. + * Gets an instance of _HttpSslInfo searched by socket fd. * * @return The instance of _HttpSslInfo * @param[in] socketFd The socket fd @@ -505,16 +515,16 @@ public: * @exception E_SYSTEM A system error has occurred. * @remarks The specific error code can be accessed using the GetLastResult() method. */ - static Tizen::Base::Collection::IList* GetSslCertInfoN(int socketFd); + static _HttpSslInfo* GetSslCertInfo(int socketFd); /** * Removes a _HttpSslInfo * * @return An error code - * @param[in] socketFd The socket fd + * @param[in] sslInfo The instance of _HttpSslInfo * @exception E_SYSTEM A system error has occurred. */ - static result RemoveSslCertInfo(int socketFd); + static result RemoveSslCertInfo(_HttpSslInfo & sslInfo); private: /** @@ -552,18 +562,23 @@ class _HttpSslInfo public: _HttpSslInfo(int socketFd, int depth, const Tizen::Base::String& serverCert, const Tizen::Base::String& errorMessage); + _HttpSslInfo(int socketFd, _HttpTransactionEvent* pHttpTransactionEvent); virtual ~_HttpSslInfo(void); int GetSocketFd(void) const; int GetDepth(void) const; Tizen::Base::String GetErrorMessage(void) const; Tizen::Base::String GetServerCert(void) const; + _HttpTransactionEvent* GetHttpTransactionEvent(void) const; + NetHttpCertificateVerificationFlag GetCertificateVerificationFlag(void) const; private: int __socketFd; int __depth; Tizen::Base::String __serverCert; Tizen::Base::String __errorMessage; + _HttpTransactionEvent* __pHttpTransactionEvent; + NetHttpCertificateVerificationFlag __flag; }; //_HttpSslInfo diff --git a/src/inc/FNetHttp_HttpRequestImpl.h b/src/inc/FNetHttp_HttpRequestImpl.h index bbad4e7..ef40f79 100644 --- a/src/inc/FNetHttp_HttpRequestImpl.h +++ b/src/inc/FNetHttp_HttpRequestImpl.h @@ -199,6 +199,8 @@ public: Tizen::Base::ByteBuffer* GetNextDataN(int recommendedSize); + result Set(_HttpRequestImpl* pHttpRequestImpl); + private: _HttpRequestImpl(void); diff --git a/src/inc/FNetHttp_HttpSessionImpl.h b/src/inc/FNetHttp_HttpSessionImpl.h index ffef26b..5801bc2 100644 --- a/src/inc/FNetHttp_HttpSessionImpl.h +++ b/src/inc/FNetHttp_HttpSessionImpl.h @@ -187,7 +187,7 @@ public: bool IsConnectionStarted(void) const; - HttpTransaction* OpenTransactionWithCurlN(CURL* pCurl); + HttpTransaction* OpenTransactionWithCurlN(CURL* pCurl, bool uncheckedMaxTransactions = false); HttpTransaction* ReopenTransactionWithAuthN(HttpTransaction& httpTransaction); diff --git a/src/inc/FNetHttp_HttpTransactionImpl.h b/src/inc/FNetHttp_HttpTransactionImpl.h index f14efe9..bae00db 100644 --- a/src/inc/FNetHttp_HttpTransactionImpl.h +++ b/src/inc/FNetHttp_HttpTransactionImpl.h @@ -154,6 +154,19 @@ public: */ result SetTimeout(int timeout); + /** + * Sets the flag to verify server certificate. (the flag is @c HTTP_CV_FLAG_AUTOMATIC by default) + * + * @since 2.1 + * + * @return An error code + * @param[in] flag Set the flag for certificate verification. + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE The method invoked is invalid. + * @exception E_SYSTEM A system error has occurred. + */ + result SetServerCertificateVerification(NetHttpCertificateVerificationFlag flag = HTTP_CV_FLAG_AUTOMATIC); + public: /** * Gets the Impl instance. @@ -232,6 +245,14 @@ public: result Abort(void); + int GetTimeout(void) const; + + int GetClientCertificate(void) const; + + NetHttpCertificateVerificationFlag GetServerCertificateVerification(void) const; + + result Set(_HttpTransactionImpl* pHttpTransactionImpl); + static int GenerateTransactionId(void); int GetTransactionId(void) const; @@ -300,6 +321,7 @@ private: bool __isAlreadyResumed; bool __isAlreadyPaused; bool __isCertRequiredEventFired; + NetHttpCertificateVerificationFlag __certificateFlag; Tizen::Base::Collection::ArrayListT< IHttpTransactionEventListener* > __transactionListenerList; const IHttpProgressEventListener* __pHttpProgressListener; _HttpTransactionUserData* __pHttpTransactionUserData; diff --git a/src/inc/FNetWifi_IWifiDirectListener.h b/src/inc/FNetWifi_IWifiDirectListener.h index d40bbff..bfe9ab5 100644 --- a/src/inc/FNetWifi_IWifiDirectListener.h +++ b/src/inc/FNetWifi_IWifiDirectListener.h @@ -66,19 +66,23 @@ public: /** * @see IWifiDirectDeviceListener::OnWifiDirectGroupCreatedN() */ - virtual void OnWifiDirectGroupCreatedN(const _WifiDirectEventArg& arg, WifiDirectGroupMemberType wifiDirectMemberType, result r) = 0; + virtual void OnWifiDirectGroupCreated(const _WifiDirectEventArg& arg, WifiDirectGroupMemberType wifiDirectMemberType, result r) = 0; + + /** + * @see IWifiDirectDeviceListener::OnWifiDirectRemoteDeviceFound() + */ + virtual void OnWifiDirectRemoteDeviceFound(const _WifiDirectEventArg& arg) = 0; /** * @see IWifiDirectDeviceListener::OnWifiDirectScanCompletedN() */ - virtual void OnWifiDirectScanCompletedN(const _WifiDirectEventArg& arg, result r) = 0; + virtual void OnWifiDirectScanCompleted(const _WifiDirectEventArg& arg, result r) = 0; /** * @see IWifiDirectDeviceListener::OnWifiDirectAssociationCompleted() */ virtual void OnWifiDirectAssociationCompleted(const _WifiDirectEventArg& arg, result r) = 0; - /** * @see IWifiDirectGroupOwnerListener::OnWifiDirectClientAssociated() */ diff --git a/src/inc/FNetWifi_WifiDirectDeviceImpl.h b/src/inc/FNetWifi_WifiDirectDeviceImpl.h index ec46e29..66e50be 100644 --- a/src/inc/FNetWifi_WifiDirectDeviceImpl.h +++ b/src/inc/FNetWifi_WifiDirectDeviceImpl.h @@ -386,12 +386,17 @@ private: /** * @see IWifiDirectDeviceListener::OnWifiDirectGroupCreatedN() */ - void OnWifiDirectGroupCreatedN(const _WifiDirectEventArg& arg, WifiDirectGroupMemberType wifiDirectMemberType, result r); + void OnWifiDirectGroupCreated(const _WifiDirectEventArg& arg, WifiDirectGroupMemberType wifiDirectMemberType, result r); - /** - * @see IWifiDirectDeviceListener::OnWifiDirectScanCompletedN() + /** + * @see IWifiDirectDeviceListener::OnWifiDirectRemoteDeviceFound() */ - void OnWifiDirectScanCompletedN(const _WifiDirectEventArg& arg, result r); + void OnWifiDirectRemoteDeviceFound(const _WifiDirectEventArg& arg); + + /** + * @see IWifiDirectDeviceListener::OnWifiDirectScanCompleted() + */ + void OnWifiDirectScanCompleted(const _WifiDirectEventArg& arg, result r); /** * @see IWifiDirectDeviceListener::OnWifiDirectAssociationCompleted() diff --git a/src/inc/FNet_ConnectivityIpcMessages.h b/src/inc/FNet_ConnectivityIpcMessages.h index 9db66d4..5863466 100644 --- a/src/inc/FNet_ConnectivityIpcMessages.h +++ b/src/inc/FNet_ConnectivityIpcMessages.h @@ -37,4 +37,6 @@ IPC_SYNC_MESSAGE_CONTROL1_2(ConnectivityNetServiceMsg_getAppNetAccountId, Tizen::Base::String /* ProfileName */, int /* NetAccountId */, unsigned long /* result */) IPC_SYNC_MESSAGE_CONTROL1_2(ConnectivityNetServiceMsg_setNetAccountId, int /* NetAccountId*/, int /* NetAccountId */, unsigned long /* result */) IPC_SYNC_MESSAGE_CONTROL3_1(ConnectivityNetServiceMsg_updateSystemNetAccount, Tizen::Base::String /* ProfileName */, Tizen::Net::NetAccountInfo /* NetAccountInfo */, int /* NetBearerType*/, unsigned long /* result */) +IPC_SYNC_MESSAGE_CONTROL2_1(ConnectivityNetServiceMsg_resetNetStatistics, int /* bearerType */, int /* statType */, unsigned long /* result */) +IPC_SYNC_MESSAGE_CONTROL1_1(ConnectivityNetServiceMsg_resetAllNetStatistics, int /* bearerType */, unsigned long /* result */) diff --git a/src/sockets/FNetSock_SecureSocketImpl.cpp b/src/sockets/FNetSock_SecureSocketImpl.cpp index 7fe111c..ec0c1d8 100644 --- a/src/sockets/FNetSock_SecureSocketImpl.cpp +++ b/src/sockets/FNetSock_SecureSocketImpl.cpp @@ -1730,9 +1730,9 @@ _SecureSocketImpl::Close(void) r = ConvertErrorToResult(errno); SysTryReturnResult(NID_NET_SOCK, r == E_SUCCESS, r, "Failed to close the socket."); } - } - SysLog(NID_NET_SOCK, "Socket is closed. [Fd : %d]", sockFd); + SysLog(NID_NET_SOCK, "Socket is closed. [Fd : %d]", sockFd); + } __socketFd = INVALID_HANDLE; __isClosed = true; diff --git a/src/sockets/FNetSock_SecureSocketManagedNetConnectionEventListenerImpl.cpp b/src/sockets/FNetSock_SecureSocketManagedNetConnectionEventListenerImpl.cpp index 886a16e..231ec05 100644 --- a/src/sockets/FNetSock_SecureSocketManagedNetConnectionEventListenerImpl.cpp +++ b/src/sockets/FNetSock_SecureSocketManagedNetConnectionEventListenerImpl.cpp @@ -206,7 +206,7 @@ _SecureSocketManagedNetConnectionEventListener::OnManagedNetConnectionStopped(Ma __pSecureSocketImpl->__pGlibSocketInfo = null; } - if (__pSecureSocketImpl->__socketFd >= 0) + if (__pSecureSocketImpl->__socketFd > INVALID_HANDLE) { sockFd = __pSecureSocketImpl->__socketFd; close(__pSecureSocketImpl->__socketFd); diff --git a/src/sockets/FNetSock_SocketImpl.cpp b/src/sockets/FNetSock_SocketImpl.cpp index 6b18a5d..a8899b0 100644 --- a/src/sockets/FNetSock_SocketImpl.cpp +++ b/src/sockets/FNetSock_SocketImpl.cpp @@ -531,9 +531,9 @@ _SocketImpl::Close(void) r = ConvertErrorToResult(errno); SysTryReturnResult(NID_NET_SOCK, r == E_SUCCESS, r, "Failed to close the socket."); } + + SysLog(NID_NET_SOCK, "Socket is closed. [Fd : %d]", sockFd); } - - SysLog(NID_NET_SOCK, "Socket is closed. [Fd : %d]", sockFd); __socketFd = INVALID_HANDLE; __isClosed = true; diff --git a/src/wifi/FNetWifiWifiDirectDevice.cpp b/src/wifi/FNetWifiWifiDirectDevice.cpp index 4043b5e..d9cefd1 100644 --- a/src/wifi/FNetWifiWifiDirectDevice.cpp +++ b/src/wifi/FNetWifiWifiDirectDevice.cpp @@ -42,7 +42,10 @@ namespace Tizen { namespace Net { namespace Wifi { WifiDirectDevice::~WifiDirectDevice(void) { - __pWifiDirectDeviceImpl->Release(); + if (__pWifiDirectDeviceImpl != null) + { + __pWifiDirectDeviceImpl->Release(); + } } result diff --git a/src/wifi/FNetWifiWifiDirectDeviceManager.cpp b/src/wifi/FNetWifiWifiDirectDeviceManager.cpp index 64b3c25..e442989 100644 --- a/src/wifi/FNetWifiWifiDirectDeviceManager.cpp +++ b/src/wifi/FNetWifiWifiDirectDeviceManager.cpp @@ -32,7 +32,7 @@ #include "FSys_SystemInfoImpl.h" #include "FNetWifi_WifiDirectDeviceManagerImpl.h" -static const wchar_t* _WIFI_DIRECT = L"http://tizen.org/feature/network.wifi.direct"; +static const wchar_t* _WIFI_DIRECT_FEATURE_INFO_KEY = L"http://tizen.org/feature/network.wifi.direct"; using namespace Tizen::Base; using namespace Tizen::Base::Collection; @@ -59,7 +59,7 @@ WifiDirectDeviceManager::GetAllDeviceInfoN(void) { bool isWifiDirectSupported = false; IList* pList = null; - result r = _SystemInfoImpl::GetSysInfo(_WIFI_DIRECT, isWifiDirectSupported); + result r = _SystemInfoImpl::GetSysInfo(_WIFI_DIRECT_FEATURE_INFO_KEY, isWifiDirectSupported); SysTryReturn(NID_NET_WIFI, r == E_SUCCESS && isWifiDirectSupported == true, null, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] No WifiDirectDeviceInfo available since the device don't support the Wi-Fi Direct."); @@ -80,7 +80,7 @@ WifiDirectDeviceManager::GetWifiDirectDeviceN(const WifiDirectDeviceInfo* pLocal { bool isWifiDirectSupported = false; WifiDirectDevice* pWifiDirectDevice = null; - result r = _SystemInfoImpl::GetSysInfo(_WIFI_DIRECT, isWifiDirectSupported); + result r = _SystemInfoImpl::GetSysInfo(_WIFI_DIRECT_FEATURE_INFO_KEY, isWifiDirectSupported); SysTryReturn(NID_NET_WIFI, r == E_SUCCESS && isWifiDirectSupported == true, null, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] No WifiDirectDeviceInfo available since the device don't support the Wi-Fi Direct."); diff --git a/src/wifi/FNetWifiWifiManager.cpp b/src/wifi/FNetWifiWifiManager.cpp index 81305cc..e5ee7a8 100644 --- a/src/wifi/FNetWifiWifiManager.cpp +++ b/src/wifi/FNetWifiWifiManager.cpp @@ -6,7 +6,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -28,13 +28,17 @@ #include #include #include +#include "FSys_SystemInfoImpl.h" #include "FNetWifi_WifiManagerImpl.h" +static const wchar_t* _WIFI_FEATURE_INFO_KEY = L"http://tizen.org/feature/network.wifi"; + using namespace std; using namespace Tizen::Base; using namespace Tizen::Base::Runtime; using namespace Tizen::Base::Collection; using namespace Tizen::Security; +using namespace Tizen::System; namespace Tizen { namespace Net { namespace Wifi { @@ -53,6 +57,11 @@ WifiManager::Construct(IWifiManagerEventListener& listener) { result r = E_SUCCESS; + bool isWifiSupported = false; + r = _SystemInfoImpl::GetSysInfo(_WIFI_FEATURE_INFO_KEY, isWifiSupported); + + SysTryReturnResult(NID_NET_WIFI, r == E_SUCCESS && isWifiSupported == true, E_UNSUPPORTED_OPERATION, "Wi-Fi is not supported."); + SysAssertf(__pWifiManagerImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class."); diff --git a/src/wifi/FNetWifi_WifiDirectDeviceEvent.cpp b/src/wifi/FNetWifi_WifiDirectDeviceEvent.cpp index 5a9df47..6f34e6b 100644 --- a/src/wifi/FNetWifi_WifiDirectDeviceEvent.cpp +++ b/src/wifi/FNetWifi_WifiDirectDeviceEvent.cpp @@ -69,118 +69,138 @@ _WifiDirectDeviceEvent::Construct(void) void _WifiDirectDeviceEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg) { - const _WifiDirectEventArg* pArg = dynamic_cast(&arg); - SysTryReturnVoidResult(NID_NET_WIFI, pArg != null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is a null pointer."); - - IWifiDirectDeviceListener* pDeviceListener = dynamic_cast(&listener); - SysTryReturnVoidResult(NID_NET_WIFI, pDeviceListener != null, E_INVALID_ARG, - "[E_INVALID_ARG] The result of a dynamic_cast operation is null for external Device listener."); - - _WifiDirectEventType eventType = pArg->GetEventType(); - WifiDirectDeviceId localDeviceId = pArg->GetDeviceId(); - result r = pArg->GetError(); - - switch (eventType) - { - case WIFI_DIRECT_DEVICE_EVENT_ACTIVATED: - SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_ACTIVATED) : %s",GetErrorMessage(r)); - pDeviceListener->OnWifiDirectDeviceActivated(localDeviceId, r); - break; - case WIFI_DIRECT_DEVICE_EVENT_DEACTIVATED: - SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_DEACTIVATED) : %s",GetErrorMessage(r)); - pDeviceListener->OnWifiDirectDeviceDeactivated(localDeviceId, r); - break; - case WIFI_DIRECT_DEVICE_EVENT_GROUP_CREATED: - SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_GROUP_CREATED) : %s",GetErrorMessage(r)); - { - WifiDirectGroupInfo* pGroupInfo = pArg->GetGroupInfo(); - WifiDirectDeviceInfo* pGroupOwnerInfo = pArg->GetDeviceInfo(); - WifiDirectGroupMember* pGroupMember = pArg->GetGroupMember(); - pDeviceListener->OnWifiDirectGroupCreatedN(localDeviceId, *pGroupInfo, *pGroupOwnerInfo, pGroupMember, r); - } - break; - case WIFI_DIRECT_DEVICE_EVENT_SCAN_COMPLETED: - SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_SCAN_COMPLETED) : %s",GetErrorMessage(r)); - { - if(!IsFailed(r)) - { - ArrayList* pSrcDeviceInfoList = dynamic_cast(pArg->GetDeviceInfoList()); - SysTryCatch(NID_NET_WIFI, pSrcDeviceInfoList != null, , E_SYSTEM, "[E_SYSTEM] Failed to dynamic casting DeviceInfo list."); - - ArrayList* pDescDeviceInfoList = new (std::nothrow) ArrayList(); - SysTryCatch(NID_NET_WIFI, pDescDeviceInfoList != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); - - result res = pDescDeviceInfoList->Construct(*pSrcDeviceInfoList); - - if (IsFailed(res)) - { - delete pDescDeviceInfoList; - pDescDeviceInfoList = null; - - r = E_SYSTEM; - } - - pDeviceListener->OnWifiDirectScanCompletedN(localDeviceId, pDescDeviceInfoList, r); - } - else - { - pDeviceListener->OnWifiDirectScanCompletedN(localDeviceId, null, r); - } - } - break; - case WIFI_DIRECT_DEVICE_EVENT_ASSOCIATED: - SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_ASSOCIATED) : %s",GetErrorMessage(r)); - { - WifiDirectDeviceInfo* pGroupOwnerInfo = pArg->GetDeviceInfo(); - if (pGroupOwnerInfo == null) - { - pDeviceListener->OnWifiDirectAssociationCompleted(localDeviceId, WifiDirectDeviceInfo(), r); - } - else - { - pDeviceListener->OnWifiDirectAssociationCompleted(localDeviceId, *pGroupOwnerInfo, r); - } - } - break; - case WIFI_DIRECT_DEVICE_EVENT_CONNECTED: - SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_CONNECTED) : %s",GetErrorMessage(r)); - { - WifiDirectDeviceInfo* pDeviceInfo = pArg->GetDeviceInfo(); - if (pDeviceInfo == null) - { - pDeviceListener->OnWifiDirectConnected(localDeviceId, WifiDirectDeviceInfo(), r); - } - else - { - pDeviceListener->OnWifiDirectConnected(localDeviceId, *pDeviceInfo, r); - } - } - break; - case WIFI_DIRECT_DEVICE_EVENT_DISCONNECTED: - { - SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_DISCONNECTED) : %s",GetErrorMessage(r)); - String macAddress = pArg->GetMacAddress(); - pDeviceListener->OnWifiDirectDisconnected(localDeviceId, macAddress, r); - } - break; - case WIFI_DIRECT_DEVICE_EVENT_AUTONOMOS_GROUP_CREATED: - SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_AUTONOMOS_GROUP_CREATED) : %s",GetErrorMessage(r)); - pDeviceListener->OnWifiDirectAutonomousGroupCreated(localDeviceId, r); - break; - case WIFI_DIRECT_DEVICE_EVENT_GROUP_LEFT: - SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_GROUP_LEFT) : %s",GetErrorMessage(r)); - pDeviceListener->OnWifiDirectGroupLeft(localDeviceId, r); - break; - default: - SysLog(NID_NET_WIFI, "An undefined external WifiDirectDevice event occurs. (Type: %d)",eventType); - SysAssert(false); - break; - } - return; - -CATCH: - pDeviceListener->OnWifiDirectScanCompletedN(localDeviceId, null, r); - + const _WifiDirectEventArg* pArg = dynamic_cast< const _WifiDirectEventArg* >(&arg); + SysTryReturnVoidResult(NID_NET_WIFI, pArg != null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is a null pointer."); + + IWifiDirectDeviceListener* pDeviceListener = dynamic_cast< IWifiDirectDeviceListener* >(&listener); + SysTryReturnVoidResult(NID_NET_WIFI, pDeviceListener != null, E_INVALID_ARG, + "[E_INVALID_ARG] The result of a dynamic_cast operation is null for external Device listener."); + + _WifiDirectEventType eventType = pArg->GetEventType(); + WifiDirectDeviceId localDeviceId = pArg->GetDeviceId(); + result r = pArg->GetError(); + + switch (eventType) + { + case WIFI_DIRECT_DEVICE_EVENT_ACTIVATED: + SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_ACTIVATED) : %s", GetErrorMessage(r)); + pDeviceListener->OnWifiDirectDeviceActivated(localDeviceId, r); + break; + + case WIFI_DIRECT_DEVICE_EVENT_DEACTIVATED: + SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_DEACTIVATED) : %s", GetErrorMessage(r)); + pDeviceListener->OnWifiDirectDeviceDeactivated(localDeviceId, r); + break; + + case WIFI_DIRECT_DEVICE_EVENT_GROUP_CREATED: + SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_GROUP_CREATED) : %s", GetErrorMessage(r)); + { + WifiDirectGroupInfo* pGroupInfo = pArg->GetGroupInfo(); + WifiDirectDeviceInfo* pGroupOwnerInfo = pArg->GetDeviceInfo(); + WifiDirectGroupMember* pGroupMember = pArg->GetGroupMember(); + pDeviceListener->OnWifiDirectGroupCreatedN(localDeviceId, *pGroupInfo, *pGroupOwnerInfo, pGroupMember, r); + } + break; + case WIFI_DIRECT_DEVICE_EVENT_SCAN_FOUND: + SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_SCAN_FOUND)"); + { + WifiDirectDeviceInfo* pDeviceInfo = pArg->GetDeviceInfo(); + pDeviceListener->OnWifiDirectRemoteDeviceFound(localDeviceId, *pDeviceInfo); + } + break; + case WIFI_DIRECT_DEVICE_EVENT_SCAN_COMPLETED: + SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_SCAN_COMPLETED) : %s", GetErrorMessage(r)); + { + if (!IsFailed(r)) + { + ArrayList* pSrcDeviceInfoList = dynamic_cast< ArrayList* >(pArg->GetDeviceInfoList()); + if (pSrcDeviceInfoList == null) + { + SysLogException(NID_NET_WIFI, E_SYSTEM, "[E_SYSTEM] Failed to dynamic casting DeviceInfo list."); + pDeviceListener->OnWifiDirectScanCompletedN(localDeviceId, null, E_SYSTEM); + return; + } + + ArrayList* pDescDeviceInfoList = new (std::nothrow) ArrayList(); + if (pSrcDeviceInfoList == null) + { + SysLogException(NID_NET_WIFI, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + pDeviceListener->OnWifiDirectScanCompletedN(localDeviceId, null, E_SYSTEM); + return; + } + + result res = pDescDeviceInfoList->Construct(*pSrcDeviceInfoList); + + if (IsFailed(res)) + { + delete pDescDeviceInfoList; + pDescDeviceInfoList = null; + + r = E_SYSTEM; + } + + pDeviceListener->OnWifiDirectScanCompletedN(localDeviceId, pDescDeviceInfoList, r); + } + else + { + pDeviceListener->OnWifiDirectScanCompletedN(localDeviceId, null, r); + } + } + break; + + case WIFI_DIRECT_DEVICE_EVENT_ASSOCIATED: + SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_ASSOCIATED) : %s", GetErrorMessage(r)); + { + WifiDirectDeviceInfo* pGroupOwnerInfo = pArg->GetDeviceInfo(); + if (pGroupOwnerInfo == null) + { + pDeviceListener->OnWifiDirectAssociationCompleted(localDeviceId, WifiDirectDeviceInfo(), r); + } + else + { + pDeviceListener->OnWifiDirectAssociationCompleted(localDeviceId, *pGroupOwnerInfo, r); + } + } + break; + + case WIFI_DIRECT_DEVICE_EVENT_CONNECTED: + SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_CONNECTED) : %s", GetErrorMessage(r)); + { + WifiDirectDeviceInfo* pDeviceInfo = pArg->GetDeviceInfo(); + if (pDeviceInfo == null) + { + pDeviceListener->OnWifiDirectConnected(localDeviceId, WifiDirectDeviceInfo(), r); + } + else + { + pDeviceListener->OnWifiDirectConnected(localDeviceId, *pDeviceInfo, r); + } + } + break; + + case WIFI_DIRECT_DEVICE_EVENT_DISCONNECTED: + { + SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_DISCONNECTED) : %s", GetErrorMessage(r)); + String macAddress = pArg->GetMacAddress(); + pDeviceListener->OnWifiDirectDisconnected(localDeviceId, macAddress, r); + } + break; + + case WIFI_DIRECT_DEVICE_EVENT_AUTONOMOS_GROUP_CREATED: + SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_AUTONOMOS_GROUP_CREATED) : %s", GetErrorMessage(r)); + pDeviceListener->OnWifiDirectAutonomousGroupCreated(localDeviceId, r); + break; + + case WIFI_DIRECT_DEVICE_EVENT_GROUP_LEFT: + SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_DEVICE_EVENT_GROUP_LEFT) : %s", GetErrorMessage(r)); + pDeviceListener->OnWifiDirectGroupLeft(localDeviceId, r); + break; + + default: + SysLog(NID_NET_WIFI, "An undefined external WifiDirectDevice event occurs. (Type: %d)", eventType); + SysAssert(false); + break; + } } } } } // Tizen::Net::Wifi diff --git a/src/wifi/FNetWifi_WifiDirectDeviceImpl.cpp b/src/wifi/FNetWifi_WifiDirectDeviceImpl.cpp index 96ba0c5..b5aed26 100644 --- a/src/wifi/FNetWifi_WifiDirectDeviceImpl.cpp +++ b/src/wifi/FNetWifi_WifiDirectDeviceImpl.cpp @@ -969,7 +969,7 @@ _WifiDirectDeviceImpl::OnWifiDirectDeviceDeactivated(const _WifiDirectEventArg& } void -_WifiDirectDeviceImpl::OnWifiDirectGroupCreatedN(const _WifiDirectEventArg& arg, +_WifiDirectDeviceImpl::OnWifiDirectGroupCreated(const _WifiDirectEventArg& arg, WifiDirectGroupMemberType wifiDirectMemberType, result r) { SysLog(NID_NET_WIFI, "Enter, [DeviceState:%s], [ScanState:%s], [result:%s]", @@ -1027,20 +1027,31 @@ _WifiDirectDeviceImpl::OnWifiDirectGroupCreatedN(const _WifiDirectEventArg& arg, } void -_WifiDirectDeviceImpl::OnWifiDirectScanCompletedN(const _WifiDirectEventArg& arg, result r) +_WifiDirectDeviceImpl::OnWifiDirectRemoteDeviceFound(const _WifiDirectEventArg& arg) { - SysLog(NID_NET_WIFI, "Enter, [DeviceState:%s], [ScanState:%s], [result:%s]", - GetStringOfCurrentState(), GetStringOfScanState(), GetErrorMessage(r)); + if (__scanState == WIFI_DIRECT_SCAN_INTERNAL_SCANNING) + { + _WifiDirectEventArg* pNewArg = new (std::nothrow) _WifiDirectEventArg(arg); + SysTryReturnVoidResult(NID_NET_WIFI, pNewArg != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + __pWifiDirectDeviceEvent->FireAsync(*pNewArg); + } +} + +void +_WifiDirectDeviceImpl::OnWifiDirectScanCompleted(const _WifiDirectEventArg& arg, result r) +{ + SysLog(NID_NET_WIFI, "Enter, [DeviceState:%s], [ScanState:%s], [result:%s]", + GetStringOfCurrentState(), GetStringOfScanState(), GetErrorMessage(r)); bool isFired = false; - __stateMutex.Acquire(); + __stateMutex.Acquire(); if (__scanState != WIFI_DIRECT_SCAN_INTERNAL_IDLE) { - isFired = true; + isFired = true; __scanState = WIFI_DIRECT_SCAN_INTERNAL_IDLE; } - __stateMutex.Release(); + __stateMutex.Release(); if (isFired) { @@ -1051,7 +1062,7 @@ _WifiDirectDeviceImpl::OnWifiDirectScanCompletedN(const _WifiDirectEventArg& arg SysLog(NID_NET_WIFI, "[SCANCOMPLETED_Event:%s]", isFired ? "Fired" : "NotFired"); SysLog(NID_NET_WIFI, "Exit, [DeviceState:%s], [ScanState:%s], [result:%s]", - GetStringOfCurrentState(), GetStringOfScanState(), GetErrorMessage(r)); + GetStringOfCurrentState(), GetStringOfScanState(), GetErrorMessage(r)); } void @@ -1726,13 +1737,22 @@ _WifiDirectDeviceImpl_DeleteWifiDirectDevice(Tizen::Net::Wifi::WifiDirectDevice* { SysTryReturnVoidResult(NID_NET_WIFI, pWifiDirectDevice != null, E_INVALID_ARG, "[E_INVALID_ARG] WifiDirectDevice is null."); - pWifiDirectDevice->RemoveWifiDirectGroupClientListener(*pClientListener); - pWifiDirectDevice->RemoveWifiDirectGroupOwnerListener(*pOwnerListener); - pWifiDirectDevice->RemoveWifiDirectDeviceListener(*pDeviceListener); + if (pClientListener != null) + { + pWifiDirectDevice->RemoveWifiDirectGroupClientListener(*pClientListener); + } - delete pWifiDirectDevice; + if (pOwnerListener != null) + { + pWifiDirectDevice->RemoveWifiDirectGroupOwnerListener(*pOwnerListener); + } + + if (pDeviceListener != null) + { + pWifiDirectDevice->RemoveWifiDirectDeviceListener(*pDeviceListener); + } - return; + delete pWifiDirectDevice; } _OSP_EXPORT_ result diff --git a/src/wifi/FNetWifi_WifiDirectDeviceInfoImpl.cpp b/src/wifi/FNetWifi_WifiDirectDeviceInfoImpl.cpp index 9c54276..b117baa 100644 --- a/src/wifi/FNetWifi_WifiDirectDeviceInfoImpl.cpp +++ b/src/wifi/FNetWifi_WifiDirectDeviceInfoImpl.cpp @@ -481,15 +481,9 @@ _WifiDirectDeviceInfoImpl_GetIpAddress(const Tizen::Net::Wifi::WifiDirectDeviceI } _OSP_EXPORT_ Tizen::Base::String -_WifiDirectDeviceInfoImpl_GetVirtualMacAddress(const Tizen::Net::Wifi::WifiDirectDeviceInfo& deviceInfo) +_WifiDirectDeviceInfoImpl_GetMacAddress(const Tizen::Net::Wifi::WifiDirectDeviceInfo& deviceInfo) { - const Tizen::Net::Wifi::_WifiDirectDeviceInfoImpl* pWifiDirectDeviceInfoImpl = null; - - pWifiDirectDeviceInfoImpl = Tizen::Net::Wifi::_WifiDirectDeviceInfoImpl::GetInstance(deviceInfo); - SysTryReturn(NID_NET_WIFI, pWifiDirectDeviceInfoImpl != null, Tizen::Base::String(L""), E_SYSTEM, - "[E_SYSTEM] A system error has occurred. Failed to get WifiDirectDeviceInfo instance."); - - return pWifiDirectDeviceInfoImpl->GetVirtualMacAddress(); + return deviceInfo.GetMacAddress(); } #ifdef __cplusplus diff --git a/src/wifi/FNetWifi_WifiDirectEvent.cpp b/src/wifi/FNetWifi_WifiDirectEvent.cpp index 2c78daa..63c1904 100644 --- a/src/wifi/FNetWifi_WifiDirectEvent.cpp +++ b/src/wifi/FNetWifi_WifiDirectEvent.cpp @@ -56,78 +56,96 @@ _WifiDirectEvent::Construct(void) void _WifiDirectEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg) { - _WifiDirectEventArg* pArg = const_cast< _WifiDirectEventArg*>(dynamic_cast(&arg)); - SysTryReturnVoidResult(NID_NET_WIFI, pArg != null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is a null pointer."); - - _IWifiDirectListener* pInternalListener = dynamic_cast<_IWifiDirectListener*>(&listener); - SysTryReturnVoidResult(NID_NET_WIFI, pInternalListener != null, E_INVALID_ARG, - "[E_INVALID_ARG] The result of a dynamic_cast operation is null for internal listener."); - - _WifiDirectEventType eventType = pArg->GetEventType(); - result r = pArg->GetError(); - - switch (eventType) - { - case WIFI_DIRECT_DEVICE_EVENT_ACTIVATED: - SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_ACTIVATED) : %s",GetErrorMessage(r)); - pInternalListener->OnWifiDirectDeviceActivated(*pArg, r); - break; - case WIFI_DIRECT_DEVICE_EVENT_DEACTIVATED: - SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_DEACTIVATED) : %s",GetErrorMessage(r)); - pInternalListener->OnWifiDirectDeviceDeactivated(*pArg, r); - break; - case WIFI_DIRECT_DEVICE_EVENT_GROUP_CREATED: - SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_GROUP_CREATED) : %s",GetErrorMessage(r)); - pInternalListener->OnWifiDirectGroupCreatedN(*pArg, pArg->GetGroupMemberType(), r); - break; - case WIFI_DIRECT_DEVICE_EVENT_SCAN_COMPLETED: - SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_SCAN_COMPLETED) : %s",GetErrorMessage(r)); - pInternalListener->OnWifiDirectScanCompletedN(*pArg, r); - break; - case WIFI_DIRECT_DEVICE_EVENT_ASSOCIATED: - SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_ASSOCIATED) : %s",GetErrorMessage(r)); - pInternalListener->OnWifiDirectAssociationCompleted(*pArg, r); - break; - case WIFI_DIRECT_GO_EVENT_CLIENT_ASSOCIATED: - SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_GO_EVENT_CLIENT_ASSOCIATED) : %s",GetErrorMessage(r)); - pInternalListener->OnWifiDirectClientAssociated(*pArg); - break; - case WIFI_DIRECT_GO_EVENT_CLIENT_DISASSOCIATED: - SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_GO_EVENT_CLIENT_DISASSOCIATED) : %s",GetErrorMessage(r)); - { - WifiDirectAssociationTerminationReason reason = pArg->GetDisassociationReason(); - pInternalListener->OnWifiDirectClientDisassociated(*pArg, reason); - } - break; - case WIFI_DIRECT_GO_EVENT_GROUP_DESTROYED: - SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_GO_EVENT_GROUP_DESTROYED) : %s",GetErrorMessage(r)); - pInternalListener->OnWifiDirectGroupDestroyed(*pArg, r); - break; - case WIFI_DIRECT_GC_EVENT_DISASSOCIATED: - SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_GC_EVENT_DISASSOCIATED) : %s",GetErrorMessage(r)); - pInternalListener->OnWifiDirectAssociationTerminated(*pArg, r); - break; - case WIFI_DIRECT_DEVICE_EVENT_CONNECTED: - SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_CONNECTED) : %s",GetErrorMessage(r)); - pInternalListener->OnWifiDirectConnected(*pArg, r); - break; - case WIFI_DIRECT_DEVICE_EVENT_DISCONNECTED: - SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_DISCONNECTED) : %s",GetErrorMessage(r)); - pInternalListener->OnWifiDirectDisconnected(*pArg, r); - break; - case WIFI_DIRECT_DEVICE_EVENT_AUTONOMOS_GROUP_CREATED: - SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_AUTONOMOS_GROUP_CREATED) : %s",GetErrorMessage(r)); - pInternalListener->OnWifiDirectAutonomousGroupCreated(*pArg, r); - break; - case WIFI_DIRECT_DEVICE_EVENT_GROUP_LEFT: - SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_GROUP_LEFT) : %s",GetErrorMessage(r)); - pInternalListener->OnWifiDirectGroupLeft(*pArg, r); - break; - default: - SysLog(NID_NET_WIFI, "An undefined internal WifiDirectDevice event occurs. (Type: %d)",eventType); - SysAssert(false); - break; - } + _WifiDirectEventArg* pArg = const_cast< _WifiDirectEventArg* >(dynamic_cast< const _WifiDirectEventArg* >(&arg)); + SysTryReturnVoidResult(NID_NET_WIFI, pArg != null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is a null pointer."); + + _IWifiDirectListener* pInternalListener = dynamic_cast< _IWifiDirectListener* >(&listener); + SysTryReturnVoidResult(NID_NET_WIFI, pInternalListener != null, E_INVALID_ARG, + "[E_INVALID_ARG] The result of a dynamic_cast operation is null for internal listener."); + + _WifiDirectEventType eventType = pArg->GetEventType(); + result r = pArg->GetError(); + + switch (eventType) + { + case WIFI_DIRECT_DEVICE_EVENT_ACTIVATED: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_ACTIVATED) : %s", GetErrorMessage(r)); + pInternalListener->OnWifiDirectDeviceActivated(*pArg, r); + break; + + case WIFI_DIRECT_DEVICE_EVENT_DEACTIVATED: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_DEACTIVATED) : %s", GetErrorMessage(r)); + pInternalListener->OnWifiDirectDeviceDeactivated(*pArg, r); + break; + + case WIFI_DIRECT_DEVICE_EVENT_GROUP_CREATED: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_GROUP_CREATED) : %s", GetErrorMessage(r)); + pInternalListener->OnWifiDirectGroupCreated(*pArg, pArg->GetGroupMemberType(), r); + break; + + case WIFI_DIRECT_DEVICE_EVENT_SCAN_FOUND: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_SCAN_FOUND)"); + pInternalListener->OnWifiDirectRemoteDeviceFound(*pArg); + break; + + case WIFI_DIRECT_DEVICE_EVENT_SCAN_COMPLETED: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_SCAN_COMPLETED) : %s", GetErrorMessage(r)); + pInternalListener->OnWifiDirectScanCompleted(*pArg, r); + break; + + case WIFI_DIRECT_DEVICE_EVENT_ASSOCIATED: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_ASSOCIATED) : %s", GetErrorMessage(r)); + pInternalListener->OnWifiDirectAssociationCompleted(*pArg, r); + break; + + case WIFI_DIRECT_GO_EVENT_CLIENT_ASSOCIATED: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_GO_EVENT_CLIENT_ASSOCIATED) : %s", GetErrorMessage(r)); + pInternalListener->OnWifiDirectClientAssociated(*pArg); + break; + + case WIFI_DIRECT_GO_EVENT_CLIENT_DISASSOCIATED: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_GO_EVENT_CLIENT_DISASSOCIATED) : %s", GetErrorMessage(r)); + { + WifiDirectAssociationTerminationReason reason = pArg->GetDisassociationReason(); + pInternalListener->OnWifiDirectClientDisassociated(*pArg, reason); + } + break; + + case WIFI_DIRECT_GO_EVENT_GROUP_DESTROYED: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_GO_EVENT_GROUP_DESTROYED) : %s", GetErrorMessage(r)); + pInternalListener->OnWifiDirectGroupDestroyed(*pArg, r); + break; + + case WIFI_DIRECT_GC_EVENT_DISASSOCIATED: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_GC_EVENT_DISASSOCIATED) : %s", GetErrorMessage(r)); + pInternalListener->OnWifiDirectAssociationTerminated(*pArg, r); + break; + + case WIFI_DIRECT_DEVICE_EVENT_CONNECTED: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_CONNECTED) : %s", GetErrorMessage(r)); + pInternalListener->OnWifiDirectConnected(*pArg, r); + break; + + case WIFI_DIRECT_DEVICE_EVENT_DISCONNECTED: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_DISCONNECTED) : %s", GetErrorMessage(r)); + pInternalListener->OnWifiDirectDisconnected(*pArg, r); + break; + + case WIFI_DIRECT_DEVICE_EVENT_AUTONOMOS_GROUP_CREATED: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_AUTONOMOS_GROUP_CREATED) : %s", GetErrorMessage(r)); + pInternalListener->OnWifiDirectAutonomousGroupCreated(*pArg, r); + break; + + case WIFI_DIRECT_DEVICE_EVENT_GROUP_LEFT: + SysLog(NID_NET_WIFI, "Firing Internal Event (Type: WIFI_DIRECT_DEVICE_EVENT_GROUP_LEFT) : %s", GetErrorMessage(r)); + pInternalListener->OnWifiDirectGroupLeft(*pArg, r); + break; + + default: + SysLog(NID_NET_WIFI, "An undefined internal WifiDirectDevice event occurs. (Type: %d)", eventType); + SysAssert(false); + break; + } } } } } // Tizen::Net::Wifi diff --git a/src/wifi/FNetWifi_WifiDirectEventArg.h b/src/wifi/FNetWifi_WifiDirectEventArg.h index 60ba314..3fec59f 100644 --- a/src/wifi/FNetWifi_WifiDirectEventArg.h +++ b/src/wifi/FNetWifi_WifiDirectEventArg.h @@ -53,6 +53,7 @@ enum _WifiDirectEventType WIFI_DIRECT_DEVICE_EVENT_ACTIVATED, WIFI_DIRECT_DEVICE_EVENT_DEACTIVATED, WIFI_DIRECT_DEVICE_EVENT_GROUP_CREATED, + WIFI_DIRECT_DEVICE_EVENT_SCAN_FOUND, WIFI_DIRECT_DEVICE_EVENT_SCAN_COMPLETED, WIFI_DIRECT_DEVICE_EVENT_ASSOCIATED, WIFI_DIRECT_DEVICE_EVENT_CONNECTED, @@ -159,7 +160,7 @@ public: * @param[in] wifiDirectGroupOwnerDeviceInfo A reference to the WifiDirectDeviceInfo instance of the group owner. * @param[in] r The error code. * - * @remarks This method can be used for WIFI_DIRECT_DEVICE_EVENT_ASSOCIATED, WIFI_DIRECT_GO_EVENT_CLIENT_ASSOCIATED + * @remarks This method can be used for WIFI_DIRECT_DEVICE_EVENT_SCAN_FOUND, WIFI_DIRECT_DEVICE_EVENT_ASSOCIATED, WIFI_DIRECT_GO_EVENT_CLIENT_ASSOCIATED * ,WIFI_DIRECT_GC_EVENT_GROUP_OWNER_INFO_RESPONDED or WIFI_DIRECT_DEVICE_EVENT_CONNECTED event. */ _WifiDirectEventArg(_WifiDirectEventType eventType, WifiDirectDeviceId localDeviceId, diff --git a/src/wifi/FNetWifi_WifiDirectSystemAdapter.cpp b/src/wifi/FNetWifi_WifiDirectSystemAdapter.cpp index 3e9470f..a03457a 100644 --- a/src/wifi/FNetWifi_WifiDirectSystemAdapter.cpp +++ b/src/wifi/FNetWifi_WifiDirectSystemAdapter.cpp @@ -1149,7 +1149,7 @@ _WifiDirectSystemAdapter::Construct(void) r = InitializeCurrentState(); SysTryCatch(NID_NET_WIFI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); - r = __peerList.Construct(); + r = __connectedPeerList.Construct(); SysTryCatch(NID_NET_WIFI, r == E_SUCCESS, , E_SYSTEM, "[%s] Construction of ArrayList has failed.", GetErrorMessage(r)); __pWifiDirectEvent = move(pWifiDirectEvent); @@ -1177,20 +1177,20 @@ result _WifiDirectSystemAdapter::AddPeerInfo(WifiDirectDeviceInfo* pPeerInfo) { WifiDirectDeviceInfo* pPeerInfoTemp = new WifiDirectDeviceInfo(*pPeerInfo); - return __peerList.Add(*pPeerInfoTemp); + return __connectedPeerList.Add(*pPeerInfoTemp); } result _WifiDirectSystemAdapter::RemovePeerInfo(WifiDirectDeviceInfo* pPeerInfo) { - return __peerList.Remove(*pPeerInfo, true); + return __connectedPeerList.Remove(*pPeerInfo, true); } WifiDirectDeviceInfo* _WifiDirectSystemAdapter::GetPeerInfo(const String& macAddress) { WifiDirectDeviceInfo* pDeviceInfo = null; - for(int i = 0; i < __peerList.GetCount(); i++) + for(int i = 0; i < __connectedPeerList.GetCount(); i++) { - pDeviceInfo = dynamic_cast(__peerList.GetAt(i)); + pDeviceInfo = dynamic_cast(__connectedPeerList.GetAt(i)); if (pDeviceInfo != null && pDeviceInfo->GetMacAddress() == macAddress) { @@ -1206,7 +1206,9 @@ _WifiDirectSystemAdapter::_WifiDirectSystemAdapter(void) , __pScanResult(null) , __currentState(WIFI_DIRECT_SYSTEM_DEACTIVATED) , __currentScanState(WIFI_DIRECT_SYSTEM_SCAN_IDLE) - , __peerList() + , __connectedPeerList(SingleObjectDeleter) + , __discoveredPeerList(SingleObjectDeleter) + , __pWifiServiceProxy(null) { @@ -1216,8 +1218,6 @@ _WifiDirectSystemAdapter::~_WifiDirectSystemAdapter(void) { int err = WIFI_DIRECT_ERROR_NONE; - __peerList.RemoveAll(true); - err = wifi_direct_deinitialize(); SysLog(NID_NET_WIFI, "[0x%x] Return value of wifi_direct_deinitialize()", err); } @@ -1540,6 +1540,8 @@ _WifiDirectSystemAdapter::OnWifiDirectScanCompleted(int errorCode, wifi_direct_d result r = E_SYSTEM; _WifiDirectConvertErrorResult(errorCode == WIFI_DIRECT_ERROR_NONE, r, E_SUCCESS); + ArrayList foundPeerList(SingleObjectDeleter); + switch(discoveryState) { case WIFI_DIRECT_ONLY_LISTEN_STARTED: @@ -1554,6 +1556,7 @@ _WifiDirectSystemAdapter::OnWifiDirectScanCompleted(int errorCode, wifi_direct_d break; case WIFI_DIRECT_DISCOVERY_STARTED: SysLog(NID_NET_WIFI, "discoveryState : WIFI_DIRECT_DISCOVERY_STARTED"); + __pWifiDirectSystemAdapter->__discoveredPeerList.RemoveAll(); break; case WIFI_DIRECT_DISCOVERY_FOUND: SysLog(NID_NET_WIFI, "discoveryState : WIFI_DIRECT_DISCOVERY_FOUND"); @@ -1563,6 +1566,14 @@ _WifiDirectSystemAdapter::OnWifiDirectScanCompleted(int errorCode, wifi_direct_d r = _WifiDirectUtility::ConvertErrorCode(err); SysTryCatch(NID_NET_WIFI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); } + else if (__pWifiDirectSystemAdapter->__currentScanState == WIFI_DIRECT_SYSTEM_SCAN_SCANNING) + { + int err = wifi_direct_foreach_discovered_peers(OnWifiDirectPeerFound, &foundPeerList); + SysLog(NID_NET_WIFI, "[0x%x] Return value of wifi_direct_foreach_discovered_peers()", err); + r = _WifiDirectUtility::ConvertErrorCode(err); + SysTryCatch(NID_NET_WIFI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); + } + break; case WIFI_DIRECT_DISCOVERY_FINISHED: SysLog(NID_NET_WIFI, "discoveryState: WIFI_DIRECT_DISCOVERY_FINISHED"); @@ -1694,6 +1705,30 @@ _WifiDirectSystemAdapter::OnWifiDirectEachDiscoveredPeer(wifi_direct_discovered_ } bool +_WifiDirectSystemAdapter::OnWifiDirectPeerFound(wifi_direct_discovered_peer_info_s* peer, void* pUserData) +{ + unique_ptr pDeviceInfo(_WifiDirectUtility::ConvertDiscoveryEntry2DeviceInfoN(*peer)); + SysTryReturn(NID_NET_WIFI, pDeviceInfo != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + + int index = 0; + + result r = __pWifiDirectSystemAdapter->__discoveredPeerList.IndexOf(*pDeviceInfo, index); + + if (r == E_OBJ_NOT_FOUND || r == E_OUT_OF_RANGE) + { + _WifiDirectEventArg* pEventArg = new (std::nothrow)_WifiDirectEventArg(WIFI_DIRECT_DEVICE_EVENT_SCAN_FOUND, DEFAULT_DEVICE_ID, + *pDeviceInfo); + SysTryReturn(NID_NET_WIFI, pEventArg != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + + __pWifiDirectSystemAdapter->__pWifiDirectEvent->FireAsync(*pEventArg); + + __pWifiDirectSystemAdapter->__discoveredPeerList.Add(pDeviceInfo.release()); + } + + return true; +} + +bool _WifiDirectSystemAdapter::OnWifiDirectEachConnectedClient(wifi_direct_connected_peer_info_s* pPeer, void* pUserData) { IList* pList = static_cast(pUserData); diff --git a/src/wifi/FNetWifi_WifiDirectSystemAdapter.h b/src/wifi/FNetWifi_WifiDirectSystemAdapter.h index 990eda1..ea3952d 100644 --- a/src/wifi/FNetWifi_WifiDirectSystemAdapter.h +++ b/src/wifi/FNetWifi_WifiDirectSystemAdapter.h @@ -285,8 +285,17 @@ public: */ static void OnWifiDirectClientIpAssigned(const char *mac_address, const char *ip_address, const char *interface_address, void *user_data); + + /** + * Call back for each discovered device + * + * @param[in] pPeer Device Information + * @param[in] pUserData The user data passed from the callback registration function + */ + static bool OnWifiDirectPeerFound(wifi_direct_discovered_peer_info_s* pPeer, void* pUserData); + /** - * Call back for each Discovered device + * Call back for each discovered device * * @param[in] pPeer Device Information * @param[in] pUserData The user data passed from the callback registration function @@ -549,7 +558,8 @@ private: Tizen::Base::Collection::IList* __pScanResult; _WifiDirectSystemState __currentState; _WifiDirectSystemScanState __currentScanState; - Tizen::Base::Collection::ArrayList __peerList; + Tizen::Base::Collection::ArrayList __connectedPeerList; + Tizen::Base::Collection::ArrayList __discoveredPeerList; _WifiIpcProxy* __pWifiServiceProxy; friend class std::default_delete<_WifiDirectSystemAdapter>; }; diff --git a/src/wifi/FNetWifi_WifiNetAccountInfoImpl.cpp b/src/wifi/FNetWifi_WifiNetAccountInfoImpl.cpp index 13e7b8e..e0fc2d8 100644 --- a/src/wifi/FNetWifi_WifiNetAccountInfoImpl.cpp +++ b/src/wifi/FNetWifi_WifiNetAccountInfoImpl.cpp @@ -182,8 +182,7 @@ _WifiNetAccountInfoImpl::CreateWifiNetAccountInfoN(void* pProfileInfo) connection_profile_get_wifi_bssid(profileHandle, &pBssid); SysTryCatch(NID_NET_WIFI, pBssid, , E_SYSTEM, "[E_SYSTEM] connection_profile_get_wifi_essid failed."); - - bssid = String(pBssid); + bssid = _WifiUtility::ConvertMacAddress(pBssid); free(pBssid); wifiBssType = WIFI_BSS_TYPE_INFRASTRUCTURE; diff --git a/src/wifi/FNetWifi_WifiSystemMonitoringEvent.cpp b/src/wifi/FNetWifi_WifiSystemMonitoringEvent.cpp index dd9cd83..df62f08 100644 --- a/src/wifi/FNetWifi_WifiSystemMonitoringEvent.cpp +++ b/src/wifi/FNetWifi_WifiSystemMonitoringEvent.cpp @@ -6,7 +6,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/wifi/FNetWifi_WifiSystemMonitoringEvent.h b/src/wifi/FNetWifi_WifiSystemMonitoringEvent.h index e48eadb..1866f29 100644 --- a/src/wifi/FNetWifi_WifiSystemMonitoringEvent.h +++ b/src/wifi/FNetWifi_WifiSystemMonitoringEvent.h @@ -6,7 +6,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/wifi/FNetWifi_WifiSystemMonitoringEventArg.cpp b/src/wifi/FNetWifi_WifiSystemMonitoringEventArg.cpp index 8c5563b..771c4bd 100644 --- a/src/wifi/FNetWifi_WifiSystemMonitoringEventArg.cpp +++ b/src/wifi/FNetWifi_WifiSystemMonitoringEventArg.cpp @@ -6,7 +6,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/wifi/FNetWifi_WifiSystemMonitoringEventArg.h b/src/wifi/FNetWifi_WifiSystemMonitoringEventArg.h index 9e9eabd..c727466 100644 --- a/src/wifi/FNetWifi_WifiSystemMonitoringEventArg.h +++ b/src/wifi/FNetWifi_WifiSystemMonitoringEventArg.h @@ -6,7 +6,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS,